예제 #1
0
        public AsmCode(PascalProgram program)
        {
            GenerateSubprogramHeader(program.Block);
            var mainLabel = new AsmLabel("main");

            Add(mainLabel);
            program.Block.Generate(this);
            Add(new AsmSpecial("exit"));
            GenerateSubprograms(program.Block);
            Add(new AsmSpecial($"END {mainLabel.ToArgString()}"));
        }
예제 #2
0
 public static void Optimize(PascalProgram program)
 {
     OptimizeBlock(program.Block);
 }
 public static void PrintProgram(StreamWriter writer, PascalProgram program)
 {
     writer.WriteLine($"program {program.Name.Name}");
     PrintBlock(writer, program.Block, "");
 }