Example #1
0
        private static void RunSemanticPasses(Node root)
        {
            var mgr = new ScopeManager();

            var first  = new FirstPass(root, mgr);
            var second = new SecondPass(root, mgr);

            first.Run();
            second.Run();
        }
        private static void RunSemanticPasses(Node root)
        {
            var mgr = new ScopeManager();

            var first = new FirstPass(root, mgr);
            var second = new SecondPass(root, mgr);
            first.Run();
            second.Run();
        }
        private static void CompileAndBuildExecutable()
        {
            var scan = new Scanner();
            scan.SetSource(File.ReadAllText(FILE_LOCATION), 0);

            var parser = new Parser(scan);
            parser.Parse();

            var root = parser.SyntaxTreeRoot;
            var mgr = new ScopeManager();

            var first = new FirstPass(root, mgr);
            var second = new SecondPass(root, mgr);
            first.Run();
            second.Run();

            const string asmName = "sample1-test";
            var cg = new CodeGenerator(asmName);
            cg.Generate(root);
            cg.WriteAssembly();
        }