Beispiel #1
0
 internal Generator(string nsp, string path, TotemGrammar grammar)
 {
     assembly = universe.DefineDynamicAssembly(new IKVM.Reflection.AssemblyName(nsp), AssemblyBuilderAccess.Save);
     module   = assembly.DefineDynamicModule(nsp, path);
     LoadAll();
     this.nsp     = nsp;
     this.path    = path;
     this.grammar = grammar;
 }
Beispiel #2
0
 static void Main(string[] args)
 {
     TotemGrammar tg = new TotemGrammar();
     Irony.Parsing.Parser parser = new Irony.Parsing.Parser(tg);
     var tree = parser.Parse(new StreamReader(File.OpenRead("test.pole")).ReadToEnd(), "test.pole");
     if (!tree.HasErrors())
     {
         var generator = new Generator("test", Path.Combine(Environment.CurrentDirectory, "test.exe"), tg);
         var rootNode = tree.Root;
         generator.GenerateProgram(rootNode);
         generator.Save();
     }
     else
     {
         Console.WriteLine("Error in input");
         Console.ReadLine();
     }
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            TotemGrammar tg = new TotemGrammar();

            Irony.Parsing.Parser parser = new Irony.Parsing.Parser(tg);
            var tree = parser.Parse(new StreamReader(File.OpenRead("test.pole")).ReadToEnd(), "test.pole");

            if (!tree.HasErrors())
            {
                var generator = new Generator("test", Path.Combine(Environment.CurrentDirectory, "test.exe"), tg);
                var rootNode  = tree.Root;
                generator.GenerateProgram(rootNode);
                generator.Save();
            }
            else
            {
                Console.WriteLine("Error in input");
                Console.ReadLine();
            }
        }