Exemplo n.º 1
0
    public static TreeNode compile(string gfile, string ifile)  // SLR Parser
    {
        var       g      = new Grammar(gfile);
        SLRParser p      = new SLRParser(g);
        var       tokens = g.tokenize(ifile);

        return(p.parse(tokens));
    }
Exemplo n.º 2
0
    public static void compile(string srcfile, string asmfile, string objfile, string exefile)
    {
        var       g      = new Grammar(GrammarData.data, true);
        SLRParser p      = new SLRParser(g);
        var       tokens = g.tokenize(srcfile);
        TreeNode  root   = p.parse(tokens).Children[0];

        asmCode.Clear();
        labelCounter = 0;
        symtable     = new SymbolTable();
        stringPool   = new Dictionary <string, string>();
        programNodeCode(root);

        System.IO.File.WriteAllLines(asmfile, asmCode);
        ExeTools.ExeTools.Assemble(asmfile, objfile);
        ExeTools.ExeTools.Link(objfile, exefile);
    }