Beispiel #1
0
    public static void Main(String[] args)
    {
        Lexer  l = new Lexer(new StreamReader(args[0]));
        Parser p = new Parser(l);
        Start  s = p.Parse();

        TextPrinter printer = new TextPrinter();

        if (args.Length > 0 && args[0] == "-ansi")
        {
            printer.SetColor(true);
        }

        //s.Apply(printer);

        int indexOfLastDot  = args[0].LastIndexOf('.');
        int extensionLength = args[0].Length - indexOfLastDot;

        string output = args[0].Remove(indexOfLastDot, extensionLength);

        CodeGenerator cg = new CodeGenerator(new StreamWriter(output + ".il"));

        //CodeGenerator cg = new CodeGenerator(Console.Out);
        s.Apply(cg);

        //comment out later
        // Console.ReadLine();
    }
Beispiel #2
0
    public static void Main(String[] args)
    {
        Lexer  l = new Lexer(Console.In);
        Parser p = new Parser(l);
        Start  s = p.Parse();

        TextPrinter printer = new TextPrinter();

        if (args.Length > 0 && args[0] == "-ansi")
        {
            printer.SetColor(true);
        }

        s.Apply(printer);
    }
Beispiel #3
0
    public static void Main(String[] args)
    {
        Lexer  l = new Lexer(new StreamReader(args[0]));
        Parser p = new Parser(l);

        Start s = p.Parse();

        TextPrinter printer = new TextPrinter();

        if (args.Length > 0 && args[0] == "-ansi")
        {
            printer.SetColor(true);
        }

        s.Apply(printer);

        SemanticAnalyzer sa = new SemanticAnalyzer();

        s.Apply(sa);
        //Console.WriteLine("Press anykey to close...");
        //Console.ReadKey();
    }