Using ANTLR Grammars¶
The resulting grammar won’t be immediately usable. It will have to be edited to make it abide to PEG semantics, and in general be adapted to the way things are done with 竜 TatSu.
g2e as a module, invoke one of its translation functions.
def translate(text=None, filename=None, name=None, encoding='utf-8', trace=False):
from tatsu import g2e tatsu_grammar = translate(filename='mygrammar.g', name='My') with open('my.ebnf') as f: f.write(tatsu_grammar)
g2e can also be used from the command line:
$ python -m tatsu.g2e mygrammar.g > my.ebnf