Ejemplo n.º 1
0
        public MondProgram Compile(Expression expression)
        {
            PushFrame();

            var context = MakeFunction(null);
            context.Function(expression.FileName, "#main");

            context.Enter();
            expression.Compile(context);
            context.LoadUndefined();
            context.Return();

            PopFrame();

            var length = PatchLabels();
            var bytecode = GenerateBytecode(length);
            var debugInfo = GenerateDebugInfo();

            return new MondProgram(bytecode, NumberPool.Items, StringPool.Items, debugInfo);
        }