PARSER_BEGIN(Q1) class Q1 { /** Standard code to call the parser */ public static void main(String args[]) { Q1 parser; System.out.println("Reading from standard input . . ."); parser = new Q1(System.in); try { parser.s(); System.out.println("Yes"); } catch (TokenMgrError e) { // Lexical error System.out.println("No"); } catch (ParseException e) { // Parsing error System.out.println("No"); } } /* End of function "main" */ } PARSER_END(Q1) /******************/ /***** TOKENS *****/ /******************/ SKIP : /* WHITE SPACE */ { " " | "\t" | "\n" | "\r" | "\f" } TOKEN : { < SEMI : ";" > | < COLON : ":" > | < COMMA : "," > | < ID : ()+ > | < #LETTER : ["a"-"z","A"-"Z"] > } /*************************/ /***** GRAMMAR RULES *****/ /*************************/ void s () : {} { d() } void d () : {} { i() [ d()] } void i() : {} { ( )* }