コード例 #1
0
        static void Main(string[] args)
        {
            var parser = new Parsers.Parser();
            var result = parser.Parse("5,7+8,9*42");

            Console.WriteLine(result);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            string program   = args[0];
            var    source    = File.ReadAllText(program);
            var    parser    = new Parsers.Parser();
            var    syntax    = parser.Parse(source);
            var    evaluator = new Evaluator();

            //Console.WriteLine("==== SYNTAX ====");
            //Console.WriteLine(syntax.PrettyPrint());
            //Console.WriteLine("==== OUTPUT ====");
            evaluator.run(syntax, program);
        }
コード例 #3
0
 static void Main(string[] args)
 {
     try {
         var source = File.ReadAllText("program.zep");
         var parser = new Parsers.Parser();
         var syntax = parser.Parse(source);
         Console.WriteLine("==== SYNTAX ====");
         Console.WriteLine(syntax.PrettyPrint());
         Console.WriteLine("==== OUTPUT ====");
         var evaluator = new Evaluator();
         evaluator.Evaluate(syntax);
     } catch (Exception ex) {
         Console.WriteLine(ex.Message);
     }
 }