PPT Slide
import java_cup.runtime.*;
terminal String TITLE, AUTHOR, DATE, ISBN, PUBLISHER, 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 ::= TITLE:title SLASH AUTHOR:author SLASH DATE:date SLASH ISBN:isbn SLASH PUBLISHER:publisher EOL
{: System.out.println("<Book>");
System.out.println(" <Title>" + title + "</Title>");
System.out.println(" <Author>" + author + "</Author>");
System.out.println(" <Date>" + date + "</Date>");
System.out.println(" <ISBN>" + isbn + "</ISBN>");
System.out.println(" <Publisher>" + publisher + "</Publisher>");
System.out.println("</Book>");
end_data ::= /* empty */ {: System.out.println("</BookCatalogue>"); :}