PARSER_BEGIN(LogParser) public class LogParser { public static void main(String[] args) { try { LogParser parser = new LogParser(System.in); parser.allLines(); } catch (ParseException e) { System.out.println("Error: This is not a valid file."); } } } PARSER_END(LogParser) TOKEN: { < ENTRY: "entry" > | < EXIT: "exit" > | < ALARM: "alarm" > | < NUM: (["0"-"9"])+ > | < CRLF: (["\r","\n"])+ > | < WORD: (["a"-"z", "A"-"Z", ",", "0"-"9", "-"])+ > | < SPC: ([" ", "\t"])+ > } void allLines(): {} { (anyLine())* } void anyLine(): {} { lineOfText() ( | ) } void lineOfText(): {} { entryLine() | exitLine() | alarmLine() } void entryLine(): {} { dateTime() restOfLine() } void exitLine(): {} { dateTime() restOfLine() } void alarmLine(): {} { dateTime() restOfLine() } void dateTime(): {} { } void restOfLine(): {} { ( | )* }