ChildVar() public method

Gets the formal variable for the k'th child subtree.
public ChildVar ( int k ) : Expr
k int positive integer between 1 and MaxRank
return Microsoft.Z3.Expr
Ejemplo n.º 1
0
        internal TreeRule MkIdRule(RankedAlphabet A)
        {
            if (!IsAcceptorRule)
            {
                throw new AutomataException(AutomataExceptionKind.MkIdRule_RuleIsNotAcceptorRule);
            }

            Expr[] args = new Expr[this.lookahead.Length + 1];
            args[0] = A.AttrVar;
            for (int i = 1; i <= this.lookahead.Length; i++)
            {
                if (!(this.lookahead[i - 1].IsEmptyOrSingleton))
                {
                    throw new AutomataException(AutomataExceptionKind.MkIdRule_RuleIsNotFlat);
                }
                args[i] = (this.lookahead[i - 1].IsEmpty ? A.tt.Z.MkApp(A.Trans, A.tt.identityState, A.ChildVar(i))
                                                       : A.tt.Z.MkApp(A.Trans, this.lookahead[i - 1].SomeElement, A.ChildVar(i)));
            }
            var new_output = A.tt.Z.MkApp(symbol, args);
            var new_rule   = new TreeRule(this.state, this.symbol, this.guard, new_output, this.lookahead);

            return(new_rule);
        }
Ejemplo n.º 2
0
        internal TreeRule MkIdRule(RankedAlphabet A)
        {
            if (!IsAcceptorRule)
                throw new AutomataException(AutomataExceptionKind.MkIdRule_RuleIsNotAcceptorRule);

            Expr[] args = new Expr[this.lookahead.Length + 1];
            args[0] = A.AttrVar;
            for (int i = 1; i <= this.lookahead.Length; i++)
            {
                if (!(this.lookahead[i-1].IsEmptyOrSingleton))
                    throw new AutomataException(AutomataExceptionKind.MkIdRule_RuleIsNotFlat);
                args[i] = (this.lookahead[i-1].IsEmpty ? A.tt.Z.MkApp(A.Trans, A.tt.identityState, A.ChildVar(i))
                                                       : A.tt.Z.MkApp(A.Trans, this.lookahead[i-1].SomeElement, A.ChildVar(i)));
            }
            var new_output = A.tt.Z.MkApp(symbol, args);
            var new_rule = new TreeRule(this.state, this.symbol, this.guard, new_output, this.lookahead);
            return new_rule;
        }