[antlr-interest] The idea of semantic analyzer generator

Andreas Meyer andreas.meyer at smartshift.de
Tue Nov 10 13:13:40 PST 2009


John B. Brodie schrieb:
> Greetings!
> On Tue, 2009-11-10 at 23:27 +0300, GreyAx wrote:
>   
>> I'm looking for topics to investigate in part of my master thesis. I'm interesting in verification, 
>> static code analysis and so on. I have an idea, which I want to implement and integrate with ANTLR,
>> please give me any feedback about it.
>>
>> I'd started work with ANTLR till some time ago and my colleagues use it sometimes (to create DSL).
>> And as I see, there is some unsolved problems in ANTLR. And IMHO the one of the most important is 
>> that user have to write semantic analyzer by hand (of course he or she could and should use tree
>> grammars for doing it and could implement custom actions for checking some semantic rules, but in
>> fact the semantic within such approach is only a code written in some ordinary programming
>> language (C\C#\Java\...).  I wonder would it be useful for user to use semantic analyzer generation
>> module within ANLTR? I think it could be implemented as a new grammar language for describing
>> semantic rules or something like that. Could somebody point out to such things? Are there any
>> semantic analyzer generators? And if there isn't any, is such thing looks not very useful for
>> practical using?
>>
>>     

For example, there is jastadd (jastadd.org), which is a generator for 
attribute grammars. I have not used it (yet!), but it seems useful 
enough to build a Java 1.5 compiler with it. Still, there is a slight 
gap between the ANTLR grammar and the jastadd tree grammar, which uses 
its own notation. So, you would need to explicitly build an AST, 
suitable for jastadd: you cannot reuse ANTLRs tree building facility. 
Maybe bridging that gap could be an interesting topic? FYI : currently 
I'm writing a tree parser generator that operates on an already built 
ANTLR tree, which could be useful to bridge this gap (in constrast to 
the ANTLR tree parser, which works on a stream of tokens for the full 
tree, actually). Let me know if you are interested.

Cheers,
Andreas Meyer


More information about the antlr-interest mailing list