Example #1
0
/* 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());
    }
  }
Example #2
0
        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);
            }
        }
Example #3
0
File: asm.cs Project: ydunk/masters
        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());
        }
Example #4
0
        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
        }
Example #5
0
 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
 }
Example #7
0
public Emit(Io o)
  {
  io = o;
  exe = new Exe(Io.GetClassname());
  }
Example #8
0
 public Asm(Io ihandle)
   {
   io = ihandle;
   }
Example #9
0
public Parse(Io i, Tok t)
  {
  io = i;
  tok = t;
  staticvar = new VarList();	// init the static variables list
  }
Example #10
0
File: asm.cs Project: ydunk/masters
 public Asm(Io ihandle)
 {
     io = ihandle;
 }
Example #11
0
 public Emit(Io o)
 {
     io  = o;
     exe = new Exe(Io.GetClassname());
 }