Closed philipmiesbauer closed 1 year ago
The Lexer and Parser were generated with the command
antlr4 -Dlanguage=Python3 grammars/*.g4
with antlr4 version 4.13.0
Fault was on my side.
My imports should have been
import sys
from antlr4 import *
from grammars.Protobuf3Parser import Protobuf3Parser
from grammars.Protobuf3Lexer import Protobuf3Lexer
def main(argv):
input_stream = FileStream(argv[1])
lexer = Protobuf3Lexer(input_stream)
stream = CommonTokenStream(lexer)
parser = Protobuf3Parser(stream)
tree = parser.startRule()
if __name__ == '__main__':
main(sys.argv)
The parse_json.py file uses only a custom version of the offical antlr documetnio demo for python3
Originally posted by @philipmiesbauer in https://github.com/antlr/antlr4/issues/4213#issuecomment-1567091592