Help on using Appel's 'ErrorMsg.java'
- From: "Cormac Redmond" <redmonc4@xxxxxxxxxxx>
- Date: 5 Dec 2006 16:50:36 -0800
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
.
- Follow-Ups:
- Re: Help on using Appel's 'ErrorMsg.java'
- From: Cormac Redmond
- Re: Help on using Appel's 'ErrorMsg.java'
- Prev by Date: Need Help with Troublesome Production
- Next by Date: JavaCC sometimes generates "missing return statement in function"
- Previous by thread: Need Help with Troublesome Production
- Next by thread: Re: Help on using Appel's 'ErrorMsg.java'
- Index(es):