[antlr-interest] grammars with AST support

Stuart Watt SWatt at infobal.com
Wed Feb 6 12:48:05 PST 2008


Hi Peter
 
ASTs are conceptual structures rather than texts, so they don't have that
kind of a grammar (except for tree parsing, and most of the grammars can
generate ASTs like these already). So that would be one solution, use tree
parsers and connect them to the existing ones. 
 
I don't think it is common to parse ANTLRs default (slightly Lisp-style) AST
text representations, because they don't want to write it and read it again,
as you do lose information when you do that. Having said that, the closest
may be the GraphViz dot grammar (see DOTTreeGenerator in the runtime).
 
It is easiest to write ASTs out in a well-defined structure (e.g., dot, XML)
and then parsing is easy. Extensibility (e.g., XML) allows your different
languages to add in extra information if needed, without requiring changes
to processing. 
 
--S

-----Original Message-----
From: Peter Bulychev [mailto:peter.bulychev at gmail.com]
Sent: Wednesday, February 06, 2008 3:22 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] grammars with AST support


Hello.

I perform research on static analysis and my tool takes on input AST
representation of programs. 
I want to use ANTRL to produce ASTs for different programming languages (C,
C++, C#, Java, Python, ...). 
Where can I get grammars which can produce AST?

I have searched http://www.antlr.org/grammar/list
<http://www.antlr.org/grammar/list> , but there are no AST-featured
grammars, which supports this ability.

-- 
Best regards,
   Peter Bulychev. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080206/97577cea/attachment.html 


More information about the antlr-interest mailing list