Use Generator CodeGen in Tatsu

144 views Asked by At

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.

1

There are 1 answers

1
Apalala On

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).