Пример #1
0
 public GSharpMethod(string name, int parameterCount, int localCount, GSharpModule module) : base("Method")
 {
     Name             = name;
     Parameters       = new Dictionary <string, int>();
     ParameterCount   = parameterCount;
     LocalCount       = localCount;
     Module           = module;
     IsInstanceMethod = false;
 }
Пример #2
0
 public static GSharpModule CompileModule(string file)
 {
     if (FindModule(file) != null)
     {
         Node         abstractSyntaxTree = (new Parser(new Tokenizer(File.ReadAllText(FindModule(file))).Lex())).Parse();
         SymbolTable  symbolTable        = (new SemanticAnalyser()).Analyse(abstractSyntaxTree);
         GSharpModule module             = (new GSharpCompiler(symbolTable)).CompileAst(abstractSyntaxTree);
         return(module);
     }
     else
     {
         throw new System.Exception("Invalid module file " + file + ".");
     }
 }