[antlr-interest] New to Abstract syntax trees

Sharon Li hushlee83 at yahoo.com.sg
Thu Mar 6 15:53:02 PST 2003


hello all,

I'm using java and I'm trying to build Antlr grammar to recognize expressions like :
e.g.  8*4-LEN/(WIDTH+1)
or a while expression while(expr) where the expr can be : LEN+1<=5

I do not need to evaluate the expression as I am reading the input but would like to put the expression into a data structure from which I can retrieve each token for evaluating later on. An example would be an Expression object where i will keep an array of tokens read and variable names like LEN and WIDTH will be kept in a symbol table. I've looked at the Antlr grammar for C and found it relevant to what I will be needing. Would anybody recommend me using a Abstract Syntax Tree? I'm very new to AST and would like some advice on that. What does it actually generate and would form would the data generated be in?

Thanks in advance for any help.

Cheers,
Sharon 

 Yahoo! Biztools
- Promote your business from just $5 a month!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20030307/45cffd68/attachment.html


More information about the antlr-interest mailing list