Exemple #1
0
        /// <summary>
        /// Constructs the typed list rule from the specified parameters.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="itemIdentifierType">Item identifier type.</param>
        /// <returns>Typed list grammar rule.</returns>
        public static NonTerminal ConstructTypedListRule(MasterGrammar p, IdentifierType itemIdentifierType)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var typedList       = new NonTerminal("Typed list", typeof(TypedListAstNode));
            var singleTypedList = new NonTerminal("Single typed list", typeof(TransientAstNode));
            var typeDeclaration = new NonTerminal("Type declaration", typeof(TransientAstNode));

            var type            = new NonTerminal("Type", typeof(TransientAstNode));
            var typePlusList    = new NonTerminal("Type list", typeof(TransientAstNode));
            var identifiersList = new NonTerminal("Typed list identifiers", typeof(TransientAstNode));

            var itemIdentifier = new IdentifierTerminal("Item identifier", itemIdentifierType);
            var typeIdentifier = new IdentifierTerminal("Type identifier", IdentifierType.CONSTANT);

            // RULES

            typedList.Rule       = p.MakeStarRule(typedList, singleTypedList);
            singleTypedList.Rule = identifiersList + typeDeclaration;
            identifiersList.Rule = p.MakeStarRule(identifiersList, itemIdentifier);
            typeDeclaration.Rule = p.Empty | ("-" + type);

            type.Rule         = typeIdentifier | ("(" + p.ToTerm("either") + typePlusList + ")");
            typePlusList.Rule = p.MakePlusRule(typePlusList, typeIdentifier);

            return(typedList);
        }
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        public PreGd(MasterGrammar p) : base(p)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var preGd         = new NonTerminal("Pre-GD", typeof(TransientAstNode));
            var preGdBase     = new NonTerminal("Pre-GD base", typeof(TransientAstNode));
            var preGdStarList = new NonTerminal("Pre-GD star-list", typeof(TransientAstNode));

            var prefPreGdBase   = new NonTerminal("Preference expression (pre-GD)", typeof(PreferenceGdAstNode));
            var prefNameOrEmpty = new NonTerminal("Optional preference name", typeof(TransientAstNode));
            var prefName        = new IdentifierTerminal("Preference name", IdentifierType.CONSTANT);

            var andPreGdBase    = new NonTerminal("AND expression (pre-GDs)", typeof(AndGdAstNode));
            var forallPreGdBase = new NonTerminal("FORALL expression (pre-GD)", typeof(ForallGdAstNode));
            var orGdBase        = new NonTerminal("OR expression (pre-GD)", typeof(OrGdAstNode));
            var notGdBase       = new NonTerminal("NOT expression (pre-GD)", typeof(NotGdAstNode));
            var implyGdBase     = new NonTerminal("IMPLY expression (pre-GD)", typeof(ImplyGdAstNode));
            var existsGdBase    = new NonTerminal("EXISTS expression (pre-GD)", typeof(ExistsGdAstNode));
            var equalsOpGdBase  = new NonTerminal("Equals operator (pre-GD)", typeof(EqualsOpGdAstNode));

            var numCompGdBase  = new NonTerminal("Numeric comparison expression (pre-GD)", typeof(NumCompGdAstNode));
            var binaryComparer = new NonTerminal("Binary comparer", typeof(TransientAstNode));

            var gdStarList = new NonTerminal("GD star-list", typeof(TransientAstNode));

            // USED SUB-TREES

            var typedList       = new TypedList(p);
            var gd              = new Gd(p);
            var predicateGdBase = new PredicateGd(p, BForm.BASE);
            var numericExpr     = new NumericExpr(p);
            var valueOrTerm     = new ValueOrTerm(p);

            // RULES

            preGd.Rule     = p.ToTerm("(") + preGdBase + ")";
            preGdBase.Rule = prefPreGdBase | andPreGdBase | forallPreGdBase | orGdBase | notGdBase | implyGdBase | existsGdBase | predicateGdBase | equalsOpGdBase | numCompGdBase;

            prefPreGdBase.Rule   = p.ToTerm("preference") + prefNameOrEmpty + gd;
            prefNameOrEmpty.Rule = prefName | p.Empty;

            andPreGdBase.Rule    = p.ToTerm("and") + preGdStarList;
            forallPreGdBase.Rule = p.ToTerm("forall") + "(" + typedList + ")" + preGd;
            orGdBase.Rule        = p.ToTerm("or") + gdStarList;
            notGdBase.Rule       = p.ToTerm("not") + gd;
            implyGdBase.Rule     = p.ToTerm("imply") + gd + gd;
            existsGdBase.Rule    = p.ToTerm("exists") + "(" + typedList + ")" + gd;
            equalsOpGdBase.Rule  = p.ToTerm("=") + valueOrTerm + valueOrTerm;

            numCompGdBase.Rule  = binaryComparer + numericExpr + numericExpr;
            binaryComparer.Rule = p.ToTerm(">") | "<" | ">=" | "<=";

            preGdStarList.Rule = p.MakeStarRule(preGdStarList, preGd);
            gdStarList.Rule    = p.MakeStarRule(gdStarList, gd);

            p.MarkTransient(preGd, preGdBase, gd, numericExpr, binaryComparer);

            Rule = preGd;
        }
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        public Effect(MasterGrammar p, BForm bForm) : base(p, bForm)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var effect     = new NonTerminal("Effect", typeof(TransientAstNode));
            var effectBase = new NonTerminal("Effect base", typeof(TransientAstNode));

            var andCEffectsBase = new NonTerminal("AND expression (c-effects)", typeof(AndCEffectsAstNode));
            var cEffectStarList = new NonTerminal("C-effects list", typeof(TransientAstNode));

            var cEffect     = new NonTerminal("C-effect", typeof(TransientAstNode));
            var cEffectBase = new NonTerminal("C-effect base", typeof(TransientAstNode));

            var forallCEffectBase = new NonTerminal("FORALL expression (c-effect)", typeof(ForallCEffectAstNode));
            var whenCEffectBase   = new NonTerminal("WHEN expression (c-effect)", typeof(WhenCEffectAstNode));

            var condEffect     = new NonTerminal("Cond-Effect", typeof(TransientAstNode));
            var condEffectBase = new NonTerminal("Cond-Effect base", typeof(TransientAstNode));

            var andPEffectsBase = new NonTerminal("AND expression (p-effects)", typeof(AndPEffectsAstNode));
            var pEffectStarList = new NonTerminal("P-effects star-list", typeof(TransientAstNode));

            // USED SUB-TREES

            var typedList   = new TypedList(p);
            var gd          = new Gd(p);
            var pEffect     = new PEffect(p, BForm.FULL);
            var pEffectBase = new PEffect(p, BForm.BASE);

            // RULES

            // (general) effect - c-effect or a list of c-effects
            effect.Rule     = p.ToTerm("(") + effectBase + ")";
            effectBase.Rule = cEffectBase | andCEffectsBase;

            andCEffectsBase.Rule = p.ToTerm("and") + cEffectStarList;
            cEffectStarList.Rule = p.MakeStarRule(cEffectStarList, cEffect);

            // c-effect (allowing conditional effects)
            cEffect.Rule     = p.ToTerm("(") + cEffectBase + ")";
            cEffectBase.Rule = forallCEffectBase | whenCEffectBase | pEffectBase;

            forallCEffectBase.Rule = p.ToTerm("forall") + "(" + typedList + ")" + effect;
            whenCEffectBase.Rule   = p.ToTerm("when") + gd + condEffect;

            // cond-effect (not allowing inner conditional effects)
            condEffect.Rule     = p.ToTerm("(") + condEffectBase + ")";
            condEffectBase.Rule = pEffectBase | andPEffectsBase;

            andPEffectsBase.Rule = p.ToTerm("and") + pEffectStarList;
            pEffectStarList.Rule = p.MakeStarRule(pEffectStarList, pEffect);

            p.MarkTransient(effect, effectBase, cEffect, cEffectBase, condEffect, condEffectBase);

            Rule = (bForm == BForm.BASE) ? effectBase : effect;
        }
