dotgnu-general
[Top][All Lists]
Advanced

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

Re: [DotGNU]Licence question about GNU and GCC


From: Rhys Weatherley
Subject: Re: [DotGNU]Licence question about GNU and GCC
Date: Tue, 12 Mar 2002 20:02:52 +1000

James Michael DuPont wrote:

> So, lets start by comparing the AST, can you point me
> to where they are created in the c# compiler?

In pnet's C# compiler, the parse grammar calls functions
like "ILNode_Add_create", "ILNode_While_create" to
build the AST nodes.  These functions are in turn generated
from rules in the Treecc input file "codegen/cg_nodes.tc".
Look for "%node" declarations.

The AST is a plain ordinary tree, constructed to follow the
language syntax reasonably closely.  Operations are
declared in other "*.tc" files for semantic analysis and
code generation.  Look for "%operation" declarations.

During semantic analysis, the tree structure may be
altered.  e.g. "x[y]" works on arrays and objects with
indexers.  The parser doesn't know which so it creates
an array access node.  When semantic analysis discovers
that "x" is really an indexed object type, it replaces the
node with a different one for the code generator to use.

This is about the extent of the "tree rewriting" that
happens at the moment.  I've been thinking of adding
more complicated rewrite systems, but haven't yet
figured out the correct "style" to use to make it work
well with the rest of Treecc.

Cheers,

Rhys.




reply via email to

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