ngaro

module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2016 License: Apache-2.0

README

Build Status Go Report Card GoDoc

Ngaro Go

Overview

This is another Go implementation of the Ngaro Virtual Machine.

This repository contains the embeddable virtual machine, a rudimentary symbolic assembler for easy bootstrapping of projects written in Ngaro machine language, and the retro command line tool that can be used as a replacement for the Retro reference implementations.

Please visit http://forthworks.com/retro/ to get you started about the Retro language and the Ngaro Virtual Machine.

The main purpose of this implementation is to allow customization and communication between Retro programs and Go programs via custom I/O handlers (i.e. scripting Go programs in Retro) as well as supporting custom opcodes at the VM level. The package examples demonstrate various use cases. For more details on I/O handling in the Ngaro VM, please refer to http://retroforth.org/docs/The_Ngaro_Virtual_Machine.html.

This implementation passes all tests from the retro-language test suite and its performance when running tests/core.rx is slightly better than with the reference implementations:

1.20s for this implementation, compiled with Go 1.7rc6.
1.30s for the reference Go implementation, compiled with Go 1.7rc6
2.22s for the reference C implementation, compiled with gcc-5.4 -O3 -fomit-frame-pointer

For all intents and purposes, the VM behaves according to the specification. With one exception: if you implement custom opcodes, be aware that for performance reasons, the PC (aka. Instruction Pointer) is not incremented in a single place; rather each opcode deals with the PC as needed. Users of custom opcodes will need to take care of updating the PC accordingly. This should be of no concern to other users, even with custom I/O handlers. Should you find that the VM does not behave according to the spec, please file a bug report.

Directories

Path Synopsis
Package asm provides utility functions to assemble and disassemble Ngaro VM code.
Package asm provides utility functions to assemble and disassemble Ngaro VM code.
cmd
Package vm provides an Ngaro Virtual Machine implementation.
Package vm provides an Ngaro Virtual Machine implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL