Beispiel #1
0
        // public int Line;
        // public int Column;

        public ExpressionProgram Lift()
        {
            var env   = new LiftEnvironment();
            var _this = Lift(env);

            return(new ExpressionProgram(new List <LiftedFunctionExpression>(env.Functions.Values), _this));
        }
Beispiel #2
0
        // public string Name;
        // public string ArgumentName;
        // public Type ArgumentType;
        // public Type ReturnType;
        // public Expression Body;
        // public Expression Recipient;

        public override Expression Lift(LiftEnvironment env)
        {
            Body = Body.Lift(env);

            var fv = Body.FreeVariables();

            fv.Remove(Name);
            fv.Remove(ArgumentName);

            var newName       = env.NewName(Name);
            var argumentNames = new List <string> {
                ArgumentName
            };

            argumentNames.AddRange(fv);

            var lf = new LiftedFunctionExpression(newName, argumentNames, ReturnType, Body);

            env.Functions[newName] = lf;

            env.LiftMap[Name] = new FunctionLiftSupport(newName, fv);
            Recipient         = Recipient.Lift(env);
            env.LiftMap.Remove(Name);

            return(Recipient);
        }
Beispiel #3
0
        // public string Name;
        // public Expression Argument;

        public override Expression Lift(LiftEnvironment env)
        {
            var support   = env.LiftMap[Name];
            var arguments = new List <Expression>()
            {
                Argument
            };

            foreach (var name in support.ExtraArguments)
            {
                arguments.Add(new VariableExpression(name));
            }
            var lc = new LiftedFunctionCallExpression(support.NewName, arguments);

            return(lc);
        }
Beispiel #4
0
        // public string Name;
        // public List<string> ArgumentName;
        // public List<Type> ArgumentType;
        // public Type ReturnType;
        // public Expression Body;

        public override Expression Lift(LiftEnvironment env)
        {
            throw new NotImplementedException();
        }
Beispiel #5
0
        // public string Name;
        // public Expression Expression;
        // public Expression Recipient;


        public override Expression Lift(LiftEnvironment env)
        {
            Expression = Expression.Lift(env);
            Recipient  = Recipient.Lift(env);
            return(this);
        }
Beispiel #6
0
 public abstract Expression Lift(LiftEnvironment env);
Beispiel #7
0
        // public bool Value;

        public override Expression Lift(LiftEnvironment env)
        {
            return(this);
        }
Beispiel #8
0
        // public BinaryOperator Operator;
        // public Expression Expression1;
        // public Expression Expression2;

        public override Expression Lift(LiftEnvironment env)
        {
            Expression1 = Expression1.Lift(env);
            Expression2 = Expression2.Lift(env);
            return(this);
        }