Ejemplo n.º 1
0
        public void Write(VMCommand command, params int[] args)
        {
            content[index].Add(command.Id);
            foreach (var arg in args)
            {
                content[index].Add(arg);
            }

            if (DummyVM.Debug)
            {
                Console.WriteLine(index + ": " + command.Name + " " + string.Join(" ", args));
            }
        }
Ejemplo n.º 2
0
        public void AddFunction(string name, VMCommand command, IType returnType, params IType[] arguments)
        {
            if (command.ParameterCount != arguments.Length)
            {
                throw new Exception("Mismatching core function parameter count: " + name);
            }
            var fun = new ExprImpl(
                new TypeFunction(new TypeTuple(arguments), returnType),
                expressions.Function(new TypeTuple(arguments), new CoreFunction(command)));

            analyzer.Context.AddVariable(new Variable(name, fun.Type));
            fun.WriteTo(vmw);
            vmw.Write(VMCommand.CurrentContext);
            vmw.Write(VMCommand.AssignContextVariable, coreFunctions++);
        }
Ejemplo n.º 3
0
 public CoreFunction(VMCommand command)
 {
     this.command = command;
 }