LARA

options {
  JAVA_UNICODE_ESCAPE = true;
}

PARSER_BEGIN(Polynomials)
  public class Polynomials {}
PARSER_END(Polynomials)


// Insert a specification of a lexical analysis here. 

TOKEN: {
    <IDENTIFIER: <LETTER> (<LETTER> | <DIGIT> | "_")* >
  | <CONSTANT: <DIGIT> (<DIGIT>)* >
  | <LETTER: ["a"-"z"] | ["A"-"Z"]>
  | <DIGIT: ["0"-"9"]>
}

SKIP: {
   " "
 | "\n"
 | "\t"
}

// The following is a simple grammar that will allow you
// to test the generated lexer.

void Goal():
{}
{
  ( MyToken() )*
  <EOF>
}

void MyToken():
{}
{
   <IDENTIFIER> | <CONSTANT> | "+" | "-" | "*" |  "(" | ")"
}