1 8 9 package beaver.spec; 10 11 import beaver.comp.util.BitSet; 12 13 16 public class NonTerminal extends GrammarSymbol 17 { 18 19 public Production.List definitions = new Production.List(); 20 21 22 public boolean is_nullable; 23 24 28 public BitSet first_set; 29 30 NonTerminal(String name) 31 { 32 super(name); 33 } 34 35 NonTerminal(String name, String type) 36 { 37 super(name); 38 super.type = type; 39 } 40 41 44 boolean checkNullability() 45 { 46 if (is_nullable) 47 return false; 48 49 for (Production rule = definitions.start(); rule != null; rule = rule.next_definition) 50 { 51 if (rule.isNullable()) 52 { 53 return is_nullable = true; 54 } 55 } 56 return false; 57 } 58 } 59 | Popular Tags |