// gcom.gr
// parser for guarded command example language

// the parser context class is useful in large examples;
// an empty one will suffice here
context_class GCom : public UserActions {
public:
  // empty for now
};

// pull in the tokens generated from lexer.h
terminals {
  include("tokens.tok")

  precedence {
    left  20 "*";        // high precedence, left associative
    left  10 "+" "-";    // low precedence, left associative
  }
}

// now the grammar

nonterm AExp {
  -> TOK_LITERAL;
  -> TOK_IDENTIFIER;
  -> AExp "+" AExp;
  -> AExp "-" AExp;
  -> AExp "*" AExp;
  -> "(" AExp ")";
}