Exemple #4
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        public Term(MasterGrammar p) : base(p)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var term           = new NonTerminal("Term", typeof(TransientAstNode));
            var termIdentifier = new NonTerminal("Identifier term", typeof(IdentifierTermAstNode));
            var termFunction   = new NonTerminal("Functional term", typeof(TransientAstNode));

            var termFunctionBase  = new NonTerminal("Functional term base", typeof(FunctionTermAstNode));
            var functionArguments = new NonTerminal("Functional term arguments", typeof(TransientAstNode));

            var functionIdentifier   = new IdentifierTerminal("Function identifier", IdentifierType.CONSTANT);
            var varOrConstIdentifier = new IdentifierTerminal("Variable or constant identifier", IdentifierType.VARIABLE_OR_CONSTANT);

            // RULES

            term.Rule           = termIdentifier | termFunction;
            termIdentifier.Rule = varOrConstIdentifier;
            termFunction.Rule   = p.ToTerm("(") + termFunctionBase + ")";

            termFunctionBase.Rule  = functionIdentifier + functionArguments;
            functionArguments.Rule = p.MakeStarRule(functionArguments, term);

            p.MarkTransient(term, termFunction);

            Rule = term;
        }
        /// <summary>
        /// Constructs the function term rule from the specified parameters.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        /// <param name="identifierType">Identifier type.</param>
        /// <returns>Function term grammar rule.</returns>
        public static NonTerminal ConstructFunctionTermRule(MasterGrammar p, BForm bForm, IdentifierType identifierType)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var functionTerm      = new NonTerminal("Functional term", typeof(TransientAstNode));
            var functionTermBase  = new NonTerminal("Functional term base", typeof(FunctionTermAstNode));
            var functionArguments = new NonTerminal("Functional term arguments", typeof(TransientAstNode));

            var argTerm           = new NonTerminal("Term", typeof(TransientAstNode));
            var argTermIdentifier = new NonTerminal("Identifier term", typeof(IdentifierTermAstNode));

            var functionIdentifier   = new IdentifierTerminal("Function identifier", IdentifierType.CONSTANT);
            var varOrConstIdentifier = new IdentifierTerminal("Variable or constant identifier", identifierType);

            // RULES

            functionTerm.Rule      = p.ToTerm("(") + functionTermBase + ")";
            functionTermBase.Rule  = functionIdentifier + functionArguments;
            functionArguments.Rule = p.MakeStarRule(functionArguments, argTerm);

            argTerm.Rule           = argTermIdentifier | functionTerm;
            argTermIdentifier.Rule = varOrConstIdentifier;

            p.MarkTransient(functionTerm, argTerm);

            return((bForm == BForm.BASE) ? functionTermBase : functionTerm);
        }
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        public TimedEffect(MasterGrammar p, BForm bForm) : base(p, bForm)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var timedEffect     = new NonTerminal("Timed effect", typeof(TransientAstNode));
            var timedEffectBase = new NonTerminal("Timed effect base", typeof(TransientAstNode));

            var atTimedEffectBase     = new NonTerminal("AT expression (timed effect)", typeof(AtTimedEffectAstNode));
            var assignTimedEffectBase = new NonTerminal("Assign expression (timed effect)", typeof(AssignTimedEffectAstNode));

            var timeSpecifier       = new NonTerminal("Time specifier", typeof(TransientAstNode));
            var timedCondEffect     = new NonTerminal("Timed cond-Effect", typeof(TransientAstNode));
            var timedCondEffectBase = new NonTerminal("Timed Cond-Effect base", typeof(TransientAstNode));

            var andTimedPEffectsBase = new NonTerminal("AND expression (timed p-effects)", typeof(AndPEffectsAstNode));
            var timedPEffectStarList = new NonTerminal("Timed p-effects star-list", typeof(TransientAstNode));

            var assignTimedEffectOp       = new NonTerminal("Assign expression operator (timed effect)", typeof(TransientAstNode));
            var assignTimedEffectFuncHead = new NonTerminal("Assign expression function head (timed effect)", typeof(TransientAstNode));
            var assignFuncIdentifier      = new NonTerminal("Function identifier for ASSIGN operation", typeof(FunctionTermAstNode));

            var functionIdentifier = new IdentifierTerminal("Function identifier", IdentifierType.CONSTANT);

            // USED SUB-TREES

            var assignFunctionTerm = new FunctionTerm(p);
            var numericExprT       = new NumericExprT(p);
            var timedPEffect       = new PEffectT(p, BForm.FULL);
            var timedPEffectBase   = new PEffectT(p, BForm.BASE);

            // RULES

            // timed effect
            timedEffect.Rule     = p.ToTerm("(") + timedEffectBase + ")";
            timedEffectBase.Rule = atTimedEffectBase | assignTimedEffectBase;

            atTimedEffectBase.Rule = p.ToTerm("at") + timeSpecifier + timedCondEffect;
            timeSpecifier.Rule     = p.ToTerm("start") | p.ToTerm("end");

            // timed cond-effect ("cond-effect" with assign operation being extended with the use of "f-exp-da")
            timedCondEffect.Rule     = p.ToTerm("(") + timedCondEffectBase + ")";
            timedCondEffectBase.Rule = timedPEffectBase | andTimedPEffectsBase;

            andTimedPEffectsBase.Rule = p.ToTerm("and") + timedPEffectStarList;
            timedPEffectStarList.Rule = p.MakeStarRule(timedPEffectStarList, timedPEffect);

            // timed p-effect
            timedPEffect.Rule = p.ToTerm("(") + timedPEffectBase + ")";

            assignTimedEffectBase.Rule     = assignTimedEffectOp + assignTimedEffectFuncHead + numericExprT;
            assignTimedEffectOp.Rule       = p.ToTerm("increase") | "decrease";
            assignTimedEffectFuncHead.Rule = assignFuncIdentifier | assignFunctionTerm;
            assignFuncIdentifier.Rule      = functionIdentifier;

            p.MarkTransient(timedEffect, timedEffectBase, timedCondEffect, timedCondEffectBase, assignTimedEffectFuncHead);

            Rule = (bForm == BForm.BASE) ? timedEffectBase : timedEffect;
        }
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        public ConGd(MasterGrammar p) : base(p)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var conGd         = new NonTerminal("Con-GD", typeof(TransientAstNode));
            var conGdBase     = new NonTerminal("Con-GD base", typeof(TransientAstNode));
            var conGdStarList = new NonTerminal("Con-GD star-list", typeof(TransientAstNode));

            var andConGdBase    = new NonTerminal("AND expression (con-GDs)", typeof(AndConGdAstNode));
            var forallConGdBase = new NonTerminal("FORALL expression (con-GDs)", typeof(ForallConGdAstNode));

            var atEndConGdBase          = new NonTerminal("AT-END expression (con-GD)", typeof(AtEndConGdAstNode));
            var alwaysConGdBase         = new NonTerminal("ALWAYS expression (con-GD)", typeof(AlwaysConGdAstNode));
            var sometimeConGdBase       = new NonTerminal("SOMETIME expression (con-GD)", typeof(SometimeConGdAstNode));
            var withinConGdBase         = new NonTerminal("WITHIN expression (con-GD)", typeof(WithinConGdAstNode));
            var atMostOnceConGdBase     = new NonTerminal("AT-MOST-ONCE expression (con-GD)", typeof(AtMostOnceConGdAstNode));
            var sometimeAfterConGdBase  = new NonTerminal("SOMETIME-AFTER expression (con-GD)", typeof(SometimeAfterConGdAstNode));
            var sometimeBeforeConGdBase = new NonTerminal("SOMETIME-BEFORE expression (con-GD)", typeof(SometimeBeforeConGdAstNode));
            var alwaysWithinConGdBase   = new NonTerminal("ALWAYS-WITHIN expression (con-GD)", typeof(AlwaysWithinConGdAstNode));
            var holdDuringConGdBase     = new NonTerminal("HOLD-DURING expression (con-GD)", typeof(HoldDuringConGdAstNode));
            var holdAfterConGdBase      = new NonTerminal("HOLD-AFTER expression (con-GD)", typeof(HoldAfterConGdAstNode));

            var number = new NumberLiteral("Number");

            // USED SUB-TREES

            var typedList = new TypedList(p);
            var gd        = new Gd(p);

            // RULES

            conGd.Rule     = p.ToTerm("(") + conGdBase + ")";
            conGdBase.Rule = andConGdBase | forallConGdBase | atEndConGdBase | alwaysConGdBase | sometimeConGdBase | withinConGdBase | atMostOnceConGdBase
                             | sometimeAfterConGdBase | sometimeBeforeConGdBase | alwaysWithinConGdBase | holdDuringConGdBase | holdAfterConGdBase;

            andConGdBase.Rule    = p.ToTerm("and") + conGdStarList;
            forallConGdBase.Rule = p.ToTerm("forall") + "(" + typedList + ")" + conGd;

            atEndConGdBase.Rule          = p.ToTerm("at") + p.ToTerm("end") + gd;
            alwaysConGdBase.Rule         = p.ToTerm("always") + gd;
            sometimeConGdBase.Rule       = p.ToTerm("sometime") + gd;
            withinConGdBase.Rule         = p.ToTerm("within") + number + gd;
            atMostOnceConGdBase.Rule     = p.ToTerm("at-most-once") + gd;
            sometimeAfterConGdBase.Rule  = p.ToTerm("sometime-after") + gd + gd;
            sometimeBeforeConGdBase.Rule = p.ToTerm("sometime-before") + gd + gd;
            alwaysWithinConGdBase.Rule   = p.ToTerm("always-within") + number + gd + gd;
            holdDuringConGdBase.Rule     = p.ToTerm("hold-during") + number + number + gd;
            holdAfterConGdBase.Rule      = p.ToTerm("hold-after") + number + gd;

            conGdStarList.Rule = p.MakeStarRule(conGdStarList, conGd);

            p.MarkTransient(conGd, conGdBase);

            Rule = conGd;
        }
