Пример #1
0
        /// <summary>
        /// PRIM
        /// </summary>
        /// <param name="ts"></param>
        /// <returns></returns>
        IBoolExpr Prim(TokenStream ts)
        {
            switch (ts.Current.kind)
            {
            case Kind.VAR:
                string varName = ts.Current.nString.ToString();
                ts.MoveNext();
                return(BoolExpr.CreateVariable(varName));

            case Kind.POS: ts.MoveNext(); return(BoolExpr.CreateTrueVariable());

            case Kind.NEG: ts.MoveNext(); return(BoolExpr.CreateFalseVariable());

            case Kind.LPAR: ts.MoveNext();
                IBoolExpr ev = Exists(ts);
                if (ts.Current.kind != Kind.RPAR)
                {
                    throw new ApplicationException("Expected Kind.RPAR");
                }
                ts.MoveNext(); return(ev);

            case Kind.RPAR: ts.MoveNext(); return(null);
            }
            return(null);
        }