> Nicolas,
> 
> I have read the Neko language specs. and what I want to know is this...
> what would be involved for me to be able to compile neko code into a
> running image in the same way that I can do with Smalltalk or LISP for
> example.
> 
> Presumably the code generation part of nekoc would need to be glued
> together with the vm or something along those lines ie to be able to
> parse text, generate ast's etc and then generate actual VM byte codes
> from that assuming no errors along the way.  All of this exists in some
> form or other but in two parts: nekoc and neko.   If nekoc was written
> in neko (is it???) then this would make it easier!

The Nekoc compiler is written in NekoML. The NekoML compiler is written
in NekoML as well, and there is the NekoML compiler can translate a
NekoML program to the corresponding Neko one.

So you have :

NekoML --(nml compiler)--> Neko --(nekoc)--> Bytecode

Since a compiled NekoML module is similar to a compiled Neko one, you
could dynamicly load the Nekoc modules, build either a Neko or NXML
representation of your Lisp program, then directly pass it to the Nekoc
compiler to get back a string representing the bytecode. This string can
then be loaded directly into the VM.

For an example on how to do this in NekoML, see the Neko Console (in
src/neko/Console.nml). You can use it by simply running

nekoc -console

the input some Neko program and end your line with ! to execute it.
Globals are saved and restored between each compilation/interpretation.

Enjoy,

Nicolas

-- 
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to