Adding Methods that may be Invoked
You can add methods to the parser which can be invoked in the rules section. This is done as shown below:
import java_cup.runtime.*;
action code {: … put initialization code here … :}
terminal String TITLE, AUTHOR, DATE, ISBN, PUBLISHER, SLASH, EOL;
non terminal bookCatalogue, start_data, books, book, start_book, title, author, date, isbn, publisher, end_book, end_data;
bookCatalogue ::= start_data books end_data