Exemplo n.º 1
0
 public void Compile(CompilationEnvironment compilationEnvironment, Generator generator)
 {
     compilationEnvironment.DeclareLocal(_argument.Item1); // Formal argument name points to top of stack
     generator.Label(compilationEnvironment.GetFunctionLabel(_name));
     _body.Compile(compilationEnvironment, generator);
     generator.Emit(new Return(1));
 }
        public void Compile(CompilationEnvironment env, Generator gen)
        {
            foreach (Tuple <String, Type> arg in args)
            {
                env.DeclareLocal(arg.Item1);
            }

            gen.Label(env.GetFunctionLabel(fName));
            body.Compile(env, gen);
            gen.Emit(new Return(args.Count));

            /*
             * env.DeclareLocal(formArg.Fst); // Formal argument name points to top of stack
             * gen.Label(env.getFunctionLabel(fName));
             * body.Compile(env, gen);
             * gen.Emit(new RET(1));
             */
        }
Exemplo n.º 3
0
        public override void Compile(CompilationEnvironment env, Generator gen)
        {
            foreach (Expression arg in _args)
            {
                arg.Compile(env, gen);
                env.PushTemporary();
            }

            String fLabel = env.GetFunctionLabel(fName);

            gen.Emit(new Call(_args.Count, fLabel));

            foreach (var arg in _args)
            {
                env.PopTemporary();
            }

            /*
             * arg.Compile(env, gen);
             * String fLabel = env.getFunctionLabel(fName);
             * gen.Emit(new CALL(1, fLabel));
             */
        }
Exemplo n.º 4
0
 public override void Compile(CompilationEnvironment compilationEnvironment, Generator generator)
 {
     _arg.Compile(compilationEnvironment, generator);
     var label = compilationEnvironment.GetFunctionLabel(_name);
     generator.Emit(new Call(1, label));
 }