mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
Merge "Add associativity rules to the lexer"
This commit is contained in:
@@ -49,15 +49,22 @@ void poincare_expression_yyerror(yyscan_t scanner, Expression ** expressionOutpu
|
||||
%token <string> INTEGER
|
||||
%token <string> SYMBOL
|
||||
|
||||
/* Operator tokens */
|
||||
%token PLUS
|
||||
%token MINUS
|
||||
%token MULTIPLY
|
||||
%token DIVIDE
|
||||
%token POW
|
||||
|
||||
%token LEFT_PARENTHESIS
|
||||
%token RIGHT_PARENTHESIS
|
||||
|
||||
/* Make the operators left associative.
|
||||
* This makes 1 - 2 - 5’ be ‘(1 - 2) - 5’ instead of ‘1 - (2 - 5)’.
|
||||
* This makes 1 / 2 / 5’ be ‘(1 / 2) / 5’ instead of ‘1 / (2 / 5)’.
|
||||
*/
|
||||
%left '-' '+'
|
||||
%left '*' '/'
|
||||
|
||||
/* The "exp" symbol uses the "expression" part of the union. */
|
||||
%type <expression> exp;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user