PPT Slide
// Parse slash-delimited book data.
LineTerminator = \r|\n|\r\n
StringBuffer line = new StringBuffer();
private void add_identifier_to_buffer(String s) {
line.append("[" + yyline + ", " + yycolumn + "]" + s);
private void add_delimiter_to_buffer(String s) {
private void display_line() {
System.out.println(line.toString());
line = new StringBuffer(); /* Clear buffer */
{Field} { add_identifier_to_buffer(yytext()); }
{Slash} { add_delimiter_to_buffer("/"); }
{LineTerminator} { display_line(); }
We will print the location
[line, column] of each field