Exemple #8
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        public DaGd(MasterGrammar p) : base(p)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var daGd         = new NonTerminal("Da-GD", typeof(TransientAstNode));
            var daGdBase     = new NonTerminal("Da-GD base", typeof(TransientAstNode));
            var daGdStarList = new NonTerminal("Da-GD star-list", typeof(TransientAstNode));

            var andDaGdBase    = new NonTerminal("AND expression (da-GDs)", typeof(AndDaGdAstNode));
            var forallDaGdBase = new NonTerminal("FORALL expression (da-GD)", typeof(ForallDaGdAstNode));
            var prefDaGdBase   = new NonTerminal("Preference (da-GD)", typeof(PreferenceDaGdAstNode));

            var prefNameOrEmpty = new NonTerminal("Optional preference name", typeof(TransientAstNode));
            var prefName        = new IdentifierTerminal("Preference name", IdentifierType.CONSTANT);

            var timedDaGd     = new NonTerminal("Timed-da-GD", typeof(TransientAstNode));
            var timedDaGdBase = new NonTerminal("Timed-da-GD base", typeof(TransientAstNode));
            var atTimedDaGd   = new NonTerminal("AT expression (timed-da-GD)", typeof(AtTimedDaGdAstNode));
            var overTimedDaGd = new NonTerminal("OVER expression (timed-da-GD)", typeof(OverTimedDaGdAstNode));

            var timeSpecifier     = new NonTerminal("Time specifier", typeof(TransientAstNode));
            var intervalSpecifier = new NonTerminal("Interval specifier", typeof(TransientAstNode));

            // USED SUB-TREES

            var typedList = new TypedList(p);
            var gd        = new Gd(p);

            // RULES

            daGd.Rule     = p.ToTerm("(") + daGdBase + ")";
            daGdBase.Rule = andDaGdBase | forallDaGdBase | prefDaGdBase | timedDaGdBase;

            andDaGdBase.Rule    = p.ToTerm("and") + daGdStarList;
            forallDaGdBase.Rule = p.ToTerm("forall") + "(" + typedList + ")" + daGd;

            prefDaGdBase.Rule    = p.ToTerm("preference") + prefNameOrEmpty + timedDaGd;
            prefNameOrEmpty.Rule = prefName | p.Empty;

            timedDaGd.Rule     = p.ToTerm("(") + timedDaGdBase + ")";
            timedDaGdBase.Rule = atTimedDaGd | overTimedDaGd;
            atTimedDaGd.Rule   = p.ToTerm("at") + timeSpecifier + gd;
            overTimedDaGd.Rule = p.ToTerm("over") + intervalSpecifier + gd;

            timeSpecifier.Rule     = p.ToTerm("start") | p.ToTerm("end");
            intervalSpecifier.Rule = p.ToTerm("all");

            daGdStarList.Rule = p.MakeStarRule(daGdStarList, daGd);

            p.MarkTransient(daGd, daGdBase, timedDaGd, timedDaGdBase);

            Rule = daGd;
        }
