/// <summary> /// Add intrinsic methods and globals to the symbol table /// </summary> public void AddIntrinsics() { ImportedModule mscorlib = ReferenceMscorlib(); ImportedModule runtime = ReferenceExternal("IrisRuntime.dll"); IrisType tVoid = IrisType.Void; IrisType tString = IrisType.String; IrisType tInt = IrisType.Integer; IrisType[] noParams = new IrisType[0]; FilePosition fp = FilePosition.Begin; if (mscorlib != null) { ImportGlobalField(fp, "$.emptystr", mscorlib, "System.String", "Empty"); ImportMethod(fp, "concat", mscorlib, "System.String", "Concat", false, tString, new IrisType[] { tString, tString }); ImportMethod(fp, "readln", mscorlib, "System.Console", "ReadLine", false, tString, noParams); ImportMethod(fp, "str", mscorlib, "System.Int32", "ToString", true, tString, noParams); ImportMethod(fp, "strcmp", mscorlib, "System.String", "Compare", false, tInt, new IrisType[] { tString, tString }); ImportMethod(fp, "writeln", mscorlib, "System.Console", "WriteLine", false, tVoid, new IrisType[] { tString }); } if (runtime != null) { ImportMethod(fp, "$.initstrarray", runtime, "IrisRuntime.CompilerServices", "InitStrArray", false, tVoid, new IrisType[] { IrisType.String.MakeArrayType() }); ImportMethod(fp, "rand", runtime, "IrisRuntime.CompilerServices", "Rand", false, tInt, noParams); } }