options {
  IGNORE_CASE=true;
  MULTI=true;	// This will generate one AST class for each non-suppressed non-terminal
  VISITOR=true;	// This won't be used until the next assignment, but will be needed to make your assignment compile properly
  JJTREE_OUTPUT_DIRECTORY="AST";  // This will put all your AST classes in the AST directory
  
}

PARSER_BEGIN(HL)

public class HL {
}

PARSER_END(HL)

TOKEN_MGR_DECLS : 
{
}

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

TOKEN : 
{
	< PRINT:"PRINT">
|	< INTEGER:	(["0"-"9"])+ >
}


// ===========================================================================
//                                 P A R S E R   
// ===========================================================================

SimpleNode start	()  :
{}
{  statement()  { return (SimpleNode) (jjtree.popNode()); }
| < EOF > {throw new ParseException("End of File.");}
}

void statement()  :
{}
{ assignment() ";" 
| print_stat() ";"
}

void assignment  () :
{}
{  Identifier() "=" expression()
}

void print_stat() :
{}
{	<PRINT> expression() 
}

void expression() :
{}
{  term() ("+" term())*
}

void term()  :
{}
{	Identifier()
| <INTEGER>
}

void Identifier()  :
{}
{ "a"  
| "b"  
| "c"  
}