Exemple #9
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        public DurConstr(MasterGrammar p) : base(p)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var durationConstr     = new NonTerminal("Duration-constraint", typeof(TransientAstNode));
            var durationConstrBase = new NonTerminal("Duration-constraint base", typeof(TransientAstNode));

            var simpleDurationConstr     = new NonTerminal("Simple duration-constraint", typeof(TransientAstNode));
            var simpleDurationConstrBase = new NonTerminal("Simple duration-constraint base", typeof(TransientAstNode));

            var andSimpleDurationConstrsBase  = new NonTerminal("AND expression (duration-constraints)", typeof(AndSimpleDurationConstraintsAstNode));
            var simpleDurationConstrsPlusList = new NonTerminal("Simple duration constraints plus-list", typeof(TransientAstNode));

            var atSimpleDurationConstr     = new NonTerminal("AT expression (duration-constraint)", typeof(AtSimpleDurationConstraintAstNode));
            var compOpSimpleDurationConstr = new NonTerminal("CompareOp (duration-constraint)", typeof(CompOpSimpleDurationConstraintAstNode));
            var timeSpecifier = new NonTerminal("Time specifier", typeof(TransientAstNode));

            var durCompareOp  = new NonTerminal("Compare operator for duration-constraint", typeof(TransientAstNode));
            var durCompareVal = new NonTerminal("Value for duration-constraint", typeof(TransientAstNode));

            // USED SUB-TREES

            var numericExpr = new NumericExpr(p);

            // RULES

            durationConstr.Rule     = p.ToTerm("(") + durationConstrBase + ")";
            durationConstrBase.Rule = andSimpleDurationConstrsBase | simpleDurationConstrBase;

            andSimpleDurationConstrsBase.Rule  = p.ToTerm("and") + simpleDurationConstrsPlusList;
            simpleDurationConstrsPlusList.Rule = p.MakeStarRule(simpleDurationConstrsPlusList, simpleDurationConstr);

            simpleDurationConstr.Rule     = p.ToTerm("(") + simpleDurationConstrBase + ")";
            simpleDurationConstrBase.Rule = atSimpleDurationConstr | compOpSimpleDurationConstr;

            atSimpleDurationConstr.Rule     = p.ToTerm("at") + timeSpecifier + simpleDurationConstr;
            compOpSimpleDurationConstr.Rule = durCompareOp + "?duration" + durCompareVal;
            timeSpecifier.Rule = p.ToTerm("start") | p.ToTerm("end");

            durCompareOp.Rule  = p.ToTerm("<=") | ">=" | "=";
            durCompareVal.Rule = numericExpr;

            p.MarkTransient(durationConstr, durationConstrBase, simpleDurationConstr, simpleDurationConstrBase, durCompareVal);

            Rule = durationConstr;
        }
Exemple #10
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        public Gd(MasterGrammar p) : base(p)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var gd         = new NonTerminal("GD", typeof(TransientAstNode));
            var gdBase     = new NonTerminal("GD base", typeof(TransientAstNode));
            var gdStarList = new NonTerminal("GD star-list", typeof(TransientAstNode));

            var andGdBase      = new NonTerminal("AND expression (GDs)", typeof(AndGdAstNode));
            var orGdBase       = new NonTerminal("OR expression (GD)", typeof(OrGdAstNode));
            var notGdBase      = new NonTerminal("NOT expression (GD)", typeof(NotGdAstNode));
            var implyGdBase    = new NonTerminal("IMPLY expression (GD)", typeof(ImplyGdAstNode));
            var existsGdBase   = new NonTerminal("EXISTS expression (GD)", typeof(ExistsGdAstNode));
            var forallGdBase   = new NonTerminal("FORALL expression (GD)", typeof(ForallGdAstNode));
            var equalsOpGdBase = new NonTerminal("Equals operator (GD)", typeof(EqualsOpGdAstNode));
            var numCompGdBase  = new NonTerminal("Numeric comparison expression (GD)", typeof(NumCompGdAstNode));
            var binaryComparer = new NonTerminal("Binary comparer", typeof(TransientAstNode));

            // USED SUB-TREES

            var typedList       = new TypedList(p);
            var numericExpr     = new NumericExpr(p);
            var valueOrTerm     = new ValueOrTerm(p);
            var predicateGdBase = new PredicateGd(p, BForm.BASE);

            // RULES

            gd.Rule     = p.ToTerm("(") + gdBase + ")";
            gdBase.Rule = andGdBase | orGdBase | notGdBase | implyGdBase | existsGdBase | forallGdBase | predicateGdBase | equalsOpGdBase | numCompGdBase;

            andGdBase.Rule      = p.ToTerm("and") + gdStarList;
            orGdBase.Rule       = p.ToTerm("or") + gdStarList;
            notGdBase.Rule      = p.ToTerm("not") + gd;
            implyGdBase.Rule    = p.ToTerm("imply") + gd + gd;
            existsGdBase.Rule   = p.ToTerm("exists") + "(" + typedList + ")" + gd;
            forallGdBase.Rule   = p.ToTerm("forall") + "(" + typedList + ")" + gd;
            equalsOpGdBase.Rule = p.ToTerm("=") + valueOrTerm + valueOrTerm;
            numCompGdBase.Rule  = binaryComparer + numericExpr + numericExpr;
            binaryComparer.Rule = p.ToTerm(">") | "<" | ">=" | "<=";

            gdStarList.Rule = p.MakeStarRule(gdStarList, gd);

            p.MarkTransient(gd, gdBase, binaryComparer);

            Rule = gd;
        }
Exemple #11
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        public FunctionTypedList(MasterGrammar p) : base(p)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var functionsTypedList = new NonTerminal("Functions typed list", typeof(FunctionTypedListAstNode));

            var typedFuncBlock = new NonTerminal("Typed functions block", typeof(TransientAstNode));
            var funcBlock      = new NonTerminal("Functions block", typeof(TransientAstNode));

            var singleFunction     = new NonTerminal("Single function", typeof(TransientAstNode));
            var singleFunctionBase = new NonTerminal("Single function base", typeof(TransientAstNode));
            var functionIdentifier = new IdentifierTerminal("Function identifier", IdentifierType.CONSTANT);

            var typeDeclaration = new NonTerminal("Type declaration", typeof(TransientAstNode));

            var type           = new NonTerminal("Type", typeof(TransientAstNode));
            var typePlusList   = new NonTerminal("Type list", typeof(TransientAstNode));
            var typeIdentifier = new IdentifierTerminal("Type identifier", IdentifierType.CONSTANT);

            // USED SUB-TREES

            var typedList = new TypedList(p);

            // RULES

            functionsTypedList.Rule = p.MakeStarRule(functionsTypedList, typedFuncBlock);
            typedFuncBlock.Rule     = funcBlock + typeDeclaration;

            funcBlock.Rule          = p.MakePlusRule(funcBlock, singleFunction);
            singleFunction.Rule     = p.ToTerm("(") + singleFunctionBase + ")";
            singleFunctionBase.Rule = functionIdentifier + typedList;

            typeDeclaration.Rule = p.Empty | ("-" + type);
            type.Rule            = typeIdentifier | ("(" + p.ToTerm("either") + typePlusList + ")");
            typePlusList.Rule    = p.MakePlusRule(typePlusList, typeIdentifier);

            p.MarkTransient(singleFunction);

            Rule = functionsTypedList;
        }
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        public DaEffect(MasterGrammar p, BForm bForm) : base(p, bForm)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var daEffect     = new NonTerminal("Da-effect", typeof(TransientAstNode));
            var daEffectBase = new NonTerminal("Da-effect base", typeof(TransientAstNode));

            var andDaEffects      = new NonTerminal("AND expression (da-effects)", typeof(AndDaEffectsAstNode));
            var daEffectsStarList = new NonTerminal("Da-effects star list", typeof(TransientAstNode));

            var forallDaEffect = new NonTerminal("FORALL expression (da-effect)", typeof(ForallDaEffectAstNode));
            var whenTimeEffect = new NonTerminal("WHEN expression (da-effect)", typeof(WhenDaEffectAstNode));

            var timedEffect = new NonTerminal("Timed-effect", typeof(TransientAstNode));

            // USED SUB-TREES

            var timedEffectBase = new TimedEffect(p, BForm.BASE);
            var typedList       = new TypedList(p);
            var daGd            = new DaGd(p);

            // RULES

            daEffect.Rule     = p.ToTerm("(") + daEffectBase + ")";
            daEffectBase.Rule = timedEffectBase | andDaEffects | forallDaEffect | whenTimeEffect;

            andDaEffects.Rule      = p.ToTerm("and") + daEffectsStarList;
            daEffectsStarList.Rule = p.MakeStarRule(daEffectsStarList, daEffect);

            forallDaEffect.Rule = p.ToTerm("forall") + "(" + typedList + ")" + daEffect;
            whenTimeEffect.Rule = p.ToTerm("when") + daGd + timedEffect;

            timedEffect.Rule = p.ToTerm("(") + timedEffectBase + ")";

            p.MarkTransient(daEffect, daEffectBase, timedEffect);

            Rule = (bForm == BForm.BASE) ? daEffectBase : daEffect;
        }
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        public PredicateGd(MasterGrammar p, BForm bForm) : base(p, bForm)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var predicate           = new NonTerminal("Predicate GD", typeof(TransientAstNode));
            var predicateBase       = new NonTerminal("Predicate GD base", typeof(PredicateGdAstNode));
            var predicateArguments  = new NonTerminal("Predicate arguments", typeof(TransientAstNode));
            var predicateIdentifier = new IdentifierTerminal("Predicate identifier", IdentifierType.CONSTANT);

            // USED SUB-TREES

            var term = new Term(p);

            // RULES

            predicate.Rule          = p.ToTerm("(") + predicateBase + ")";
            predicateBase.Rule      = predicateIdentifier + predicateArguments;
            predicateArguments.Rule = p.MakeStarRule(predicateArguments, term);

            p.MarkTransient(predicate, term);

            Rule = (bForm == BForm.BASE) ? predicateBase : predicate;
        }
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        public InitElem(MasterGrammar p) : base(p)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var initElem     = new NonTerminal("Init element", typeof(TransientAstNode));
            var initElemBase = new NonTerminal("Init element", typeof(TransientAstNode));

            var predicateInitElemBase = new NonTerminal("Predicate (init elem)", typeof(PredicateInitElemAstNode));
            var predicateArguments    = new NonTerminal("Predicate arguments", typeof(TransientAstNode));

            var equalsInitElemBase = new NonTerminal("EQUALS expression (init elem)", typeof(EqualsOpInitElemAstNode));
            var equalsFirstArg     = new NonTerminal("EQUALS expression first argument", typeof(TransientAstNode));
            var equalsSecondArg    = new NonTerminal("EQUALS expression second argument", typeof(TransientAstNode));

            var functionEqualsArg = new NonTerminal("EQUALS expression function argument", typeof(TransientAstNode));
            var functionBase      = new NonTerminal("Function term", typeof(FunctionTermAstNode));
            var functionArguments = new NonTerminal("Function arguments", typeof(TransientAstNode));

            var constOrFuncTerm = new NonTerminal("Const/func identifier term", typeof(IdentifierTermAstNode));
            var constTerm       = new NonTerminal("Const identifier term", typeof(IdentifierTermAstNode));
            var numberTerm      = new NonTerminal("Number term", typeof(NumberTermAstNode));

            var notInitElemBase          = new NonTerminal("NOT expression (init elem)", typeof(NotInitElemAstNode));
            var notArgument              = new NonTerminal("NOT expression argument", typeof(TransientAstNode));
            var notArgumentBase          = new NonTerminal("NOT expression argument", typeof(TransientAstNode));
            var equalsSimpleInitElemBase = new NonTerminal("EQUALS expression (init elem)", typeof(EqualsOpInitElemAstNode));

            var atPredicateInitElemBase  = new NonTerminal("Predicate (init elem)", typeof(PredicateInitElemAstNode));
            var atExpressionInitElemBase = new NonTerminal("AT expression (init elem)", typeof(AtInitElemAstNode));
            var atArgument     = new NonTerminal("AT expression argument", typeof(TransientAstNode));
            var atArgumentBase = new NonTerminal("AT expression argument", typeof(TransientAstNode));

            var predicateIdentifier   = new IdentifierTerminal("Predicate identifier", IdentifierType.CONSTANT);
            var functionIdentifier    = new IdentifierTerminal("Function identifier", IdentifierType.CONSTANT);
            var constOrFuncIdentifier = new IdentifierTerminal("Constant or function identifier", IdentifierType.CONSTANT);
            var constIdentifier       = new IdentifierTerminal("Constant identifier", IdentifierType.CONSTANT);
            var number = new NumberLiteral("Number");

            // RULES

            initElem.Rule     = p.ToTerm("(") + initElemBase + ")";
            initElemBase.Rule = predicateInitElemBase | equalsInitElemBase | notInitElemBase | atPredicateInitElemBase | atExpressionInitElemBase;

            predicateInitElemBase.Rule = predicateIdentifier + predicateArguments;
            predicateArguments.Rule    = p.MakeStarRule(predicateArguments, constIdentifier);

            equalsInitElemBase.Rule = p.ToTerm("=") + equalsFirstArg + equalsSecondArg;
            equalsFirstArg.Rule     = constOrFuncTerm | functionEqualsArg;
            equalsSecondArg.Rule    = constTerm | numberTerm;

            functionEqualsArg.Rule = p.ToTerm("(") + functionBase + ")";
            functionBase.Rule      = functionIdentifier + functionArguments;
            functionArguments.Rule = p.MakeStarRule(functionArguments, constTerm);

            constOrFuncTerm.Rule = constOrFuncIdentifier;
            constTerm.Rule       = constIdentifier;
            numberTerm.Rule      = number;

            notInitElemBase.Rule          = p.ToTerm("not") + notArgument;
            notArgument.Rule              = p.ToTerm("(") + notArgumentBase + ")";
            notArgumentBase.Rule          = predicateInitElemBase | equalsSimpleInitElemBase;
            equalsSimpleInitElemBase.Rule = p.ToTerm("=") + constTerm + constTerm;

            atPredicateInitElemBase.Rule  = p.ToTerm("at") + predicateArguments;
            atExpressionInitElemBase.Rule = p.ToTerm("at") + number + atArgument;
            atArgument.Rule     = p.ToTerm("(") + atArgumentBase + ")";
            atArgumentBase.Rule = predicateInitElemBase | equalsSimpleInitElemBase | notInitElemBase;

            p.MarkTransient(initElem, initElemBase, equalsFirstArg, equalsSecondArg, functionEqualsArg, notArgument, notArgumentBase, atArgument, atArgumentBase);

            Rule = initElem;
        }
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        public Problem(MasterGrammar p) : base(p)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var problem             = new NonTerminal("Problem", typeof(ProblemAstNode));
            var definedProblem      = new NonTerminal("Defined problem", typeof(TransientAstNode));
            var correspondingDomain = new NonTerminal("Corresponding domain", typeof(TransientAstNode));

            var problemSections    = new NonTerminal("Problem sections", typeof(TransientAstNode));
            var problemSection     = new NonTerminal("Problem section", typeof(TransientAstNode));
            var problemSectionBase = new NonTerminal("Problem section base", typeof(TransientAstNode));

            var requireDef = new NonTerminal("Requirements section", typeof(ProblemRequirementsAstNode));
            var objectsDef = new NonTerminal("Objects section", typeof(ProblemObjectsAstNode));
            var initDef    = new NonTerminal("Init section", typeof(ProblemInitAstNode));
            var goalDef    = new NonTerminal("Goal section", typeof(ProblemGoalAstNode));
            var constrDef  = new NonTerminal("Constraints section", typeof(ProblemConstraintsAstNode));
            var metricDef  = new NonTerminal("Metric section", typeof(ProblemMetricAstNode));
            var lengthDef  = new NonTerminal("Length section", typeof(ProblemLengthAstNode));

            var requireList           = new NonTerminal("Requirements list", typeof(TransientAstNode));
            var initElemList          = new NonTerminal("Init elements list", typeof(TransientAstNode));
            var optimizationSpecifier = new NonTerminal("Optimization specifier", typeof(TransientAstNode));
            var lengthSpec            = new NonTerminal("Length definition specification", typeof(TransientAstNode));
            var lengthSpecifier       = new NonTerminal("Length specifier", typeof(TransientAstNode));

            var problemName = new IdentifierTerminal("Problem name", IdentifierType.CONSTANT);
            var domainName  = new IdentifierTerminal("Domain name", IdentifierType.CONSTANT);
            var requireName = new IdentifierTerminal("Requirement identifier", IdentifierType.REQUIREMENT);
            var number      = new NumberLiteral("Number");

            // USED SUB-TREES

            var typedListC = new TypedListC(p);
            var initElem   = new InitElem(p);
            var preGd      = new PreGd(p);
            var prefConGd  = new PrefConGd(p);
            var metricExpr = new MetricExpr(p);

            // RULES

            problem.Rule = p.ToTerm("(") + p.ToTerm("define") + definedProblem + correspondingDomain + problemSections + ")";

            definedProblem.Rule      = "(" + p.ToTerm("problem") + problemName + ")";
            correspondingDomain.Rule = "(" + p.ToTerm(":domain") + domainName + ")";
            problemSections.Rule     = p.MakeStarRule(problemSections, problemSection);

            problemSection.Rule     = p.ToTerm("(") + problemSectionBase + ")";
            problemSectionBase.Rule = requireDef | objectsDef | initDef | goalDef | constrDef | metricDef | lengthDef;

            requireDef.Rule = p.ToTerm(":requirements") + requireList;
            objectsDef.Rule = p.ToTerm(":objects") + typedListC;
            initDef.Rule    = p.ToTerm(":init") + initElemList;
            goalDef.Rule    = p.ToTerm(":goal") + preGd;
            constrDef.Rule  = p.ToTerm(":constraints") + prefConGd;
            metricDef.Rule  = p.ToTerm(":metric") + optimizationSpecifier + metricExpr;
            lengthDef.Rule  = p.ToTerm(":length") + lengthSpec + lengthSpec;

            requireList.Rule  = p.MakePlusRule(requireList, requireName);
            initElemList.Rule = p.MakeStarRule(initElemList, initElem);

            optimizationSpecifier.Rule = p.ToTerm("minimize") | p.ToTerm("maximize");

            lengthSpec.Rule      = (p.ToTerm("(") + lengthSpecifier + number + ")") | p.Empty;
            lengthSpecifier.Rule = p.ToTerm(":serial") | p.ToTerm(":parallel");

            p.MarkTransient(problemSection, problemSectionBase, optimizationSpecifier, lengthSpecifier);

            Rule = problem;
        }
