aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChimrod <>2023-09-29 16:40:36 +0200
committerChimrod <>2023-09-29 17:22:59 +0200
commit93179b90d8b1006001ce53310a6b01ba9f673fb7 (patch)
treee10f37ceb84b6562dbf6b23941eca3cde44b0792 /lib
parent3d74fbfd4bd173ae1aac4bf808b00275d48c4be4 (diff)
New precedence test
Diffstat (limited to 'lib')
-rw-r--r--lib/expression_parser.messages360
-rw-r--r--lib/parser.mly2
-rw-r--r--lib/qsp_expression.mly3
-rw-r--r--lib/tokens.mly12
4 files changed, 189 insertions, 188 deletions
diff --git a/lib/expression_parser.messages b/lib/expression_parser.messages
index 5bcbd91..eaeec6c 100644
--- a/lib/expression_parser.messages
+++ b/lib/expression_parser.messages
@@ -25,11 +25,11 @@ main: LOCATION_START EOL L_PAREN INTEGER SET
## expression -> expression . MOD expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . GT expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . LT expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
+## expression -> expression . AND expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . GT EQUAL expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . LT EQUAL expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . EQUAL GT expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . EQUAL LT expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
-## expression -> expression . AND expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . OR expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
##
## The known suffix of the stack is as follows:
@@ -52,11 +52,11 @@ main: LOCATION_START EOL IF INTEGER SET
## expression -> expression . MOD expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
+## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . GT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . LT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . EQUAL GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . EQUAL LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . OR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## line_statement -> IF expression . COLUMN nonempty_list(EOL) list(line_statement) elif_else_body END option(IF) nonempty_list(EOL) [ STAR SET PLUS OBJ NO MINUS L_PAREN LOCATION_END LITERAL LET KEYWORD INTEGER IF IDENT FUNCTION END ELSE ELIF COMMENT COLUMN ACT ]
## line_statement -> IF expression . COLUMN nonempty_list(EOL) list(line_statement) elif_else_body END option(IF) nonempty_list(AMPERSAND) list(EOL) [ STAR SET PLUS OBJ NO MINUS L_PAREN LOCATION_END LITERAL LET KEYWORD INTEGER IF IDENT FUNCTION END ELSE ELIF COMMENT COLUMN ACT ]
@@ -94,11 +94,11 @@ main: LOCATION_START EOL ACT INTEGER SET
## expression -> expression . MOD expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
+## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . GT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . LT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . EQUAL GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . EQUAL LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . OR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## line_statement -> ACT expression . COLUMN nonempty_list(EOL) list(line_statement) empty_body END option(ACT) nonempty_list(EOL) [ STAR SET PLUS OBJ NO MINUS L_PAREN LOCATION_END LITERAL LET KEYWORD INTEGER IF IDENT FUNCTION END ELSE ELIF COMMENT COLUMN ACT ]
## line_statement -> ACT expression . COLUMN nonempty_list(EOL) list(line_statement) empty_body END option(ACT) nonempty_list(AMPERSAND) list(EOL) [ STAR SET PLUS OBJ NO MINUS L_PAREN LOCATION_END LITERAL LET KEYWORD INTEGER IF IDENT FUNCTION END ELSE ELIF COMMENT COLUMN ACT ]
@@ -189,10 +189,10 @@ main: LOCATION_START EOL IDENT AMPERSAND END
##
## Ends in an error in state: 175.
##
-## main -> list(after_location) LOCATION_START nonempty_list(EOL) list(line_statement) . LOCATION_END [ # ]
+## main -> list(before_location) LOCATION_START nonempty_list(EOL) list(line_statement) . LOCATION_END [ # ]
##
## The known suffix of the stack is as follows:
-## list(after_location) LOCATION_START nonempty_list(EOL) list(line_statement)
+## list(before_location) LOCATION_START nonempty_list(EOL) list(line_statement)
##
## WARNING: This example involves spurious reductions.
## This implies that, although the LR(1) items shown above provide an
@@ -234,11 +234,11 @@ main: LOCATION_START EOL INTEGER SET
## expression -> expression . MOD expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . GT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . LT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . EQUAL GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . EQUAL LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
-## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . OR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## single_instruction -> expression . [ EOL ELSE AMPERSAND ]
##
@@ -263,11 +263,11 @@ main: LOCATION_START EOL IF IDENT COLUMN EOL ELIF INTEGER SET
## expression -> expression . MOD expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
+## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . GT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . LT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . EQUAL GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . EQUAL LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . OR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
##
## The known suffix of the stack is as follows:
@@ -299,6 +299,18 @@ main: LOCATION_START EOL IF IDENT COLUMN EOL ELIF IDENT COLUMN EOL IDENT AMPERSA
Unclosed `ELIF` block.
+main: EOL STAR
+##
+## Ends in an error in state: 177.
+##
+## list(before_location) -> before_location . list(before_location) [ LOCATION_START ]
+##
+## The known suffix of the stack is as follows:
+## before_location
+##
+
+The context does not allow an instruction here.
+
main: LOCATION_START EOL R_PAREN
##
## Ends in an error in state: 7.
@@ -398,45 +410,9 @@ main: LOCATION_START EOL IDENT STAR STAR
<YOUR SYNTAX ERROR MESSAGE HERE>
-main: LOCATION_START EOL IDENT PLUS STAR
-##
-## Ends in an error in state: 29.
-##
-## expression -> expression PLUS . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## expression PLUS
-##
-
-<YOUR SYNTAX ERROR MESSAGE HERE>
-
-main: LOCATION_START EOL IDENT MOD STAR
-##
-## Ends in an error in state: 31.
-##
-## expression -> expression MOD . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## expression MOD
-##
-
-<YOUR SYNTAX ERROR MESSAGE HERE>
-
-main: LOCATION_START EOL IDENT MINUS STAR
-##
-## Ends in an error in state: 33.
-##
-## expression -> expression MINUS . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## expression MINUS
-##
-
-<YOUR SYNTAX ERROR MESSAGE HERE>
-
main: LOCATION_START EOL IDENT LT STAR
##
-## Ends in an error in state: 35.
+## Ends in an error in state: 39.
##
## expression -> expression LT . GT expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
## expression -> expression LT . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
@@ -448,21 +424,9 @@ main: LOCATION_START EOL IDENT LT STAR
<YOUR SYNTAX ERROR MESSAGE HERE>
-main: LOCATION_START EOL IDENT LT GT STAR
-##
-## Ends in an error in state: 36.
-##
-## expression -> expression LT GT . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## expression LT GT
-##
-
-<YOUR SYNTAX ERROR MESSAGE HERE>
-
main: LOCATION_START EOL IDENT GT STAR
##
-## Ends in an error in state: 38.
+## Ends in an error in state: 46.
##
## expression -> expression GT . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
## expression -> expression GT . EQUAL expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
@@ -473,21 +437,9 @@ main: LOCATION_START EOL IDENT GT STAR
<YOUR SYNTAX ERROR MESSAGE HERE>
-main: LOCATION_START EOL IDENT GT EQUAL STAR
-##
-## Ends in an error in state: 39.
-##
-## expression -> expression GT EQUAL . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## expression GT EQUAL
-##
-
-<YOUR SYNTAX ERROR MESSAGE HERE>
-
main: LOCATION_START EOL INTEGER EQUAL STAR
##
-## Ends in an error in state: 43.
+## Ends in an error in state: 51.
##
## expression -> expression EQUAL . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
## expression -> expression EQUAL . GT expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
@@ -499,78 +451,6 @@ main: LOCATION_START EOL INTEGER EQUAL STAR
<YOUR SYNTAX ERROR MESSAGE HERE>
-main: LOCATION_START EOL INTEGER EQUAL LT STAR
-##
-## Ends in an error in state: 44.
-##
-## expression -> expression EQUAL LT . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## expression EQUAL LT
-##
-
-<YOUR SYNTAX ERROR MESSAGE HERE>
-
-main: LOCATION_START EOL IDENT DIV STAR
-##
-## Ends in an error in state: 46.
-##
-## expression -> expression DIV . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## expression DIV
-##
-
-<YOUR SYNTAX ERROR MESSAGE HERE>
-
-main: LOCATION_START EOL INTEGER EQUAL GT STAR
-##
-## Ends in an error in state: 48.
-##
-## expression -> expression EQUAL GT . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## expression EQUAL GT
-##
-
-<YOUR SYNTAX ERROR MESSAGE HERE>
-
-main: LOCATION_START EOL IDENT LT EQUAL STAR
-##
-## Ends in an error in state: 52.
-##
-## expression -> expression LT EQUAL . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## expression LT EQUAL
-##
-
-<YOUR SYNTAX ERROR MESSAGE HERE>
-
-main: LOCATION_START EOL IDENT OR STAR
-##
-## Ends in an error in state: 55.
-##
-## expression -> expression OR . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## expression OR
-##
-
-<YOUR SYNTAX ERROR MESSAGE HERE>
-
-main: LOCATION_START EOL IDENT AND STAR
-##
-## Ends in an error in state: 57.
-##
-## expression -> expression AND . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## expression AND
-##
-
-<YOUR SYNTAX ERROR MESSAGE HERE>
-
main: LOCATION_START EOL KEYWORD L_PAREN INTEGER SET
##
## Ends in an error in state: 59.
@@ -587,11 +467,11 @@ main: LOCATION_START EOL KEYWORD L_PAREN INTEGER SET
## expression -> expression . MOD expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COMA AND ]
## expression -> expression . GT expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COMA AND ]
## expression -> expression . LT expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COMA AND ]
+## expression -> expression . AND expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COMA AND ]
## expression -> expression . GT EQUAL expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COMA AND ]
## expression -> expression . LT EQUAL expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COMA AND ]
## expression -> expression . EQUAL GT expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COMA AND ]
## expression -> expression . EQUAL LT expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COMA AND ]
-## expression -> expression . AND expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COMA AND ]
## expression -> expression . OR expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COMA AND ]
##
## The known suffix of the stack is as follows:
@@ -600,18 +480,6 @@ main: LOCATION_START EOL KEYWORD L_PAREN INTEGER SET
<YOUR SYNTAX ERROR MESSAGE HERE>
-main: LOCATION_START EOL IDENT EXCLAMATION STAR
-##
-## Ends in an error in state: 41.
-##
-## expression -> expression EXCLAMATION . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## expression EXCLAMATION
-##
-
-<YOUR SYNTAX ERROR MESSAGE HERE>
-
main: LOCATION_START EOL KEYWORD IDENT COMA INTEGER SET
##
## Ends in an error in state: 63.
@@ -626,11 +494,11 @@ main: LOCATION_START EOL KEYWORD IDENT COMA INTEGER SET
## expression -> expression . MOD expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . GT expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . LT expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
+## expression -> expression . AND expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . GT EQUAL expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . LT EQUAL expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . EQUAL GT expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . EQUAL LT expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
-## expression -> expression . AND expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . OR expression [ STAR R_PAREN PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## separated_nonempty_list(COMA,expression) -> expression . [ R_PAREN EOL ELSE AMPERSAND ]
## separated_nonempty_list(COMA,expression) -> expression . COMA separated_nonempty_list(COMA,expression) [ R_PAREN EOL ELSE AMPERSAND ]
@@ -689,11 +557,11 @@ main: LOCATION_START EOL IDENT L_BRACKET INTEGER SET
## expression -> expression . MOD expression [ STAR R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . GT expression [ STAR R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . LT expression [ STAR R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
+## expression -> expression . AND expression [ STAR R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . GT EQUAL expression [ STAR R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . LT EQUAL expression [ STAR R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . EQUAL GT expression [ STAR R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . EQUAL LT expression [ STAR R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
-## expression -> expression . AND expression [ STAR R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## expression -> expression . OR expression [ STAR R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV AND ]
## option(expression) -> expression . [ R_BRACKET ]
##
@@ -748,11 +616,11 @@ main: LOCATION_START EOL SET IDENT DECR INTEGER SET
## expression -> expression . MOD expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . GT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . LT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . EQUAL GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . EQUAL LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
-## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . OR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## let_assignation -> SET variable assignation_operator expression . [ EOL ELSE AMPERSAND ]
##
@@ -819,11 +687,11 @@ main: LOCATION_START EOL LET IDENT DECR INTEGER SET
## expression -> expression . MOD expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . GT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . LT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . EQUAL GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . EQUAL LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
-## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . OR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## let_assignation -> LET variable assignation_operator expression . [ EOL ELSE AMPERSAND ]
##
@@ -958,11 +826,11 @@ main: LOCATION_START EOL IDENT DECR INTEGER SET
## expression -> expression . MOD expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . GT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . LT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . EQUAL GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . EQUAL LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
-## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## expression -> expression . OR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
## let_assignation -> variable assignation_operator expression . [ EOL ELSE AMPERSAND ]
##
@@ -1047,11 +915,11 @@ main: LOCATION_START EOL KEYWORD INTEGER SET
## expression -> expression . MOD expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
+## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . GT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . LT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . EQUAL GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . EQUAL LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
-## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## expression -> expression . OR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA AND AMPERSAND ]
## qsp_instruction_argument(expression) -> expression . [ EOL ELSE AMPERSAND ]
##
@@ -1221,11 +1089,11 @@ main: LOCATION_START EOL ACT IDENT COLUMN IF INTEGER SET
## expression -> expression . MOD expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
+## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . GT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . LT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . EQUAL GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . EQUAL LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . OR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## onliner(IF) -> IF expression . COLUMN final_inline_instruction [ EOL ELSE AMPERSAND ]
##
@@ -1261,11 +1129,11 @@ main: LOCATION_START EOL ACT IDENT COLUMN ACT INTEGER SET
## expression -> expression . MOD expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
+## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . GT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . LT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . EQUAL GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . EQUAL LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## expression -> expression . OR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
## onliner(ACT) -> ACT expression . COLUMN final_inline_instruction [ EOL ELSE AMPERSAND ]
##
@@ -1380,26 +1248,14 @@ main: LOCATION_START EOL IF IDENT COLUMN EOL END IF STAR
<YOUR SYNTAX ERROR MESSAGE HERE>
-main: EOL STAR
-##
-## Ends in an error in state: 177.
-##
-## list(after_location) -> after_location . list(after_location) [ LOCATION_START ]
-##
-## The known suffix of the stack is as follows:
-## after_location
-##
-
-The context does not allow an instruction here.
-
main: LOCATION_START STAR
##
## Ends in an error in state: 6.
##
-## main -> list(after_location) LOCATION_START . nonempty_list(EOL) list(line_statement) LOCATION_END [ # ]
+## main -> list(before_location) LOCATION_START . nonempty_list(EOL) list(line_statement) LOCATION_END [ # ]
##
## The known suffix of the stack is as follows:
-## list(after_location) LOCATION_START
+## list(before_location) LOCATION_START
##
<YOUR SYNTAX ERROR MESSAGE HERE>
@@ -1408,10 +1264,10 @@ main: LOCATION_START EOL END
##
## Ends in an error in state: 9.
##
-## main -> list(after_location) LOCATION_START nonempty_list(EOL) . list(line_statement) LOCATION_END [ # ]
+## main -> list(before_location) LOCATION_START nonempty_list(EOL) . list(line_statement) LOCATION_END [ # ]
##
## The known suffix of the stack is as follows:
-## list(after_location) LOCATION_START nonempty_list(EOL)
+## list(before_location) LOCATION_START nonempty_list(EOL)
##
## WARNING: This example involves spurious reductions.
## This implies that, although the LR(1) items shown above provide an
@@ -1450,10 +1306,154 @@ main: COMMENT STAR
##
## Ends in an error in state: 2.
##
-## after_location -> COMMENT . EOL [ LOCATION_START EOL COMMENT ]
+## before_location -> COMMENT . EOL [ LOCATION_START EOL COMMENT ]
##
## The known suffix of the stack is as follows:
## COMMENT
##
<YOUR SYNTAX ERROR MESSAGE HERE>
+
+main: LOCATION_START EOL IDENT MOD STAR
+##
+## Ends in an error in state: 29.
+##
+## expression -> expression MOD . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## expression MOD
+##
+
+<YOUR SYNTAX ERROR MESSAGE HERE>
+
+main: LOCATION_START EOL IDENT PLUS STAR
+##
+## Ends in an error in state: 31.
+##
+## expression -> expression PLUS . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## expression PLUS
+##
+
+<YOUR SYNTAX ERROR MESSAGE HERE>
+
+main: LOCATION_START EOL IDENT DIV STAR
+##
+## Ends in an error in state: 33.
+##
+## expression -> expression DIV . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## expression DIV
+##
+
+<YOUR SYNTAX ERROR MESSAGE HERE>
+
+main: LOCATION_START EOL IDENT OR STAR
+##
+## Ends in an error in state: 35.
+##
+## expression -> expression OR . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## expression OR
+##
+
+<YOUR SYNTAX ERROR MESSAGE HERE>
+
+main: LOCATION_START EOL IDENT MINUS STAR
+##
+## Ends in an error in state: 37.
+##
+## expression -> expression MINUS . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## expression MINUS
+##
+
+<YOUR SYNTAX ERROR MESSAGE HERE>
+
+main: LOCATION_START EOL IDENT LT GT STAR
+##
+## Ends in an error in state: 40.
+##
+## expression -> expression LT GT . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## expression LT GT
+##
+
+<YOUR SYNTAX ERROR MESSAGE HERE>
+
+main: LOCATION_START EOL IDENT EXCLAMATION STAR
+##
+## Ends in an error in state: 42.
+##
+## expression -> expression EXCLAMATION . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## expression EXCLAMATION
+##
+
+<YOUR SYNTAX ERROR MESSAGE HERE>
+
+main: LOCATION_START EOL IDENT LT EQUAL STAR
+##
+## Ends in an error in state: 44.
+##
+## expression -> expression LT EQUAL . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## expression LT EQUAL
+##
+
+<YOUR SYNTAX ERROR MESSAGE HERE>
+
+main: LOCATION_START EOL IDENT GT EQUAL STAR
+##
+## Ends in an error in state: 47.
+##
+## expression -> expression GT EQUAL . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## expression GT EQUAL
+##
+
+<YOUR SYNTAX ERROR MESSAGE HERE>
+
+main: LOCATION_START EOL INTEGER EQUAL LT STAR
+##
+## Ends in an error in state: 52.
+##
+## expression -> expression EQUAL LT . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## expression EQUAL LT
+##
+
+<YOUR SYNTAX ERROR MESSAGE HERE>
+
+main: LOCATION_START EOL INTEGER EQUAL GT STAR
+##
+## Ends in an error in state: 54.
+##
+## expression -> expression EQUAL GT . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## expression EQUAL GT
+##
+
+<YOUR SYNTAX ERROR MESSAGE HERE>
+
+main: LOCATION_START EOL IDENT AND STAR
+##
+## Ends in an error in state: 57.
+##
+## expression -> expression AND . expression [ STAR R_PAREN R_BRACKET PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV COMA COLUMN AND AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## expression AND
+##
+
+<YOUR SYNTAX ERROR MESSAGE HERE>
diff --git a/lib/parser.mly b/lib/parser.mly
index a0a45e6..9b5297c 100644
--- a/lib/parser.mly
+++ b/lib/parser.mly
@@ -5,7 +5,7 @@
%parameter<Analyzer: Qsp_syntax.S.Analyzer>
%start <Analyzer.Location.repr>main
-%on_error_reduce expression instruction
+%on_error_reduce expression instruction binary_operator unary_operator
%%
diff --git a/lib/qsp_expression.mly b/lib/qsp_expression.mly
index 3d758c4..06cfadd 100644
--- a/lib/qsp_expression.mly
+++ b/lib/qsp_expression.mly
@@ -36,7 +36,6 @@
op = binary_operator
expr2 = expression
{ Analyzer.Expression.boperator $loc op expr1 expr2 }
- %prec EQUAL
| v = LITERAL { Analyzer.Expression.literal $loc v }
| i = INTEGER { Analyzer.Expression.integer $loc i }
| v = variable { Analyzer.Expression.ident v }
@@ -64,11 +63,11 @@ unary_operator:
| MOD { T.Mod }
| GT { T.Gt }
| LT { T.Lt }
+ | AND { T.And }
| GT EQUAL { T.Gte }
| LT EQUAL { T.Lte }
| EQUAL GT { T.Gte }
| EQUAL LT { T.Lte }
- | AND { T.And }
| OR { T.Or }
(** Declare a variable, either in the assignation (let var = …) or as a
diff --git a/lib/tokens.mly b/lib/tokens.mly
index 1c199fa..9ac4b10 100644
--- a/lib/tokens.mly
+++ b/lib/tokens.mly
@@ -55,15 +55,17 @@ in favor of shifting.
%right NO
(* The priority for the variable should be lower than the equality priority
if I want to allow declare new variables *)
-%nonassoc p_variable
-%left AND OR
-%right EQUAL GT LT GTE LTE
-%right EXCLAMATION
+%left p_variable
+%left OR
+%left AND
+%left EQUAL
+%left GT LT
+%left EXCLAMATION
%left PLUS MINUS
%left STAR DIV
%left MOD
%left FUNCTION
-%left L_PAREN
+%left L_PAREN
%right R_PAREN
%left COMA
%left KEYWORD