Esempio n. 1
0
    public CompiledModule Compile(string bhl, Types ts = null, bool show_ast = false, bool show_bytes = false)
    {
        if (ts == null)
        {
            ts = new Types();
        }
        //NOTE: we don't want to affect the original ts
        var ts_copy = ts.CloneGlobs();

        var mdl = new bhl.Module(ts_copy.globs, "", "");

        var front_res = Frontend.ProcessStream(mdl, bhl.ToStream(), ts_copy);

        if (show_ast)
        {
            AST_Dumper.Dump(front_res.ast);
        }
        var c  = new Compiler(ts_copy, front_res);
        var cm = c.Compile();

        if (show_bytes)
        {
            Dump(c);
        }
        return(cm);
    }