简体   繁体   English

将ANTLR 3语法转换为ANTLR 4时如何删除“ k”选项

[英]How to remove 'k' option when converting ANTLR 3 grammar to ANTLR 4

The token lookahead option is gone in ANTLR 4, so ... This is the ANTLR 3 code: ANTLR 4中没有令牌先行选项,因此...这是ANTLR 3代码:

declarations: // Order is important here.
    ( options { k = 3; }: DECLARE_SYMBOL identifier (variable_declaration | condition_declaration))*
        cursor_declaration* handler_declaration*
;

Remove the k option. 删除k选项。 It was used to tell the parser generator the necessary lookahead. 它用于告知解析器生成器必要的前瞻。 The new ALL(*) algorithm in ANTLR4 doesn't require this setting anymore as it can dynamically use any required lookahead (in theory even unlimited). ANTLR4中新的ALL(*)算法不再需要此设置,因为它可以动态使用任何所需的先行(理论上甚至是无限的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM