how print parse-tree using python2 runtime with antlr4

前端 未结 2 1892
盖世英雄少女心
盖世英雄少女心 2021-01-13 11:41

I\'m trying to use antlr4 version 4.4 and the python2 runtime. The grammar is from the antlr4 book, page 6, file: Hello.g4:

grammar Hello;                   


        
2条回答
  •  情书的邮戳
    2021-01-13 12:02

    It looks like you took the wrong toStringStree function.

    Take a look at the java docs.

    This explains the error message "object does not support indexing". The function you chose expects a list of rule names and not the parser.

提交回复
热议问题