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