GCC Parse Tree/Grammar Issues

Foolish Ewe foolishewe@hotmail.com
Mon Apr 14 16:35:00 GMT 2003


Hello All:

I'm sorry if these issues are well explained elsewhere, but a quick web 
search and
mailing list search didn't turn up the answers I was looking for.  I'm 
trying to do some
pattern analysis of parse trees as part of my research and was hoping to use 
GCC
parse trees for the job, rather than say RTL.

I have written a simple tool that generates parse trees (not AST's
for the grammar at the end of the K&R book 2nd edition).  However, when I 
went to
extend this tool to handle gcc, I realized that I didn't have a document 
describing
the gcc grammar.   I've resorted to a little source diving (in the 3.2.2 
version), and have
the following questions/requests:
1) Is there any documentation for the grammar not in compiler source code 
format?
    (If not, perhaps it would be nice to update the compiler docs to reflect 
the grammar).
2) Am I correct that gcc uses an ad hoc scanner, I did not see a file wiith 
a .l extension
    in the directory and it looks like c-lex.c may be the scanner?  If I'm 
correct, is there
    any documentation on the scanner grammar/syntax?  Also, why is an ad hoc 
scanner
    employed instead of a flex generated scanner (if that is indeed the 
case)?
3) Can I get gcc to dump its parse tree (or AST) without hacking it?  If so, 
what is the
     format of the dump?  Is tree-dump.c the right module to look at?

Please respond to the list, I'll read it using the web interface (I'm not a 
subscriber, yet).

Thanks:

Bill M. (Name withheld to prevent spam)

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail



More information about the Gcc mailing list