Exemplo n.º 1
0
Arquivo: Api.cs Projeto: ichaos/Shovel
        public static Value TestRunVm(List <SourceFile> sources)
        {
            var rawBytecode = Utils.GetRawBytecode(sources);
            var bytecode    = Utils.Assemble(rawBytecode);
            var vm          = Vm.Vm.RunVm(bytecode, sources);

            return(vm.CheckStackTop());
        }
Exemplo n.º 2
0
Arquivo: Api.cs Projeto: ichaos/Shovel
        public static Instruction[] GetBytecode(List <SourceFile> sources)
        {
            var rawBytecode = Utils.GetRawBytecode(sources);

            rawBytecode = Compiler.RawBytecodeOptimizations.Optimize(rawBytecode);
            var assembled = Utils.Assemble(rawBytecode);

            assembled = Compiler.AssembledBytecodeOptimizations.Optimize(assembled);
            Utils.SetBytecodeMd5(assembled, Utils.Md5AsString(Utils.ComputeBytecodeMd5(assembled)));
            return(assembled);
        }
Exemplo n.º 3
0
Arquivo: Api.cs Projeto: ichaos/Shovel
        public static string PrintRawBytecode(List <SourceFile> sources, bool optimize = false)
        {
            var bytecode = Utils.GetRawBytecode(sources);

            if (optimize)
            {
                bytecode = Compiler.RawBytecodeOptimizations.Optimize(bytecode);
            }
            Utils.DecorateByteCode(bytecode, sources);
            var sb = new StringBuilder();

            foreach (var instruction in bytecode)
            {
                sb.Append(instruction.ToString());
            }
            return(sb.ToString());
        }