public ASTElement Parse(string Input)
        {
            m_ParseVarlauf = "";

            Input += m_EofSign;
            TerminalMatcher tm = new TerminalMatcher(Input, m_pt.Terminals);

            RuleTerminal ReadTerminal = tm.GetNextTerminal();
            bool         bAccept      = false;

            while (!bAccept && ReadTerminal != null && !m_ps.IsEmpty && !ReadTerminal.Equals(m_EofSign))
            {
                string tmpVerlauf = ReadTerminal.GetToken() + " ; " + m_ps.StackValues;
                m_ParseVerlaufArray.Add(m_ps.StackArray);

                ButtomUpParseStack.buStackElement stkElm = m_ps.Look();

                if (stkElm != null)
                {
                    if (stkElm.IsRuleElement)
                    {
                        tmpVerlauf += "err";
                    }
                    else
                    {
                        int State = stkElm.GetState;
                        ButtomUpParseTabelle.ActionEntry ae = m_pt.Get(ReadTerminal, State);
                        if (ae != null)
                        {
                            if (ae.GetAction == ButtomUpParseTabelle.Actions.SHIFT)
                            {
                                tmpVerlauf += "; s " + ae.NextState.ToString();
                                m_ps.PushShift(ReadTerminal, ae.NextState);
                                ReadTerminal = tm.GetNextTerminal();
                            }
                            else if (ae.GetAction == ButtomUpParseTabelle.Actions.REDUCE)
                            {
                                int sm = ae.NextState;
                                tmpVerlauf += "; r " + ae.NextState.ToString();

                                if (sm < m_ParseTable.AllRules.Count)
                                {
                                    BNFRule rl    = (BNFRule)m_ParseTable.AllRules[sm];
                                    int     RlLen = rl.RuleLength();
                                    for (int i = 0; i < RlLen; i++)
                                    {
                                        m_ps.Pop2();
                                    }
                                    ButtomUpParseStack.buStackElement stkLook = m_ps.Look();
                                    if (stkLook != null)
                                    {
                                        int nxtState = m_ParseTable.GetGotoState(rl.GetStart(), stkLook.GetState);
                                        m_ps.PushReduce(rl.GetStart(), nxtState);
                                        tmpVerlauf += "; " + rl.GetRuleString();
                                    }
                                }
                            }
                            else if (ae.GetAction == ButtomUpParseTabelle.Actions.JUMP)
                            {
                                tmpVerlauf += "; err";
                            }
                            else if (ae.GetAction == ButtomUpParseTabelle.Actions.ACCEPT)
                            {
                                tmpVerlauf += "; acc";
                                bAccept     = true;
                            }
                        }
                    }
                }
                m_ParseVarlauf += tmpVerlauf + "\n";
            }

            return(m_ps.ASTRoot);
        }
        protected override bool GenerateParseTable()
        {
            MyArrayList Terminals = GetAllTerminals();

            Terminals.Add(new RuleTerminal(m_EofTerminal, null));
            MyArrayList Tokens = GetDifStartTokens();
            MyArrayList column = new MyArrayList();

            for (int i = 0; i < Terminals.Count; i++)
            {
                RuleElement re = (RuleElement)Terminals[i];
                column.Add(re);
            }
            for (int i = 0; i < Tokens.Count; i++)
            {
                RuleStart rs = (RuleStart)Tokens[i];
                column.Add(rs);
            }

            m_bupt = new ButtomUpParseTabelle(column, Terminals, m_Huellen.Count);

            for (int i = 0; i < m_GotoTable.Count; i++)
            {
                GotoEntry   ge = (GotoEntry)m_GotoTable[i];
                RuleElement re = ge.TokenSymbol;
                if (re.IsTerminal())
                {
                    ButtomUpParseTabelle.ActionEntry buptAE = new ButtomUpParseTabelle.ActionEntry(ButtomUpParseTabelle.Actions.SHIFT, ge.JumpToState);
                    m_bupt.Add(re, ge.ThisState, buptAE);
                }
                else
                {
                    ButtomUpParseTabelle.ActionEntry buptAE = new ButtomUpParseTabelle.ActionEntry(ButtomUpParseTabelle.Actions.JUMP, ge.JumpToState);
                    m_bupt.Add(re, ge.ThisState, buptAE);
                }
            }

            bool dblEntry = false;

            for (int i = 0; i < m_Huellen.Count; i++)
            {
                MyArrayList ActHuelle = (MyArrayList)m_Huellen[i];
                for (int j = 0; j < ActHuelle.Count; j++)
                {
                    LRElement   lrm = (LRElement)ActHuelle[j];
                    RuleElement re  = GetRuleElement(lrm);
                    if (re == null)
                    {
                        BNFRule     rl   = (BNFRule)m_Rules[lrm.RulePos];
                        MyArrayList flws = rl.FollowSet;
                        if (flws != null)
                        {
                            for (int z = 0; z < flws.Count; z++)
                            {
                                RuleElement flw_re = (RuleElement)flws[z];
                                ButtomUpParseTabelle.ActionEntry buptAE = new ButtomUpParseTabelle.ActionEntry(ButtomUpParseTabelle.Actions.REDUCE, lrm.RulePos);
                                ButtomUpParseTabelle.ActionEntry ae     = m_bupt.Get(flw_re, i);
                                if (ae == null)
                                {
                                    m_bupt.Add(flw_re, i, buptAE);
                                }
                                else
                                {
                                    if (ae.GetAction != ButtomUpParseTabelle.Actions.ACCEPT)
                                    {
                                        dblEntry = true;
                                    }
                                }
                            }
                            if (rl.GetStart().GetToken().Equals(m_StartSign))
                            {
                                ButtomUpParseTabelle.ActionEntry buptAE = new ButtomUpParseTabelle.ActionEntry(ButtomUpParseTabelle.Actions.ACCEPT, lrm.RulePos);
                                m_bupt.Add(m_EofTerminal, i, buptAE);
                            }
                        }
                    }
                }
            }

            return(!dblEntry);
        }