[antlr-interest] unexpected char exception

jean.morissette666 at videotron.ca jean.morissette666 at videotron.ca
Sat Feb 26 13:00:52 PST 2005

I'm an Antlr newbie.  Could you tell me why I have this error and how to 
resolve it:

exception: line 1:1: unexpected char: 'a'

Here is my grammar:

class P extends Parser;

    :   "abc"

class L extends Lexer;

    :	'\n'

And my test case:

import java.io.*;

class AntlrTest {
  public static void main(String[] args) {
	try {
	  String s = "abc";

	  L lexer = new L(new StringReader(s));
	  P parser = new P(lexer);
	} catch(Exception e) {
	  System.err.println("exception: "+e);

Thank for your help

More information about the antlr-interest mailing list