Re: Forming an AST node for a sequence or list

Jeff Lasslett <jlasslett@optusnet.com.au>
14 Jun 2004 17:47:39 -0400

          From comp.compilers

Related articles
Forming an AST node for a sequence or list jeff.lasslett@datataker.com.au (2004-06-09)
Re: Forming an AST node for a sequence or list rbates@southwind.net (Rodney M. Bates) (2004-06-12)
Re: Forming an AST node for a sequence or list TommyAtNumba-Tu.Com--not@yahoo.com (Tommy Thorn) (2004-06-14)
Re: Forming an AST node for a sequence or list jlasslett@optusnet.com.au (Jeff Lasslett) (2004-06-14)
Re: Forming an AST node for a sequence or list haberg@matematik.su.se (Hans Aberg) (2004-06-15)
| List of all articles for this month |
From: Jeff Lasslett <jlasslett@optusnet.com.au>
Newsgroups: comp.compilers
Date: 14 Jun 2004 17:47:39 -0400
Organization: Compilers Central
References: 04-06-033 04-06-050
Keywords: parse, analysis
Posted-Date: 14 Jun 2004 17:47:39 EDT

Rodney M. Bates wrote:
> Jeff Lasslett wrote:
>
>>Greetings,
>> I have a couple of grammar elements of the following form:
>>
>>A -> Ab | b ( or in yacc form A : A "b" | "b"; )
>>
>>I am planning to form strings matched by this type of rule into AST
>>nodes that look like this (given the input string "bbb"):-
>>
>> A
>> /|\
>> b b b
>>
>
>
> One traditional way is to represent the list node using the
> binary-tree-representation-of-n-ary-tree technique, i.e. the above
> example is physically linked as:
>
> A
> /
> b-b-b


Thanks Rodney. This is exactly what I've done. It works beautifully.
My parser now builds a syntax tree. Now I have to decorate it with type
information and think about generating some code.


Cheers,
Jeff


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.