From 095b60424f3cb42d0ca2bd68f0bc38fb99a6347c Mon Sep 17 00:00:00 2001 From: Itay Dafna Date: Fri, 8 Jul 2022 11:11:40 -0700 Subject: [PATCH] Add changes from today Signed-off-by: Itay Dafna --- compiler/src/parsing/ast_helper.re | 2 + compiler/src/parsing/ast_helper.rei | 3 + compiler/src/parsing/ast_mapper.re | 7 + compiler/src/parsing/dune | 2 +- compiler/src/parsing/parser.messages | 415 +-------------------------- compiler/src/parsing/parser.mly | 3 +- 6 files changed, 15 insertions(+), 417 deletions(-) diff --git a/compiler/src/parsing/ast_helper.re b/compiler/src/parsing/ast_helper.re index 994f0f1fa3..bc78fb1a3b 100644 --- a/compiler/src/parsing/ast_helper.re +++ b/compiler/src/parsing/ast_helper.re @@ -235,6 +235,8 @@ module Exp = { mk(~loc?, ~attributes?, PExpLambda(a, b)); let apply = (~loc=?, ~attributes=?, a, b) => mk(~loc?, ~attributes?, PExpApp(a, b)); + let construct = (~loc=?, ~attributes=?, a, b) => + mk(~loc?, ~attributes?, PExpConstruct(a, b)); // It's difficult to parse rational numbers while division exists (in the // parser state where you've read NUMBER_INT and you're looking ahead at /, // you've got a shift/reduce conflict between reducing const -> NUMBER_INT diff --git a/compiler/src/parsing/ast_helper.rei b/compiler/src/parsing/ast_helper.rei index 6990d06279..c40b8244ed 100644 --- a/compiler/src/parsing/ast_helper.rei +++ b/compiler/src/parsing/ast_helper.rei @@ -201,6 +201,9 @@ module Exp: { let apply: (~loc: loc=?, ~attributes: attributes=?, expression, list(expression)) => expression; + let construct: + (~loc: loc=?, ~attributes: attributes=?, id, list(expression)) => + expression; let binop: (~loc: loc=?, ~attributes: attributes=?, expression, list(expression)) => expression; diff --git a/compiler/src/parsing/ast_mapper.re b/compiler/src/parsing/ast_mapper.re index 61fff1e49b..f8db3e1201 100644 --- a/compiler/src/parsing/ast_mapper.re +++ b/compiler/src/parsing/ast_mapper.re @@ -136,6 +136,13 @@ module E = { sub.expr(sub, e), List.map(sub.expr(sub), el), ) + | PExpConstruct(id, el) => + construct( + ~loc, + ~attributes, + map_identifier(sub, id), + List.map(sub.expr(sub), el), + ) | PExpBlock(el) => block(~loc, ~attributes, List.map(sub.expr(sub), el)) | PExpNull => null(~loc, ~attributes, ()) | PExpConstraint(e, t) => diff --git a/compiler/src/parsing/dune b/compiler/src/parsing/dune index 51ead66818..3357809b8e 100644 --- a/compiler/src/parsing/dune +++ b/compiler/src/parsing/dune @@ -2,7 +2,7 @@ (menhir (modules parser) - (flags --explain --unused-tokens --strict)) + (flags --explain --unused-tokens)) ;; The following two rules create a copy of the file parser.mly named ;; unitActionsParser.mly. This is a copy of the grammar where the semantic diff --git a/compiler/src/parsing/parser.messages b/compiler/src/parsing/parser.messages index 107520f985..6bc8275e5e 100644 --- a/compiler/src/parsing/parser.messages +++ b/compiler/src/parsing/parser.messages @@ -2764,15 +2764,6 @@ program: IMPORT FOREIGN WASM ID COLON TYPEID FROM WHILE ## The known suffix of the stack is as follows: ## FOREIGN WASM id_str COLON typ option(as_prefix(id_str)) FROM ## -program: IMPORT TYPEID FROM WHILE -## -## Ends in an error in state: 878. -## -## import_stmt -> IMPORT lseparated_nonempty_list_inner(comma,import_shape) option(comma) FROM . file_path [ SEMI EOL EOF ] -## -## The known suffix of the stack is as follows: -## IMPORT lseparated_nonempty_list_inner(comma,import_shape) option(comma) FROM -## Expected a file path surrounded by `”`. @@ -2893,71 +2884,6 @@ program: IMPORT FOREIGN WHILE Expected the keyword `wasm`. -program: IMPORT LBRACE TYPEID AS ID WHILE -## -## Ends in an error in state: 884. -## -## import_ids -> lseparated_nonempty_list_inner(comma,aliasable(id)) . option(comma) [ RBRACE EOL ] -## lseparated_nonempty_list_inner(comma,aliasable(id)) -> lseparated_nonempty_list_inner(comma,aliasable(id)) . comma aliasable(id) [ RBRACE EOL COMMA ] -## -## The known suffix of the stack is as follows: -## lseparated_nonempty_list_inner(comma,aliasable(id)) -## - -Expected a comma followed by more imports or `}` to complete the imports block. - -program: IMPORT LBRACE TYPEID AS WHILE -## -## Ends in an error in state: 888. -## -## as_prefix(id) -> AS . id [ RBRACE EOL COMMA ] -## -## The known suffix of the stack is as follows: -## AS -## - -Expected an identifier to use as an alias. - -program: IMPORT LBRACE TYPEID COMMA EOL WHILE -## -## Ends in an error in state: 886. -## -## lseparated_nonempty_list_inner(comma,aliasable(id)) -> lseparated_nonempty_list_inner(comma,aliasable(id)) comma . aliasable(id) [ RBRACE EOL COMMA ] -## option(comma) -> comma . [ RBRACE EOL ] -## -## The known suffix of the stack is as follows: -## lseparated_nonempty_list_inner(comma,aliasable(id)) comma -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 3, spurious reduction of production nonempty_list(eol) -> EOL -## In state 5, spurious reduction of production eols -> nonempty_list(eol) -## In state 89, spurious reduction of production comma -> COMMA eols -## - -Expected an identifier to import or `}` to complete the imports block. - -program: IMPORT LBRACE TYPEID EOL WHILE -## -## Ends in an error in state: 201. -## -## rbrace -> eols . RBRACE [ WHEN THICKARROW STAR SLASH SEMI RPAREN RCARET RBRACK RBRACE PLUSPLUS PLUS PIPEPIPE PIPE PERCENT NOTEQ LPAREN LESSEQ LCARETLCARET LCARET LBRACK ISNT IS GREATEREQ GETS FROM EQUAL EQEQ EOL EOF ELSE DOT DASH COMMA COLON CARET AMPAMP AMP ] -## -## The known suffix of the stack is as follows: -## eols -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 3, spurious reduction of production nonempty_list(eol) -> EOL -## In state 5, spurious reduction of production eols -> nonempty_list(eol) -## - -Expected `}` to complete the block. - program: IMPORT LBRACE TYPEID THICKARROW ## ## Ends in an error in state: 887. @@ -3012,47 +2938,6 @@ program: IMPORT LPAREN WHILE Expected an infix or prefix operator, e.g. `+`, `-`, `!`. -program: IMPORT STAR EXCEPT LBRACE TYPEID COMMA EOL WHILE -## -## Ends in an error in state: 854. -## -## lseparated_nonempty_list_inner(comma,id) -> lseparated_nonempty_list_inner(comma,id) comma . id [ RBRACE EOL COMMA ] -## option(comma) -> comma . [ RBRACE EOL ] -## -## The known suffix of the stack is as follows: -## lseparated_nonempty_list_inner(comma,id) comma -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 3, spurious reduction of production nonempty_list(eol) -> EOL -## In state 5, spurious reduction of production eols -> nonempty_list(eol) -## In state 89, spurious reduction of production comma -> COMMA eols -## - -Expected an identifier or `}` to complete the block. - -program: IMPORT STAR EXCEPT LBRACE TYPEID THICKARROW -## -## Ends in an error in state: 851. -## -## import_exception -> EXCEPT lbrace lseparated_nonempty_list_inner(comma,id) . option(comma) rbrace [ FROM COMMA ] -## lseparated_nonempty_list_inner(comma,id) -> lseparated_nonempty_list_inner(comma,id) . comma id [ RBRACE EOL COMMA ] -## -## The known suffix of the stack is as follows: -## EXCEPT lbrace lseparated_nonempty_list_inner(comma,id) -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 122, spurious reduction of production id -> lseparated_nonempty_list_inner(dot,TYPEID) -## In state 856, spurious reduction of production lseparated_nonempty_list_inner(comma,id) -> id -## - -Expected a comma followed by an identifier or `}` to end the block. - program: IMPORT STAR EXCEPT LBRACE WHILE ## ## Ends in an error in state: 850. @@ -3095,48 +2980,6 @@ program: IMPORT STAR WHILE Expected the keyword `except` followed by comma-separated identifiers surrounded by `{`/`}`, a comma followed by a module name, or the keyword `from` followed by a file path. -program: IMPORT TYPEID COMMA EOL WHILE -## -## Ends in an error in state: 880. -## -## lseparated_nonempty_list_inner(comma,import_shape) -> lseparated_nonempty_list_inner(comma,import_shape) comma . import_shape [ FROM COMMA ] -## option(comma) -> comma . [ FROM ] -## -## The known suffix of the stack is as follows: -## lseparated_nonempty_list_inner(comma,import_shape) comma -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 3, spurious reduction of production nonempty_list(eol) -> EOL -## In state 5, spurious reduction of production eols -> nonempty_list(eol) -## In state 89, spurious reduction of production comma -> COMMA eols -## - -Expected another import or the `from` keyword followed by a file path. - -program: IMPORT TYPEID THICKARROW -## -## Ends in an error in state: 876. -## -## import_stmt -> IMPORT lseparated_nonempty_list_inner(comma,import_shape) . option(comma) FROM file_path [ SEMI EOL EOF ] -## lseparated_nonempty_list_inner(comma,import_shape) -> lseparated_nonempty_list_inner(comma,import_shape) . comma import_shape [ FROM COMMA ] -## -## The known suffix of the stack is as follows: -## IMPORT lseparated_nonempty_list_inner(comma,import_shape) -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 122, spurious reduction of production id -> lseparated_nonempty_list_inner(dot,TYPEID) -## In state 896, spurious reduction of production import_shape -> id -## In state 897, spurious reduction of production lseparated_nonempty_list_inner(comma,import_shape) -> import_shape -## - -Expected a comma followed by a module identifier, `*`, a list of comma-separated identifiers surrounded by `{`/`}`, or the `from` keyword followed by a file path. - program: IMPORT WHILE ## ## Ends in an error in state: 847. @@ -3415,119 +3258,6 @@ program: LET REC WHILE Expected the keyword `mut` or a binding pattern, like an identifier. -program: LBRACE TYPEID COLON BREAK COMMA EOL TYPEID COLON BREAK WHILE -## -## Ends in an error in state: 318. -## -## lseparated_nonempty_list_inner(comma,record_field) -> lseparated_nonempty_list_inner(comma,record_field) . comma punned_record_field [ RBRACE EOL COMMA ] -## lseparated_nonempty_list_inner(comma,record_field) -> lseparated_nonempty_list_inner(comma,record_field) . comma non_punned_record_field [ RBRACE EOL COMMA ] -## record_exprs -> non_punned_record_field comma lseparated_nonempty_list_inner(comma,record_field) . option(comma) [ RBRACE EOL ] -## -## The known suffix of the stack is as follows: -## non_punned_record_field comma lseparated_nonempty_list_inner(comma,record_field) -## -program: LBRACE TYPEID COLON BREAK WHILE -## -## Ends in an error in state: 315. -## -## record_exprs -> non_punned_record_field . option(comma) [ RBRACE EOL ] -## record_exprs -> non_punned_record_field . comma lseparated_nonempty_list_inner(comma,record_field) option(comma) [ RBRACE EOL ] -## -## The known suffix of the stack is as follows: -## non_punned_record_field -## -program: LBRACE TYPEID COMMA EOL TYPEID COLON BREAK WHILE -## -## Ends in an error in state: 207. -## -## lseparated_nonempty_list_inner(comma,record_field) -> lseparated_nonempty_list_inner(comma,record_field) . comma punned_record_field [ RBRACE EOL COMMA ] -## lseparated_nonempty_list_inner(comma,record_field) -> lseparated_nonempty_list_inner(comma,record_field) . comma non_punned_record_field [ RBRACE EOL COMMA ] -## record_exprs -> punned_record_field comma lseparated_nonempty_list_inner(comma,record_field) . option(comma) [ RBRACE EOL ] -## -## The known suffix of the stack is as follows: -## punned_record_field comma lseparated_nonempty_list_inner(comma,record_field) -## - -Expected a comma followed by more record fields or an immediate `}` to complete the record expression. - -program: LBRACE TYPEID COLON BREAK COMMA EOL WHILE -## -## Ends in an error in state: 317. -## -## option(comma) -> comma . [ RBRACE EOL ] -## record_exprs -> non_punned_record_field comma . lseparated_nonempty_list_inner(comma,record_field) option(comma) [ RBRACE EOL ] -## -## The known suffix of the stack is as follows: -## non_punned_record_field comma -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 3, spurious reduction of production nonempty_list(eol) -> EOL -## In state 5, spurious reduction of production eols -> nonempty_list(eol) -## In state 89, spurious reduction of production comma -> COMMA eols -## -program: LBRACE TYPEID COMMA EOL WHILE -## -## Ends in an error in state: 204. -## -## record_exprs -> punned_record_field comma . [ RBRACE EOL ] -## record_exprs -> punned_record_field comma . lseparated_nonempty_list_inner(comma,record_field) option(comma) [ RBRACE EOL ] -## -## The known suffix of the stack is as follows: -## punned_record_field comma -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 3, spurious reduction of production nonempty_list(eol) -> EOL -## In state 5, spurious reduction of production eols -> nonempty_list(eol) -## In state 89, spurious reduction of production comma -> COMMA eols -## -program: LBRACE TYPEID COMMA TYPEID COMMA EOL WHILE -## -## Ends in an error in state: 209. -## -## lseparated_nonempty_list_inner(comma,record_field) -> lseparated_nonempty_list_inner(comma,record_field) comma . punned_record_field [ RBRACE EOL COMMA ] -## lseparated_nonempty_list_inner(comma,record_field) -> lseparated_nonempty_list_inner(comma,record_field) comma . non_punned_record_field [ RBRACE EOL COMMA ] -## option(comma) -> comma . [ RBRACE EOL ] -## -## The known suffix of the stack is as follows: -## lseparated_nonempty_list_inner(comma,record_field) comma -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 3, spurious reduction of production nonempty_list(eol) -> EOL -## In state 5, spurious reduction of production eols -> nonempty_list(eol) -## In state 89, spurious reduction of production comma -> COMMA eols -## - -Expected more record fields or an immediate `}` to complete the record expression. - -program: LBRACE TYPEID COMMA TYPEID THICKARROW -## -## Ends in an error in state: 212. -## -## non_punned_record_field -> id . COLON expr [ RBRACE EOL COMMA ] -## non_punned_record_field -> id . COLON eols expr [ RBRACE EOL COMMA ] -## punned_record_field -> id . [ RBRACE EOL COMMA ] -## -## The known suffix of the stack is as follows: -## id -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 122, spurious reduction of production id -> lseparated_nonempty_list_inner(dot,TYPEID) -## - -Expected a colon followed by an expression, a comma followed by more record fields, or an immediate `}` to complete the record. - program: LBRACE TYPEID THICKARROW ## ## Ends in an error in state: 320. @@ -3794,57 +3524,6 @@ program: LET NUMBER_INT SLASH DASH WHILE Expected a number. -program: LET LBRACE TYPEID COLON EOL WASMI64 WHILE -## -## Ends in an error in state: 388. -## -## pattern -> pattern . COLON typ [ RBRACE EOL COMMA COLON ] -## pattern -> pattern . COLON eols typ [ RBRACE EOL COMMA COLON ] -## record_pattern -> id COLON eols pattern . [ RBRACE EOL COMMA ] -## -## The known suffix of the stack is as follows: -## id COLON eols pattern -## -program: LET LBRACE TYPEID COLON WASMI64 WHILE -## -## Ends in an error in state: 386. -## -## pattern -> pattern . COLON typ [ RBRACE EOL COMMA COLON ] -## pattern -> pattern . COLON eols typ [ RBRACE EOL COMMA COLON ] -## record_pattern -> id COLON pattern . [ RBRACE EOL COMMA ] -## -## The known suffix of the stack is as follows: -## id COLON pattern -## - -Expected a type annotation, a comma followed by more record field patterns, or `}` to complete the record pattern. - -program: LET LBRACE TYPEID COLON EOL WHILE -## -## Ends in an error in state: 387. -## -## record_pattern -> id COLON eols . pattern [ RBRACE EOL COMMA ] -## -## The known suffix of the stack is as follows: -## id COLON eols -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 3, spurious reduction of production nonempty_list(eol) -> EOL -## In state 5, spurious reduction of production eols -> nonempty_list(eol) -## -program: LET LBRACE TYPEID COLON WHILE -## -## Ends in an error in state: 385. -## -## record_pattern -> id COLON . pattern [ RBRACE EOL COMMA ] -## record_pattern -> id COLON . eols pattern [ RBRACE EOL COMMA ] -## -## The known suffix of the stack is as follows: -## id COLON -## program: LET LPAREN WHILE ## ## Ends in an error in state: 358. @@ -3917,26 +3596,6 @@ program: LET NUMBER_INT PIPE EOL WHILE Expected a pattern. -program: LET LBRACE TYPEID THICKARROW -## -## Ends in an error in state: 384. -## -## record_pattern -> id . COLON pattern [ RBRACE EOL COMMA ] -## record_pattern -> id . COLON eols pattern [ RBRACE EOL COMMA ] -## record_pattern -> id . [ RBRACE EOL COMMA ] -## -## The known suffix of the stack is as follows: -## id -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 122, spurious reduction of production id -> lseparated_nonempty_list_inner(dot,TYPEID) -## - -Expected `:` followed by a pattern, a comma followed by another record field pattern, or `}` to complete the record pattern. - program: LET LBRACE UNDERSCORE COMMA EOL WHILE ## ## Ends in an error in state: 382. @@ -5826,49 +5485,6 @@ program: TYPEID DOT WHILE Expected an identifier. -program: TYPEID EQUAL EOL UNDERSCORE -## -## Ends in an error in state: 224. -## -## assign_expr -> id_expr equal . expr [ THICKARROW STAR SLASH SEMI RPAREN RCARET RBRACK RBRACE PLUSPLUS PLUS PIPEPIPE PIPE PERCENT NOTEQ LESSEQ LCARETLCARET LCARET ISNT IS GREATEREQ EQEQ EOL EOF ELSE DASH COMMA COLON CARET AMPAMP AMP ] -## -## The known suffix of the stack is as follows: -## id_expr equal -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 3, spurious reduction of production nonempty_list(eol) -> EOL -## In state 5, spurious reduction of production eols -> nonempty_list(eol) -## In state 222, spurious reduction of production equal -> EQUAL eols -## -program: TYPEID STAREQ EOL UNDERSCORE -## -## Ends in an error in state: 310. -## -## assign_expr -> id_expr assign_binop_op eols . expr [ THICKARROW STAR SLASH SEMI RPAREN RCARET RBRACK RBRACE PLUSPLUS PLUS PIPEPIPE PIPE PERCENT NOTEQ LESSEQ LCARETLCARET LCARET ISNT IS GREATEREQ EQEQ EOL EOF ELSE DASH COMMA COLON CARET AMPAMP AMP ] -## -## The known suffix of the stack is as follows: -## id_expr assign_binop_op eols -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 3, spurious reduction of production nonempty_list(eol) -> EOL -## In state 5, spurious reduction of production eols -> nonempty_list(eol) -## -program: TYPEID STAREQ WHEN -## -## Ends in an error in state: 308. -## -## assign_expr -> id_expr assign_binop_op . expr [ THICKARROW STAR SLASH SEMI RPAREN RCARET RBRACK RBRACE PLUSPLUS PLUS PIPEPIPE PIPE PERCENT NOTEQ LESSEQ LCARETLCARET LCARET ISNT IS GREATEREQ EQEQ EOL EOF ELSE DASH COMMA COLON CARET AMPAMP AMP ] -## assign_expr -> id_expr assign_binop_op . eols expr [ THICKARROW STAR SLASH SEMI RPAREN RCARET RBRACK RBRACE PLUSPLUS PLUS PIPEPIPE PIPE PERCENT NOTEQ LESSEQ LCARETLCARET LCARET ISNT IS GREATEREQ EQEQ EOL EOF ELSE DASH COMMA COLON CARET AMPAMP AMP ] -## -## The known suffix of the stack is as follows: -## id_expr assign_binop_op -## program: WASMI64 DOT EOL ID EQUAL EOL UNDERSCORE ## ## Ends in an error in state: 627. @@ -7051,41 +6667,12 @@ program: WASMI64 STAR WHEN Expected an expression on the right side of the operator. -program: WASMI64 COLON EOL WHILE -## -## Ends in an error in state: 118. -## -## annotated_expr -> non_binop_expr COLON eols . typ [ THICKARROW STAR SLASH SEMI RPAREN RCARET RBRACK RBRACE PLUSPLUS PLUS PIPEPIPE PIPE PERCENT NOTEQ LESSEQ LCARETLCARET LCARET ISNT IS GREATEREQ EQEQ EOL EOF ELSE DASH COMMA COLON CARET AMPAMP AMP ] -## -## The known suffix of the stack is as follows: -## non_binop_expr COLON eols -## -## WARNING: This example involves spurious reductions. -## This implies that, although the LR(1) items shown above provide an -## accurate view of the past (what has been recognized so far), they -## may provide an INCOMPLETE view of the future (what was expected next). -## In state 3, spurious reduction of production nonempty_list(eol) -> EOL -## In state 5, spurious reduction of production eols -> nonempty_list(eol) -## -program: WASMI64 COLON WHILE -## -## Ends in an error in state: 65. -## -## annotated_expr -> non_binop_expr COLON . typ [ THICKARROW STAR SLASH SEMI RPAREN RCARET RBRACK RBRACE PLUSPLUS PLUS PIPEPIPE PIPE PERCENT NOTEQ LESSEQ LCARETLCARET LCARET ISNT IS GREATEREQ EQEQ EOL EOF ELSE DASH COMMA COLON CARET AMPAMP AMP ] -## annotated_expr -> non_binop_expr COLON . eols typ [ THICKARROW STAR SLASH SEMI RPAREN RCARET RBRACK RBRACE PLUSPLUS PLUS PIPEPIPE PIPE PERCENT NOTEQ LESSEQ LCARETLCARET LCARET ISNT IS GREATEREQ EQEQ EOL EOF ELSE DASH COMMA COLON CARET AMPAMP AMP ] -## -## The known suffix of the stack is as follows: -## non_binop_expr COLON -## - -Expected a type to complete the type annotation. - program: WASMI64 COLON FUN ID ARROW EOL WHILE ## ## Ends in an error in state: 71. ## ## typ -> FUN ID arrow . typ [ WHEN THICKARROW STAR SLASH SEMI RPAREN RCARET RBRACK RBRACE PLUSPLUS PLUS PIPEPIPE PIPE PERCENT NOTEQ LESSEQ LCARETLCARET LCARET ISNT IS GREATEREQ FROM EQUAL EQEQ EOL EOF ELSE DASH COMMA COLON CARET AS AMPAMP AMP ] -## +# ## The known suffix of the stack is as follows: ## FUN ID arrow ## diff --git a/compiler/src/parsing/parser.mly b/compiler/src/parsing/parser.mly index 125dfa1e5a..5520154288 100644 --- a/compiler/src/parsing/parser.mly +++ b/compiler/src/parsing/parser.mly @@ -490,8 +490,7 @@ non_modid: id: | modid dot non_modid { mkid (List.append $1 $3) (to_loc $loc) } - | modid %prec DOT { (mkid $1) (to_loc $loc) } - | non_modid { (mkid $1) (to_loc $loc) } + | non_modid %prec DOT { (mkid $1) (to_loc $loc) } simple_id: | ID { (mkid [mkstr $loc $1]) (to_loc $loc) }