Gisp: A Lisp that compiles to Go
github.com
github.com
https://github.com/akavel/goluago
I think if I wanted to implement a native Lisp interpreter/ bytecode compiler for Go, I would build on top of this project rather than starting from scratch.
"Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp."
Since the quote is from 1993, you just need to replace C and Fortran by the languages of the day.
the perfect zen...
Define a proper interface between ASTs and code generation and retarding the compiler is also not that complicated.
Or generate LLVM bitcode and use the LLVM tools to compile it to native.
Way better than relying in other compiler stacks.
Of course, it is a matter how deep one wants to get into compiler stuff.
I guess targeting assembly is way harder, you must deal with register allocation and other scary-sounding topics.
Ooops, a typo.
> I guess targeting assembly is way harder, you must deal with register allocation and other scary-sounding topics.
Not necessarily, if you are ok with just getting something to run.
You can pre-define a set of generation templates for each AST node, no need for register allocation.
[1] http://golang.org/pkg/go/ast/ [2] http://golang.org/pkg/go/printer/
Other than that, this looks like a lot of fun :-)
http://www.oki-osk.jp/esc/golang/lisp.html
On another note, there is Chicken Scheme, which compiles to C and produces executable files. Nice stuff!
www.call-cc.org/