【问题标题】:How would I normalize the following ANTLR grammar rules to eliminate left recursion?我将如何规范化以下 ANTLR 语法规则以消除左递归?
【发布时间】:2013-04-14 19:17:07
【问题描述】:

我希望能够治疗:

int(int, int)

作为函数类型。如何规范这个(精简的)语法?

type : classOrInterfaceType | primitiveType | functionType;
functionType : type '(' (type (',' type)*)? ')';

classOrInterfaceType : ;
primitiveType : ;

【问题讨论】:

    标签: grammar ebnf


    【解决方案1】:

    有一种消除左递归的算法。 http://web.cs.wpi.edu/~kal/PLT/PLT4.1.2.html

    【讨论】:

      猜你喜欢
      • 2019-02-26
      • 2013-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多