public ExampleGrammar () { RootNonTerminal = E; this.nonTerminals.Add (E); this.nonTerminals.Add (T); this.nonTerminals.Add (P); this.terminals.Add (a); this.terminals.Add (plus); this.terminals.Add (star); Production E1 = new Production (E, new RewriteRule(T)); Production E2 = new Production (E, new RewriteRule(E, plus, T)); Production T1 = new Production (T, new RewriteRule(P)); Production T2 = new Production (T, new RewriteRule(T, star, P)); Production P1 = new Production (P, new RewriteRule(a)); this.rules.Add (E1); this.rules.Add (E2); this.rules.Add (T1); this.rules.Add (T2); this.rules.Add (P1); }
public StateOfProduction (Production production, int dotPosition) { this.production = production; this.dotPosition = dotPosition; }