ANTLR的一些错误解决方案
antlr书写和编译的典型错误:
错误1:
错误出现在
KW_VALUES LPAREN valueList=(stringOrNumOrFuncList) RPAREN
去掉括号,改为:
valueList=stringOrNumOrFuncList
错误2:
”reference to rewrite element tableSubPartition without reference on left of ->“
通常这个错误的伴随Decision can match input such as "..." using multiple alternatives错误出现
解决方法:
错误的原因是不服和LL文法定义,特别是歧义的片段定义副本有如identity等变量定义,让状态机产生歧义,解决方法是将相同的部分提取出来,分层定义即可。