Exemplo n.º 1
0
        private void AddKernal(Production production, int pos)
        {
            ProductionItem item = new ProductionItem(production, pos);

            this.kernal_items.Add(item);
            this.all_items.Add(item);
        }
Exemplo n.º 2
0
		private void AddNonKernal(Production production)
		{
			ProductionItem item = new ProductionItem(production, 0);
			if (!this.all_items.Contains(item))
			{
				this.all_items.Add(item);
				this.AddClosure(item);
			}
		}
Exemplo n.º 3
0
        private void AddNonKernal(Production production)
        {
            ProductionItem item = new ProductionItem(production, 0);

            if (!this.all_items.Contains(item))
            {
                this.all_items.Add(item);
                this.AddClosure(item);
            }
        }
Exemplo n.º 4
0
 private void AddClosure(ProductionItem item)
 {
     if (item.pos < item.production.rhs.Count)
     {
         Symbol symbol = item.production.rhs[item.pos];
         if (symbol is NonTerminal)
         {
             foreach (Production current in ((NonTerminal)symbol).productions)
             {
                 this.AddNonKernal(current);
             }
         }
     }
 }
Exemplo n.º 5
0
		private void AddClosure(ProductionItem item)
		{
			if (item.pos < item.production.rhs.Count)
			{
				Symbol symbol = item.production.rhs[item.pos];
				if (symbol is NonTerminal)
				{
					foreach (Production current in ((NonTerminal)symbol).productions)
					{
						this.AddNonKernal(current);
					}
				}
			}
		}
Exemplo n.º 6
0
 private void AddClosure(ProductionItem item)
 {
     if (item.pos < item.production.rhs.Count)
     {
         Symbol rhs = item.production.rhs[item.pos];
         if (rhs is NonTerminal)
         {
             foreach (Production p in ((NonTerminal)rhs).productions)
             {
                 AddNonKernal(p);
             }
         }
     }
 }
Exemplo n.º 7
0
 private State FindExistingState(Symbol sym, List <ProductionItem> itemSet)
 {
     if (this.accessedBy.ContainsKey(sym))
     {
         foreach (State current in this.accessedBy[sym])
         {
             if (ProductionItem.SameProductions(current.kernal_items, itemSet))
             {
                 return(current);
             }
         }
     }
     return(null);
 }
Exemplo n.º 8
0
        private State FindExistingState(Symbol sym, List <ProductionItem> itemSet)
        {
            if (accessedBy.ContainsKey(sym))
            {
                foreach (State state in accessedBy[sym])
                {
                    if (ProductionItem.SameProductions(state.kernal_items, itemSet))
                    {
                        return(state);
                    }
                }
            }

            return(null);
        }
Exemplo n.º 9
0
 public Reduce(ProductionItem item)
 {
     this.item = item;
 }
Exemplo n.º 10
0
 private void AddKernal(Production production, int pos)
 {
     ProductionItem item = new ProductionItem(production, pos);
     kernal_items.Add(item);
     all_items.Add(item);
 }
Exemplo n.º 11
0
 private void AddClosure(ProductionItem item)
 {
     if (item.pos < item.production.rhs.Count)
     {
         Symbol rhs = item.production.rhs[item.pos];
         if (rhs is NonTerminal)
             foreach (Production p in ((NonTerminal)rhs).productions)
                 AddNonKernal(p);
     }
 }
Exemplo n.º 12
0
 public Reduce(ProductionItem item)
 {
     this.item = item;
 }
Exemplo n.º 13
0
        public override bool Equals(object obj)
        {
            ProductionItem item = (ProductionItem)obj;

            return(item.pos == pos && item.production == production);
        }
Exemplo n.º 14
0
        public override bool Equals(object obj)
        {
            ProductionItem productionItem = (ProductionItem)obj;

            return(productionItem.pos == this.pos && productionItem.production == this.production);
        }