Exemple #16
0
        /// <summary>
        /// Constructor of the grammar node.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        public Domain(MasterGrammar p) : base(p)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var domain            = new NonTerminal("Domain", typeof(DomainAstNode));
            var domainSections    = new NonTerminal("Domain sections", typeof(TransientAstNode));
            var domainSection     = new NonTerminal("Domain section", typeof(TransientAstNode));
            var domainSectionBase = new NonTerminal("Domain section base", typeof(TransientAstNode));

            var requireDef     = new NonTerminal("Requirements section", typeof(DomainRequirementsAstNode));
            var typesDef       = new NonTerminal("Types section", typeof(DomainTypesAstNode));
            var constantsDef   = new NonTerminal("Constants section", typeof(DomainConstantsAstNode));
            var predicatesDef  = new NonTerminal("Predicates section", typeof(DomainPredicatesAstNode));
            var functionsDef   = new NonTerminal("Functions section", typeof(DomainFunctionsAstNode));
            var constraintsDef = new NonTerminal("Constraints section", typeof(DomainConstraintsAstNode));
            var structureDef   = new NonTerminal("Structure section", typeof(TransientAstNode));

            var requireList = new NonTerminal("Requirements", typeof(TransientAstNode));

            var predicatesList        = new NonTerminal("Predicates list", typeof(TransientAstNode));
            var predicateSkeleton     = new NonTerminal("Predicate skeleton", typeof(TransientAstNode));
            var predicateSkeletonBase = new NonTerminal("Predicate skeleton base", typeof(PredicateSkeletonAstNode));

            var domainName          = new IdentifierTerminal("Domain name", IdentifierType.CONSTANT);
            var requireName         = new IdentifierTerminal("Requirement identifier", IdentifierType.REQUIREMENT);
            var predicateIdentifier = new IdentifierTerminal("Predicate identifier", IdentifierType.CONSTANT);

            // USED SUB-TREES

            var typedListC    = new TypedListC(p);
            var typedListV    = new TypedList(p);
            var funcTypedList = new FunctionTypedList(p);
            var conGd         = new ConGd(p);

            var action      = new Action(p, BForm.BASE);
            var durAction   = new DurAction(p, BForm.BASE);
            var derivedPred = new DerivedPred(p, BForm.BASE);

            // RULES

            domain.Rule         = p.ToTerm("(") + p.ToTerm("define") + "(" + p.ToTerm("domain") + domainName + ")" + domainSections + ")";
            domainSections.Rule = p.MakeStarRule(domainSections, domainSection);

            domainSection.Rule     = p.ToTerm("(") + domainSectionBase + ")";
            domainSectionBase.Rule = requireDef | typesDef | constantsDef | predicatesDef | functionsDef | constraintsDef | structureDef;

            requireDef.Rule  = p.ToTerm(":requirements") + requireList;
            requireList.Rule = p.MakePlusRule(requireList, requireName);

            typesDef.Rule     = p.ToTerm(":types") + typedListC;
            constantsDef.Rule = p.ToTerm(":constants") + typedListC;

            predicatesDef.Rule         = p.ToTerm(":predicates") + predicatesList;
            predicatesList.Rule        = p.MakePlusRule(predicatesList, predicateSkeleton);
            predicateSkeleton.Rule     = p.ToTerm("(") + predicateSkeletonBase + ")";
            predicateSkeletonBase.Rule = predicateIdentifier + typedListV;

            functionsDef.Rule = p.ToTerm(":functions") + funcTypedList;

            constraintsDef.Rule = p.ToTerm(":constraints") + conGd;

            structureDef.Rule = action | durAction | derivedPred;

            p.MarkTransient(domainSection, domainSectionBase, predicateSkeleton, structureDef);

            Rule = domain;
        }
