Exemple #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));
    }
Exemple #2
0
        public TablesForm(Syntactic syntactic, Semantic semantic)
        {
            _semantic   = semantic;
            _syntactic  = syntactic;
            _llanalyser = new LLParser(_semantic, _syntactic);
            _lrParser   = new LRParser(_semantic, _syntactic);
            _slrParser  = new SLRParser(_semantic, _syntactic);
            _lalrParser = new LALRParser(_semantic, _syntactic);

            InitializeComponent();
        }
Exemple #3
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);
    }