1

I've just started playing with TatSu and don't have much experience with it yet. I'm successfully parsing a small COBOL code snippet, but would like to access the details that are produced when parserinfo=True. Would anyone have some sample code I can use for this? Here's my code. Thank you in advance.

from tatsu import parse, compile

cobbnf_file = open("cobfd.bnf", "r") cobbnf = cobbnf_file.read()

cobtest_file = open("test.cob", "r") cobtest = cobtest_file.read()

model = compile(cobbnf, "cobol") ast = model.parse(cobtest, parseinfo=True, trace=False)

print(ast)

dreamer
  • 11
  • 1
  • Please format the Python code? It would be good if you also included the grammar and the current output. – Apalala Jun 23 '22 at 13:28

0 Answers0