I have generated Model code and parser from my Grammar but I can't modify model to generated code in python. My EBNF grammar is a script code like "C" syntax for translate file in XML or ANSI X12. It's a language specific and I would like to generate Python code from this script with Tatsu. I parse script but I can't success to use Parser or Model to generated Python source code.... Where i must to save Model or modify parser to generated python code ... I see tools.py ... can I copy the code to build a new code model... Can you help me ... I start learn python and i must to implement this solution on web site with upload script and download python code.
Asked
Active
Viewed 121 times
1 Answers
0
TatSu is a parser generator. I doesn't have any provisions for generating running code from text parsed by an arbitrary grammar.
You have to write your own code generator (walk thes AST after a parse, and generate the corresponding code).

Apalala
- 9,017
- 3
- 30
- 48
-
Thanks, but with ANTLR , the code generate the call JAVA and you can overwrite function for build output file (example code python...). the Tatsu Codegen/python.py can do that for a grammar ? i will do the same think with mys code "C" and grammar for writing my python code ... It's possible .. like python.py script ? – DAVID VINCENT May 05 '21 at 18:15