From f53c1f87772c8744171995b996105ca667120ad2 Mon Sep 17 00:00:00 2001 From: Brian Huffman Date: Tue, 25 Jun 2019 09:54:23 -0700 Subject: [PATCH] Disambiguate Parser.y so we don't need to rely on operator precedences. --- src/Cryptol/Parser.y | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Cryptol/Parser.y b/src/Cryptol/Parser.y index f392affe..9e4ec637 100644 --- a/src/Cryptol/Parser.y +++ b/src/Cryptol/Parser.y @@ -148,12 +148,6 @@ import Paths_cryptol %right '->' %right '#' -%left '+' '-' -%left '*' -%right '^^' -%right NEG '~' -%left '@' -%left OP %% @@ -657,10 +651,13 @@ tysyn_params :: { [TParam PName] } : tysyn_param { [$1] } | tysyn_params tysyn_param { $2 : $1 } -type :: { Type PName } - : app_type '->' type { at ($1,$3) $ TFun $1 $3 } - | type op app_type { at ($1,$3) $ TInfix $1 $2 defaultFixity $3 } - | app_type { $1 } +type :: { Type PName } + : infix_type '->' type { at ($1,$3) $ TFun $1 $3 } + | infix_type { $1 } + +infix_type :: { Type PName } + : infix_type op app_type { at ($1,$3) $ TInfix $1 $2 defaultFixity $3 } + | app_type { $1 } app_type :: { Type PName } : dimensions atype { at ($1,$2) $ foldr TSeq $2 (reverse (thing $1)) }