using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using OCamlC; using OCamlC.Lex; using OCamlC.AST; namespace StandaloneLexer { class Program { static int Main(string[] args) { try { string file = args[0]; using (LocatedFileReader reader = new LocatedFileReader(file)) { try { Lexer lex = new Lexer(); foreach (Terminal token in lex.Lex(reader)) { Console.WriteLine(token); } } catch (CantLexException) { throw; } catch (Exception e) { throw new CantLexException(reader.CurrentLocation, String.Format("Unexpected lexer error: {0}", e.Message), e); } } return 0; } catch (Exception e) { Console.WriteLine("Syntax error: {0}", e.Message); Console.WriteLine(e.StackTrace); return 2; } } } }