jeudi 22 mai 2014

syntaxe - création d'un AST C dans ANTLR - Stack Overflow


I searched plenty of sources but havent found anything yet. I'm trying to create an AST (in Java) for a input file written in C. I found ANTLR and it works with the "official" C-Grammar from the ANTLR examples. Nevertheless, I read about editing grammar for the syntax-tree with e.g. "^" to mark roots etc.


When I set the output at the C.g to output=AST an empty graph is printed (some dot gibberish). Also I can't find any of that mentioned tree symbols in the grammar.


So I need to asume, that grammar doesn't support AST-generation.


Is there any working C grammar that has syntax for a AST in it? I need to find a solution in a proper time, and I wanted to check all available ressources bevor starting to edit the given grammar (what I guess will be an awful lot of work).


Thanks for you time,


Simon



I searched plenty of sources but havent found anything yet. I'm trying to create an AST (in Java) for a input file written in C. I found ANTLR and it works with the "official" C-Grammar from the ANTLR examples. Nevertheless, I read about editing grammar for the syntax-tree with e.g. "^" to mark roots etc.


When I set the output at the C.g to output=AST an empty graph is printed (some dot gibberish). Also I can't find any of that mentioned tree symbols in the grammar.


So I need to asume, that grammar doesn't support AST-generation.


Is there any working C grammar that has syntax for a AST in it? I need to find a solution in a proper time, and I wanted to check all available ressources bevor starting to edit the given grammar (what I guess will be an awful lot of work).


Thanks for you time,


Simon


0 commentaires:

Enregistrer un commentaire