Image of Jeremy Bennett

Home > Publications > Download

Jeremy Bennett

Introduction to Compiler Techniques

Software Download

Feel free to use this code in conjunction with the textbook, or for other uses where you feel it would be helpful. There is no explicit separate license for this software alone, but I should appreciate being cited as the source if you do use it.

Note.The code is listed in the textbook, which is copyright McGraw-Hill International (UK) Limited. Please act appropriately if you wish to publish extracts from this code.

The code is available in ZIP format for download.Comments about the book or code are welcome and should be sent to the author at jeremy@jeremybennett.com. The file compiler.txt contains corrections to the text of the book, and the file bugs.txt contains reports of bugs in the code.

To date only one correction has been reported for the second edition of the book.

  • John Dance, dance@be.com. There appears to be a bug on pages 70-71 of your book (second edition).


    yytext[0] = ch ;
    .
    for ( i = 0 ; isupper(ch = getchar()) ; yytext[i++] = ch )
    ;
    .
    yytext[i++] = 0;
    .
    .
    return lookup_reserved( yytext );

    The second character of the keyword will over write the first since yytext[0] is written explicitly and then yytext[0] is written again at the end of the for loop. Changing the initialization of i to 1 will fix this. Or changing the post-increment to a pre-increment both in the loop and in the setting of EOS would also work.

Other corrections to the second edition will be added to this page as they are received.