private void InitializeSlr1Table() { this.generator = new Generator(PascalDefinition.ProductionRules); slr1Table = generator.Generate(PascalDefinition.NonTerminalKey.Start); slr1Table.AllowedErrorRecoveryKey.Add(PascalDefinition.NonTerminalKey.Statement, () => new StatementNode(new SyntaxNode[0])); slr1Driver = new Slr1Driver(slr1Table); }
public Slr1Table Generate(object startKey) { var table = new Slr1Table(); var itemSet = new HashSet <Item>(); foreach (var productionRule in ProductionDict[startKey]) { itemSet.Add(new Item() { ProductionRule = productionRule, Cursor = 0 }); } itemSet = CommonUtils.Closure(itemSet, ProductionDict); var state = new AnalyzerState() { ItemSet = itemSet }; ItemSets.Add(itemSet, state); GenerateInternal(state, 0, AssociativityType.Left); table.ProductionRules = new List <ProductionRule>(); foreach (var pl in ProductionDict) { foreach (var productionRule in pl.Value) { table.ProductionRules.Add(productionRule); } } table.States = ItemSets; table.FollowSets = FollowSets; table.FirstSets = FirstSets; return(table); }
public ItemSetDiagram(Slr1Table slr1Table) { this.slr1Table = slr1Table; InitializeComponent(); InitializeGraph(); }
public Slr1Driver(Slr1Table slr1Table) { this.Slr1Table = slr1Table; ProductionDictionary = CommonUtils.MakeProductionRuleDictionary(slr1Table.ProductionRules); }
public AnalyzerHistory(List <ParserConfiguration> history, Slr1Table slr1Table) { this.history = history; this.slr1Table = slr1Table; InitializeComponent(); }