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