Help on using Appel's 'ErrorMsg.java'



Hi,

I'm writing a lexical analyser and parser as an assignment.
I wish to incorporate Appel's 'ErrorMsg.java' class to provde better
error-message reporting. However, I cannot find any concrete examples
of how to do so.
I know it's straight forward enough, but I don't know javacc in depth
enough to do this.

At the moment I have my .jj file which specifies the tokens and
grammar.
When compiled using javacc, I run the relevant file, and here is the
interesting bit:

try
{
parser.prog();
System.out.println("TigerParser: Program successfully parsed.");
}

catch(ParseException e)
{
System.out.println(e.getMessage());
System.out.println("TigerParser: Errors encountered during parse.");
}

prog() iterates through all the grammar.

Can anyone shed some light on how to incorporate ErrorMsg.java into
this??
Appel is the author of "Modern Compiler Implementation in Java".

Any help much appreciated.


Regards,

Cormac

.