Liang Ng <
lsn...@gmail.com> writes:
> compile Forth words to native code... Is there commercial
> implementation for this, or someone's pet project?
Sure there are tons of Forth compilers.
> (2) By my own survey, the interpreters of Python, Java, JavaScript,
> Ruby, PHP are all stack machines. This pretty much cover the majority
> of popular programming languages today.
But it's an implementation detail. Lua uses a register VM which shows
that approach works as well.
> If we are to standardize Forth bytecode, why not create a mechanism to
> standardizing opcodes amongst stack machines of these high level
> languages -- a Universal Stack Machine (USM)???
To some extent the Java VM (JVM) is used as the backend for a lot of
different languages like Scala, Clojure, Jython, and even some Forths.
The Microsoft CLR is another example.
These are all relatively heavyweight, not anything like traditional
Forth, which is close to the machine and minimalistic.
Forth historically brought a lot of powerful features together
(interactive development, integrated editing, multitasking, etc.) on
very limited hardware, by sacrificing various conveniences like files
(use blocks instead), automatic memory management (your hardware control
program won't need it), and infix notation (use explicit stacks).
Today though, Forth's explicit stack is like Lisp's parentheses, a
historically grounded implementation hack that people can learn to love,
but it isn't something to get excited about in its own right. With
fewer hardware constraints you can make the programmer's life easier by
getting rid of those sacrifices. Once you start using the
implementation techniques of Python or Javascript, you might as well
also use their syntax.
So I think Forth is still most interesting in something like its
original context: simple, low-level, mostly-traditional-style
implementations. It's amazing how cleverly the parts all fit together.