M. Edward (Ed) Borasky
3/2/2008 8:09:00 PM
Le Lann Jean-Christophe wrote:
> Hi,
>
> For some days now, I have been trying to find the best Ruby tools to
> develop compilers : lexer, parser and possibly more (ast, visitor).
>
> There seems to be plenty of small tools, but it is difficult to know
> whether they are mature or not.
>
> So I would like to have feeback on your own experience in this field.
>
> Thanks
> JC
>
>
>
It depends more on the scope of the compiler(s), languages, operating
systems where the compilers will run, etc., then it does on the "tools".
If you're looking for a highly portable compiler for a variety of
architectures and operating systems, for example, you're probably better
off building a front end for the languages to the GCC intermediate and
code generation pieces. And if you're building a compiler for a language
already handled by GCC, the best advice I can give you is, "don't bother".
That said, the Ruby *parser* that seems to have the best user interface
is Treetop. I've only done a couple of small things in it, but it's a
lot easier to read Treetop code than it is to read, say, racc.