Hi everyone,

I am happy to announce gomacro, yet another Go interpreter: 
https://github.com/cosmos72/gomacro

I started it as an experiment to play with Go, and to try adding Lisp-like 
macros,
i.e. compile-time execution of arbitrary user code (extremely handy for 
code generation).

It turned into a fairly complete Go interpreter, implemented in pure Go, 
built on top of the go/ast and reflect packages.

Basic features:
* REPL with multiline input (no history/readline yet)
* all primitive types, including interface{}
* expressions and statements
* declaring functions, variables and constants
* declaring, creating and accessing pointers, slices, arrays, maps, channels
* all Go builtins - see https://golang.org/pkg/builtin/

Some more advanced features:
* imports - Go standard packages "just work". For the others, gomacro 
compiles and loads a plugin - Go 1.8 currently supports them only on Linux
* defer, panic and recover (implementing recover was definitely non-trivial)
* composite literals
* function literals (i.e. closures)
* declaring new struct types (currently only public fields, and no methods 
yet)
* REPL command :env <package> to show the functions, variables, constants 
and types exported by a package (you need to import it first)
* REPL command :inspect <expression> to interactively drill down structs 
and slices
* builtin functions Parse and Eval: Parse converts a string into an 
ast.Node, Eval evaluates it.
* macro and related facilities: quote, quasiquote, unquote, unquote_splice, 
MacroExpand, MacroExpand1, macroexpansion code-walker

As stated on the github project, some things are still missing:
* REPL history/readline
* declaring variadic functions
* for-range on channels
* switch, fallthrough, type switch, select, labeled statements
* goto (difficult)
* the keyword "go" (introduces tons of races... requires switching the 
interpreter to thread-safe maps)
* declaring interfaces (difficult)
* declaring methods (difficult)
* REPL command to switch to a different package

volunteers are welcome :)

--
Max


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to