01: package antlr;
02:
03: /* ANTLR Translator Generator
04: * Project led by Terence Parr at http://www.cs.usfca.edu
05: * Software rights: http://www.antlr.org/license.html
06: */
07:
08: /**A GrammarAnalyzer computes lookahead from Grammar (which contains
09: * a grammar symbol table) and can then answer questions about the
10: * grammar.
11: *
12: * To access the RuleBlock for a rule name, the grammar symbol table
13: * is consulted.
14: *
15: * There should be no distinction between static & dynamic analysis.
16: * In other words, some of the easy analysis can be done statically
17: * and then the part that is hard statically can be deferred to
18: * parse-time. Interestingly, computing LL(k) for k>1 lookahead
19: * statically is O(|T|^k) where T is the grammar vocabulary, but,
20: * is O(k) at run-time (ignoring the large constant associated with
21: * the size of the grammar). In English, the difference can be
22: * described as "find the set of all possible k-sequences of input"
23: * versus "does this specific k-sequence match?".
24: */
25: public interface GrammarAnalyzer {
26: /**The epsilon token type is an imaginary type used
27: * during analysis. It indicates an incomplete look() computation.
28: * Must be kept consistent with Token constants to be between
29: * MIN_USER_TYPE and INVALID_TYPE.
30: */
31: // public static final int EPSILON_TYPE = 2;
32: public static final int NONDETERMINISTIC = Integer.MAX_VALUE; // lookahead depth
33: public static final int LOOKAHEAD_DEPTH_INIT = -1;
34: }
|