[antlr-interest] Compiler Issue (Eclipse 3.1.2 / Antlr Studio 1.1)

Dominik Holenstein dholenstein at gmail.com
Fri Mar 24 01:21:21 PST 2006


I am very new to Eclipse, Java and ANTLR. So my question is a very basic one
but after looking for a solution for several hours I want to ask you whether
you can help me:

This is my grammar file:

header {
class XMLParser extends Parser;

  : name:NAME
  {System.out.println("Name: "+name.getText());} ;

class XMLLexer extends Lexer;
NAME: ('a'..'z'|'A'..'Z'|'0'..'9')+ NEWLINE;
    :   '\r' '\n'   // DOS   ;

And this is my Main.java file:

import java.io.*;

class Main {
 public static void main(String[] args) {
  try {
        XMLLexer lexer = new XMLLexer(new DataInputStream(System.in));  /*
Problem see below
        XMLParser parser = new
XMLParser(lexer);                                      /* Problem see below

  catch(Exception e) {
   System.err.println("exception: "+e);

This is the system I am working with:
- Windows XP
- Eclipse 3.1.2
- ANTLR Studio 1.1

When I want to run the application (Run -> Run as -> Java Application) I get
this very nice messages in the console view of Eclipse:

Exception in thread "main" java.lang.Error: Unresolved compilation problems:

 XMLLexer cannot be resolved to a type
 XMLLexer cannot be resolved to a type
 XMLParser cannot be resolved to a type
 XMLParser cannot be resolved to a type

 at Main.main(Main.java:7)

Where do I have to look at to solve this issue?
- java or antlr code files?
- classpath and variables settings?
- other project settings?
- other ideas?

I know it is a  very basic question but I appreciate any help very much.
My plans are to develop a simple XML parser first just for learning

Kind regards,

Zurich, Switzerland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060324/49b78c75/attachment.html

More information about the antlr-interest mailing list