diff --git a/src/passes/1-parser/pascaligo/Parser.mly b/src/passes/1-parser/pascaligo/Parser.mly index 9b41ba242..70a03bdb6 100644 --- a/src/passes/1-parser/pascaligo/Parser.mly +++ b/src/passes/1-parser/pascaligo/Parser.mly @@ -141,23 +141,23 @@ type_decl: in {region; value} } type_expr: - sum_type | record_type | cartesian { $1 } + fun_type | sum_type | record_type { $1 } -cartesian: - function_type { $1 } -| function_type "*" nsepseq(function_type,"*") { - let value = Utils.nsepseq_cons $1 $2 $3 in - let region = nsepseq_to_region type_expr_to_region value - in TProd {region; value} } - -function_type: - core_type { $1 } -| core_type "->" function_type { +fun_type: + cartesian { $1 } +| cartesian "->" fun_type { let start = type_expr_to_region $1 and stop = type_expr_to_region $3 in let region = cover start stop in TFun {region; value = $1,$2,$3} } +cartesian: + core_type { $1 } +| core_type "*" nsepseq(core_type,"*") { + let value = Utils.nsepseq_cons $1 $2 $3 in + let region = nsepseq_to_region type_expr_to_region value + in TProd {region; value} } + core_type: type_name { TVar $1 } | par(type_expr) { TPar $1 }