public Expr GenerateZ3ExprFromExpr(FExp expr, FastTransducerInstance fti)
 {
     switch (expr.kind)
     {
         case (FExpKind.App):
             return GenerateZ3Expr((AppExp)expr, fti);
         case (FExpKind.Value):
             return GenerateZ3Expr((Value)expr, fti);
         case (FExpKind.Var):
             return GenerateZ3Expr((Variable)expr, fti);
     }
     return null;
 }
 public Expr GenerateZ3ExprFromToExpr(FExp expr, RankedAlphabetSort outputAlph, List<FastToken> children, int from, List<string> reachedStates, List<Def> queue, Dictionary<string, Def> defs, FastTransducerInstance fti, List<int>[] nextStatesL)
 {
     switch (expr.kind)
     {
         case (FExpKind.App):
             return GenerateZ3ToExpr((AppExp)expr, outputAlph, children, from, reachedStates, queue, defs, fti, nextStatesL);
         case (FExpKind.Value):
             return GenerateZ3ToExpr((Value)expr, outputAlph);
         case (FExpKind.Var):
             return GenerateZ3ToExpr((Variable)expr, outputAlph, children);
     }
     return null;
 }
示例#3
0
 public TreeAppDef(FastToken acc, FastToken alphabet, BuiltinTransExp tran, FExp tree)
     : base(acc, alphabet, TreeDefKind.Apply)
 {
     this.transducer = tran;
     this.expr = tree;
 }
示例#4
0
 public TreeExpDef(FastToken acc, FastToken alphabet, FExp expr)
     : base(acc, alphabet, TreeDefKind.Tree)
 {
     this.expr = expr;
 }
示例#5
0
 public GuardedExp(Pattern pat, FExp where, List<FExp> given, FExp to)
 {
     this.pat = pat;
     this.where = where;
     this.given = given;
     this.to = to;
 }
示例#6
0
 public void AddGivenCase(FExp gc)
 {
     given.Add(gc);
 }
示例#7
0
        public FunctionDef(FastToken name, List<KeyValuePair<FastToken, FastSort>> vars, FastSort outputSort, FExp expr)
            : base(DefKind.Function)
        {
            this.name = name;
            this.outputSort = outputSort;
            this.expr = expr;

            inputVariables = vars;
            var domain = new List<FastSort>();
            foreach (var kv in vars)
            {
                if (varSortMap.ContainsKey(kv.Key.text))
                    throw new FastParseException(kv.Key.Location, string.Format("Duplicate parameter ID '{0}'", kv.Key.text));
                FastSort s = kv.Value;
                varSortMap[kv.Key.text] = s;
                domain.Add(s);
            }
            this.sort = new FunctionSort(this.name, domain, this.outputSort);
        }
示例#8
0
 public GuardedExp(Pattern pat)
 {
     this.pat = pat;
     this.where = BoolValue.True;
     this.given = new List<FExp>();
     given.Add(BoolValue.True);
     this.to = null;
 }
示例#9
0
 public ContainsQueryDef(FastToken print, BuiltinLangExp lang, FExp tree)
     : base(print)
 {
     this.language = lang;
     this.expr = tree;
 }
示例#10
0
 public ConstDef(FastToken name, FastToken sort, FExp expr)
     : base(DefKind.Const)
 {
     this.name = name;
     this.sort = FastSort.GetSort(sort);
     this.expr = expr;
 }
示例#11
0
 //Generates the code for an output of a transduction
 private static bool PrintOutputTree(List<FastToken> children, FExp ex, String range, StringBuilder sb, bool isapplied)
 {
     switch (ex.kind)
     {
         case (FExpKind.App):
             {
                 PrintOutputTree(children, (AppExp)ex, range, sb, isapplied);
                 break;
             }
         case (FExpKind.Var):
             {
                 PrintOutputTree(children, (Variable)ex, range, sb, isapplied);
                 break;
             }
     }
     return true;
 }
示例#12
0
 //Generates the code for an expression
 private static bool PrintExpr(List<FastToken> children, FExp ex, StringBuilder sb)
 {
     switch (ex.kind)
     {
         case (FExpKind.App):
             {
                 PrintExpr(children, (AppExp)ex, sb);
                 break;
             }
         case (FExpKind.Value):
             {
                 PrintExpr(children, (Value)ex, sb);
                 break;
             }
         case (FExpKind.Var):
             {
                 PrintExpr(children, (Variable)ex, sb);
                 break;
             }
     }
     return true;
 }
示例#13
0
        //Compute all the iterators necessary to generate a particular output of a transduction
        //The iterators are saved inside iterCases ([[x,f],[y,g]] means we will have to precompute f(x) and g(x))
        private static bool ComputeIterators(FExp ex, String range, StringBuilder sb, bool isApplied)
        {
            switch (ex.kind)
            {
                case (FExpKind.App):
                    return ComputeIterators((AppExp)ex, range, sb, isApplied);

                case (FExpKind.Var):
                    return ComputeIterators((Variable)ex, range, sb, isApplied);
            }
            return false;
        }