Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: cleaned up formatting and added references to grammar options page

k

                              

backtrack

option

description

Code Block

specify Specify the exact lookahead to be used by the subrule

noformat

.

greedy

Valid values are true and false. Default is true. Normally symbols are matched greedily so that if a symbol can be matched immediately or by exiting the subrule the parser chooses to match the symbol immediately. The default is greedy=true

No Format

taken from http://www.antlr.org:8080/pipermail/antlr-interest/2006-July/016818.html : The new feature (a big one) is the backtrack=true option for grammar, rule, block that let's you type in any old crap and ANTLR will backtrack if it can't figure out what you meant. No errors are reported by antlr during analysis. It implicitly adds a syn pred in front of every production, using them only if static grammar LL( * ) analysis fails. Syn pred code is not generated if the pred is not used in a decision. This is essentially a rapid prototyping mode. It is what I have used on the java.g. Oh, it doesn't memoize partial parses (i.e., rule parsing results) during backtracking automatically now. You must also say memoize=true. Can make a HUGE difference to turn on.

No Format
memoize

When backtracking, remember whether or not rule references succeed so that the same input position cannot be parsed more than once by the same rule. This effectively guarantees linear parsing when backtracking at the cost of more memory Rule-specific version of the backtrack grammar option. See Grammar options for details.

memoize

Rule-specific version of the memoize grammar option. See Grammar options for details.