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

mzukowski at yci.com mzukowski at yci.com
Thu Apr 3 13:06:23 PST 2003


See www.codetransform.com/gcc.html.  It builds an AST, preserves line & col,
has a symbol table, handles ANSI C & GCC extensions to C.  It's a complete
source to source transformation toolkit.  I'd love to hear what you end up
doing with it!

Monty

-----Original Message-----
From: shivatk [mailto:shivatk at yahoo.co.uk]
Sent: Thursday, April 03, 2003 11:10 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Can I use ANTLR to build a tree from C code


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/ 


 

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




More information about the antlr-interest mailing list