Hi there,

total clang/llvm n00b here. I'm building a multilingual static analysis
tool which has parsers for individual languages export an appropriately
tagged language-agnostic AST for a single analyser binary to process. So
far I've been using native parsers for Ruby and Go and ANTLR
<http://www.antlr.org/>-based one for Swift.

ANTLR in particular won my heart because of it's Listener API
<http://www.antlr.org/api/Java/org/antlr/v4/runtime/tree/ParseTreeListener.html>
where
3 generic methods are provided:

void enterEveryRule(ParserRuleContext ctx)
void exitEveryRule(ParserRuleContext ctx)
void visitTerminal(TerminalNode node)

You can also subscribe to 'enter' and 'exit' events for particular rules
that you find particularly interesting. So for a given rule you'd have four
callbacks triggered - enterEveryRule, enterParticularRule,
exitParticularRule, exitEveryRule - in this particular order. There is also
concept of TerminalNodes which are things like literals etc.

Since this sort an API what feels most natural for the task at hand I would
kindly like to solicit your advice on how to go about replicating it in
clang.

Thanks in advance!

Best,
Marcin Wyszynski

*-- Everyone you meet is fighting a battle you know nothing about. Be kind.*
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to