private void Initialize() {
      var ifFoodAhead = new IfFoodAhead();
      var prog2 = new Prog2();
      var prog3 = new Prog3();
      var move = new Move();
      var left = new Left();
      var right = new Right();
      var allSymbols = new List<Symbol>() { ifFoodAhead, prog2, prog3, move, left, right };
      var nonTerminalSymbols = new List<Symbol>() { ifFoodAhead, prog2, prog3 };

      allSymbols.ForEach(s => AddSymbol(s));
      SetSubtreeCount(ifFoodAhead, 2, 2);
      SetSubtreeCount(prog2, 2, 2);
      SetSubtreeCount(prog3, 3, 3);
      SetSubtreeCount(move, 0, 0);
      SetSubtreeCount(left, 0, 0);
      SetSubtreeCount(right, 0, 0);

      // each symbols is allowed as child of the start symbol
      allSymbols.ForEach(s => AddAllowedChildSymbol(StartSymbol, s));
      allSymbols.ForEach(s => AddAllowedChildSymbol(DefunSymbol, s));

      // each symbol is allowed as child of all other symbols (except for terminals that have MaxSubtreeCount == 0
      foreach (var parent in nonTerminalSymbols) {
        foreach (var child in allSymbols) {
          AddAllowedChildSymbol(parent, child);
        }
      }
    }
예제 #2
0
 private IfFoodAhead(IfFoodAhead original, Cloner cloner) : base(original, cloner)
 {
 }
예제 #3
0
 private IfFoodAhead(IfFoodAhead original, Cloner cloner) : base(original, cloner) { }