[antlr-interest] postmortem

Darien Hager darien.hager at etelos-inc.com
Thu Mar 13 10:47:10 PDT 2008


On 3/13/08, Gavin Lambert <antlr at mirality.co.nz> wrote:
>
> I had a fairly trivial DSL to parse and I wanted to throw it into a
> codegen routine afterwards.  I noticed that there was this "AST" option that
> said it would output a tree, which I thought would be useful.  So I switched
> it on, and was puzzled that I didn't get a tree out of it.  (I was basically
> expecting that by default every time I called a subrule it would drop a
> level down in the tree.)
>

I had the same experience. However, the architectual impliciations
behind action code creeped me out even more, so I kept looking :P


> However I can see the other side of this too.  If ANTLR did default to
> dropping a tree level for each subrule call, how would you go ahout telling
> it to not do that?
>

Could this be a tool-level solution? Parse the grammar
file, and automatically insert basic AST-rewrite rules to achieve the
same effect? The benefit of this is that it involves no additional
magic on ANTLR's part, and would be easier to customize if it turns
out that the grammar rules are best arranged in one way but the AST is best
arranged in another.


-- 
Darien Hager
Developer
Etelos, Inc.
darien at etelos.com

http://www.etelos.com
"Revolutionizing the way applications are developed, distributed and
consumed."

This e-mail message, including attachments, may contain confidential
information for the sole use of the intended recipient(s). If you are not
the intended recipient, then this is notice that any use, disclosure,
dissemination, distribution or copying is strictly prohibited. If you have
received this message in error please contact the sender by reply mail and
destroy all copies of the original message.

This e-mail message, including attachments, may contain confidential information 
for the sole use of the intended recipient(s). If you are not the intended recipient,
then this is notice that any use, disclosure, dissemination, distribution or copying is 
strictly prohibited.  If you have received this message in error please contact the 
sender by reply mail and destroy all copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080313/eaee5fc3/attachment.html 


More information about the antlr-interest mailing list