[Haskell-cafe] G machine in FORTH

Krasimir Angelov kr.angelov at gmail.com
Wed Jun 1 17:42:15 EDT 2005

Actually I am very impressed from the FORTH simplicity and efficiency.
I was developing one FORTH system for DOS a couple of years ago and I
think it is very useful for small programs that have to perform low
level/hardware tasks. Unfortunatelly it doesn't scale well for larger
applications. I don't know how well it can be used as G-machine
interpreter but its execution model has a lot of common with STG
machine. In STG each closure has a header word which is a pointer to
its entry code. In FORTH each procedure has a header word which also
points to some entry code. The entry code receives the address of the
entered procedure in special (usually EBX on x86) register just like
in STG (where the used register is ESI). The execution of any FORTH
program is a sequence of jumps from one entry code to another just
like in STG. Of course STG is much more complicated because the
closures are dynamically allocated and there is a garbage collector
too. Thanks to its simple execution model I still think that FORTH is
the fastest interpreted language, just like STG is the fastest virtual
machine for Haskell.


On 6/1/05, Andrew Harris <andrew.unit at gmail.com> wrote:
> Hi -
>   Brace yourself... I work in an environment where FORTH is still used.
>   I've been thinking about writing a G-machine interpreter in FORTH
> so that one could write Haskell like programs that would compile down
> and run "graph-reduction" style on the FORTH machine.
>   Many developers think FORTH is nice, but the language is so, shall
> we say, "terse".
>   I'm curious about what people think about this; having the
> expressiveness of a Haskell-like language that compiles to this
> environment might provide the best of both worlds, simple hardware
> architecture and an advanced programming language.
> let me know what you think,
> -andrew
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list