/* main program */ public static void Main() { try { String[] args = Environment.GetCommandLineArgs(); Io prog = new Io(args); Tok tok = new Tok(prog); Parse p = new Parse(prog, tok); p.program(); prog.Finish(); } catch (Exception e) { Console.WriteLine("Compiler aborting: "+e.ToString()); } }
public void BeginModule(string ifile) { appdomain = System.Threading.Thread.GetDomain(); appname = getAssemblyName(filename); appbuild = appdomain.DefineDynamicAssembly(appname, AssemblyBuilderAccess.Save, Io.genpath); emodule = appbuild.DefineDynamicModule( filename + "_module", Io.GetOutputFilename(), Io.gendebug); Guid g = System.Guid.Empty; if (Io.gendebug) { srcdoc = emodule.DefineDocument(ifile, g, g, g); } }
private String genFieldRef(Var e) { if (e == null) { return(null); } StringBuilder sb = new StringBuilder(MyC.MAXSTR); if (e.getSign() == Tok.T_UNSIGNED) /* if var is unsigned, put it in sig */ { sb.Append("unsigned "); } sb.Append(ilSType(e.getTypeId())); /* get the datatype */ sb.Append(" "); sb.Append(Io.GetClassname()); /* get the current classname */ sb.Append("."); sb.Append(e.getName()); /* copy the variable name */ return(sb.ToString()); }
public void Call(IAsm a) { Var func = a.getVar(); Object o = func.getMethodBuilder(); // get previous declared reference if (o == null) { Io.ICE("No previous extern for (" + func.getName() + ")"); } MethodBuilder mb = (MethodBuilder)o; // il.Emit(OpCodes.Ldc_I4_0); // push 0 for the "this" ptr // VarList x = func.getParams(); /* get any params */ // if (x.Length() > 0) // { // int max = x.Length(); // for (int i = 0; i < max; i++) // { // Var e = x.FindByIndex(i); // genLoad(e); // } // } il.Emit(OpCodes.Call, mb); // call the MethodBuilder }
public Tok(Io ihandle) { io = ihandle; InitHash(); // initialize the tokens hashtable io.ReadChar(); scan(); }
public Parse(Io i, Tok t) { io = i; tok = t; staticvar = new VarList(); // init the static variables list }
public Emit(Io o) { io = o; exe = new Exe(Io.GetClassname()); }
public Asm(Io ihandle) { io = ihandle; }