antlr3.5.1(最新的3.x版本)和pythonruntime 3.1.3(只提供Python运行时)

2024-06-01 05:29:53 发布

您现在位置:Python中文网/ 问答频道 /正文

看起来3.5.1是最新的3.x版本,而3.1.3是唯一可用的版本(http://www.antlr.org/download/Python/)。但是,当我尝试使用示例运行解析器时,我收到了一个抱怨:我的运行时版本与我的ANTLR版本不兼容:

$ PYTHONPATH=/home/dustin/build/antlr3/antlr_python_runtime-3.1.3 python SimpleCalcParser.py /tmp/lang 
Traceback (most recent call last):
  File "SimpleCalcParser.py", line 231, in <module>
    main(sys.argv)
  File "SimpleCalcParser.py", line 220, in main
    lexer = SimpleCalcLexer(char_stream)
  File "/home/dustin/development/antlr/antlr3/hello_world_python/SimpleCalcLexer.py", line 31, in __init__
    super(SimpleCalcLexer, self).__init__(input, state)
  File "/home/dustin/build/antlr3/antlr_python_runtime-3.1.3/antlr3/recognizers.py", line 1072, in __init__
    BaseRecognizer.__init__(self, state)
  File "/home/dustin/build/antlr3/antlr_python_runtime-3.1.3/antlr3/recognizers.py", line 184, in __init__
    self.antlr_version_str))
RuntimeError: ANTLR version mismatch: The recognizer has been generated by V3.0.1, but this runtime is V3.1.3. Please use the V3.0.1 runtime.

有人能帮我找到正确的路吗?由于可供下载的版本太少,我似乎无能为力。在


Tags: inpybuildself版本homeinitline