Exemple #17
0
        /// <summary>
        /// Constructs the primitive effect rule from the specified parameters.
        /// </summary>
        /// <param name="p">Parent master grammar.</param>
        /// <param name="bForm">Block form.</param>
        /// <param name="valueOrTermForAssign">Value or term for an assignment.</param>
        /// <param name="numericExprForAssign">Numeric expression for an assignment.</param>
        /// <returns>Primitive effect grammar rule.</returns>
        public static NonTerminal ConstructPEffectRule(MasterGrammar p, BForm bForm, NonTerminal valueOrTermForAssign, NonTerminal numericExprForAssign)
        {
            // NON-TERMINAL AND TERMINAL SYMBOLS

            var pEffect     = new NonTerminal("P-effect", typeof(TransientAstNode));
            var pEffectBase = new NonTerminal("P-effect base", typeof(TransientAstNode));

            var atomicFormulaPEffect     = new NonTerminal("Atomic formula (p-effect)", typeof(TransientAstNode));
            var atomicFormulaPEffectBase = new NonTerminal("Atomic formula base (p-effect)", typeof(TransientAstNode));

            var predicatePEffectBase = new NonTerminal("Predicate (p-effect)", typeof(PredicatePEffectAstNode));
            var predicateArguments   = new NonTerminal("Predicate arguments", typeof(TransientAstNode));

            var equalsOpPEffectBase = new NonTerminal("Equals-op (p-effect)", typeof(EqualsOpPEffectAstNode));
            var notPEffectBase      = new NonTerminal("NOT expression (p-effect)", typeof(NotPEffectAstNode));

            var assignPEffectBase = new NonTerminal("General assign expression (p-effect)", typeof(TransientAstNode));
            var objOrNumAssign    = new NonTerminal("Numeric or object assign operator (p-effect)", typeof(AssignPEffectAstNode));
            var onlyNumAssign     = new NonTerminal("Numeric assign operator (p-effect)", typeof(AssignPEffectAstNode));

            var numAssignOp         = new NonTerminal("Assign operation", typeof(TransientAstNode));
            var assignOpArg1        = new NonTerminal("Assign operation first argument", typeof(TransientAstNode));
            var assignOpArg2        = new NonTerminal("Assign operation second argument", typeof(TransientAstNode));
            var assignOpArg2Num     = new NonTerminal("Assign operation second numeric argument", typeof(TransientAstNode));
            var assignOpFuncIdentif = new NonTerminal("Function identifier for ASSIGN operation", typeof(FunctionTermAstNode));
            var undefinedFuncVal    = new NonTerminal("Undefined function value", typeof(UndefinedFuncValAstNode));

            var predicateIdentifier = new IdentifierTerminal("Predicate identifier", IdentifierType.CONSTANT);
            var functionIdentifier  = new IdentifierTerminal("Function identifier", IdentifierType.CONSTANT);

            // USED SUB-TREES

            var valueOrTerm          = new ValueOrTerm(p);
            var predFuncTermFunction = new FunctionTerm(p);
            var term = new Term(p);

            // RULES

            pEffect.Rule     = p.ToTerm("(") + pEffectBase + ")";
            pEffectBase.Rule = atomicFormulaPEffectBase | notPEffectBase | assignPEffectBase;

            atomicFormulaPEffect.Rule     = p.ToTerm("(") + atomicFormulaPEffectBase + ")";
            atomicFormulaPEffectBase.Rule = predicatePEffectBase | equalsOpPEffectBase;

            predicatePEffectBase.Rule = predicateIdentifier + predicateArguments;
            predicateArguments.Rule   = p.MakeStarRule(predicateArguments, term);

            equalsOpPEffectBase.Rule = p.ToTerm("=") + valueOrTerm + valueOrTerm;
            notPEffectBase.Rule      = p.ToTerm("not") + atomicFormulaPEffect;

            assignPEffectBase.Rule = objOrNumAssign | onlyNumAssign;
            objOrNumAssign.Rule    = p.ToTerm("assign") + assignOpArg1 + assignOpArg2;
            onlyNumAssign.Rule     = numAssignOp + assignOpArg1 + assignOpArg2Num;

            assignOpArg1.Rule        = assignOpFuncIdentif | predFuncTermFunction;
            assignOpArg2.Rule        = undefinedFuncVal | valueOrTermForAssign;
            assignOpFuncIdentif.Rule = functionIdentifier;
            assignOpArg2Num.Rule     = numericExprForAssign;

            numAssignOp.Rule      = p.ToTerm("scale-up") | "scale-down" | "increase" | "decrease";
            undefinedFuncVal.Rule = p.ToTerm("undefined");

            p.MarkTransient(pEffect, pEffectBase, atomicFormulaPEffect, atomicFormulaPEffectBase, assignPEffectBase, assignOpArg1, assignOpArg2, assignOpArg2Num);

            return((bForm == BForm.BASE) ? pEffectBase : pEffect);
        }