cardinal-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Cardinal-dev] Compiler structure / AST format


From: Phil Tomson
Subject: Re: [Cardinal-dev] Compiler structure / AST format
Date: Wed, 24 Apr 2002 17:39:58 -0700

On Sunday 21 April 2002 23:19, Einar Karttunen wrote:
> Hello
>
> One of the first things we have to agree is a structure of the
> compiler. The compiler should be modular and imho written in
> Ruby. 

That would be good, but see my previous post on Ruth in the archive.  It uses 
The current Ruby parser (the C/lex/yacc version that comes with the current 
Ruby) for compatibility with the current version of Ruby.  It seems to me 
that if we start from scratch (or even if we start with some of the 
Ruby-in-Ruby parsers already available - like the one in RDoc for example) 
thta it's going to take quite a lot of our time just to make it compatible 
with the current incarnation of Ruby.  Ruth, it would seem, would make it 
easier to chase a moving target.  (that said, though, there are indeed some 
big advantages to having a Ruby parser written completely in Ruby).

> Also we should make the addition of multiple backends
> possible later.
>
This would be nice.

> One possible and traditional structure would be like:
> Lexer - I think this should be quite easy
> Parser - should produse an AST used in the next stages
> AST optimiser passes - can be added here later
> Frontend translate AST into intermediate code
> Optimiser pass - can be implemented later
> Backend - translate the intermediate presentation into parrot code

The intermediate would make it eaiser to 'bolt-on' other VMs or to compile 
the intermediate to native code (like what is done in .NET and it's clr).

>
> We have also to agree on the AST (=abstract syntax tree) format.
> Currently ruby uses a format with very many node types (see node.h)
> which may be suboptimal.

Do you have any suggestions for a different way of organizing the AST?

Phil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]