Skip to content

Commit

Permalink
Definește precedența operatorilor
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielMajeri committed Apr 6, 2021
1 parent e2e91b9 commit 34c1f55
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tc/tema2/java-parser.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
%token LESS_THAN;
%token GREATER_THAN;

// Operator precedence
%left LESS_THAN GREATER_THAN;
%left PLUS MINUS;

%token <std::string> IDENTIFIER;
Expand Down Expand Up @@ -160,16 +162,14 @@ value:

%nterm expression;
expression:
expression binary_operator expression
expression PLUS expression
| expression MINUS expression
| expression LESS_THAN expression
| expression GREATER_THAN expression
| method_call
| name
| literal

%nterm binary_operator;
binary_operator:
PLUS | MINUS
| LESS_THAN | GREATER_THAN | EQUALS

%nterm <std::string> method_reference;
method_reference:
name
Expand Down

0 comments on commit 34c1f55

Please sign in to comment.