On Mon, 2006-08-07 at 00:49 +0900, M. Edward (Ed) Borasky wrote:
> Whatever you opinions about any programming language are, Ruby is
> implemented in C at the moment, so C at least has *that* going for it!
Java's VM is written in C too, is it not?
MTASC, a rather good open-source ActionScript compiler, is written in
OCaml... as is haXe, I think.
C is kind of an obvious choice for interpreters/compilers because of the
availability of Lex and Yacc (and/or flex and Bison), I suppose.
Hmmm... I had rather thought that functional-style languages were more
common for writing language interpreters/compilers in. Aren't Lisp guys
always on about using Lisp to write another language more specific to
the problem domain, and working from there?
In the Programming Languages course I took at UNI we developed an
interpreter for a simple language in Scheme... the professor I took that
course with just e-mailed me a Joy interpreter he wrote, also in Scheme,
that I had expressed interest in. In another course I took with another
prof, we used a Mumps compiler he had written in C++; actually it
translated Mumps to C++ and compiled that with gcc.
I think gForth is written in C, but there are faster Forth environments
out there; I wonder what they used. I'm pretty sure a lot of Forth
environments are started in assembler.
Anyway I'm rambling, just because this is a fun topic.
I'd learned that it was common to develop a minimal subset of a new
language in another language, then use that small version of the
language to write the rest. The Lisp environments I've used certainly
appear to have been implemented in this way, and Forth is explicitly so.
There definitely seem to be some very low-level functions in Ruby that
seem to be mainly used by more advanced Rubyists, usually for
metaprogramming-like things. Stuff like instance_eval. Am I on-track
in having the impression that Ruby is designed that way? Just curious.
--ch--