简体   繁体   中英

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:

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

Remove the k option. 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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