PPT Slide
import java_cup.runtime.*;
terminal String FIELD, SLASH, EOL;
non terminal bookCatalogue, start_data, books, book, end_data;
bookCatalogue ::= start_data books end_data
start_data ::= /* empty */ {: System.out.println("<?xml version='1.0'?>");
System.out.println("<BookCatalogue>"); :}
book ::= FIELD:f1 SLASH FIELD:f2 SLASH FIELD:f3 SLASH FIELD:f4 SLASH FIELD:f5 EOL
{: System.out.println("<Book>");
System.out.println(" <Title>" + f1 + "</Title>");
System.out.println(" <Author>" + f2 + "</Author>");
System.out.println(" <Date>" + f3 + "</Date>");
System.out.println(" <ISBN>" + f4 + "</ISBN>");
System.out.println(" <Publisher>" + f5 + "</Publisher>");
System.out.println("</Book>");
end_data ::= /* empty */ {: System.out.println("</BookCatalogue>"); :}