%{
#include <stdio.h>
%}

%token tBEGIN
%token tEND
%token tIF
%token tTHEN
%token tELSE
%token tASSIGN
%token tIDENTIFIER
%token tNUMBER

%start statement
%left '+'
%left '-'
%left '>'

%%

statement:   tIDENTIFIER tASSIGN expression
           | tIF expression tTHEN statement
           | tIF expression tTHEN statement tELSE statement
           | tBEGIN statements tEND
;

statements:  statement
           | statement ';' statements
;

expression:  tNUMBER
           | tIDENTIFIER
           | expression '+' expression
           | expression '-' expression
           | expression '>' expression
;

%%

int main()
{
  yyparse();
}

int yyerror(char *s)
{
  fprintf(stderr, "%s\n", s);
  return 0;
}

int yylex()
{
  return 0;
}
