Ejemplo n.º 1
0
        public LLkT constructLLkT(string N, List <FirstKEl> L)
        {
            var table = new LLkT(this.Tcounter, N, L);

            this.Tcounter++;

            List <FirstKEl> first, setu;
            CfgRule         rulei;
            LLkTRow         ltrow;
            List <FollowEl> follow;

            for (var i = 0; i < this.cfg.Rules.Count; i++)
            {
                rulei = this.cfg.Rules[i];

                // skip irrelevant rules
                if (rulei.Left != N)
                {
                    continue;
                }

                // compute u
                first = this.firstOp(rulei.Right, this.k);
                setu  = this.firstPlusOp(first, L, this.k);

                // compute follow
                follow = this.followOp(rulei.Right, L);

                // add rows
                for (var j = 0; j < setu.Count; j++)
                {
                    ltrow = new LLkTRow(setu[j], rulei, follow);
                    table.addRow(ltrow);
                }
            }

            return(table);
        }
Ejemplo n.º 2
0
 public void addRow(LLkTRow ltrow)
 {
     this.rows.Add(ltrow);
 }