[antlr-interest] Can I use ANTLR to build a tree from C code

Terence Parr parrt at jguru.com
Thu Apr 3 12:00:38 PST 2003


Sure.  You can easily parse C and build an AST out of it.  The 
generated parser can be C#, C++, of Java.  I have just completed symbol 
table lectures at USF (audio to appear soon):

http://www.cs.usfca.edu/~parrt/course/652/index.html

Terence

On Thursday, April 3, 2003, at 11:09  AM, shivatk wrote:

> Hi all,
>
>  My name is Shiva. I have joined the group today. I have been working
> on 'Program Analysis', 'Reverse Engineering', 'Migration and
> restructuring tools' and similar language processing stuffs for the
> last 4 years. In all the areas the initial step is the same - build a
> tree from the source code. So, whether the code is in C, or in C++,
> or in COBOL we build the tree first. To do this we use 'yacc' based
> parser and our own internal tool to build the AST. Most of the
> actions in the parser are written to build the tree and capture other
> informations like line number, line pos, filename etc.
>
>  With regards to this I have a question to post.
>
>  Can I use ANTLR to do the same? I mean, can I use ANTLR to parse and
> build an AST out of C code? Will I be able to capture the line num,
> column position inormation in the tree nodes? And, will I be able to
> create associations between a tree node for a variable to its
> declaration in the symbol table?
>
>  Hoping for an early reply from the group.
>
> Shiva
>
>
>
>
>
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/
>
>
>
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Lecturer in Comp. Sci., University of San Francisco


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list