diff options
author | Camil Staps | 2015-07-03 11:16:02 +0200 |
---|---|---|
committer | Camil Staps | 2015-07-03 11:16:02 +0200 |
commit | 02c45922fc897047ecce16cc02398338947e7b94 (patch) | |
tree | 4e7af3276d29340139a561367363920104ff0c91 /Logic.icl | |
parent | Types, toString (diff) |
Fix associativity
Diffstat (limited to 'Logic.icl')
-rw-r--r-- | Logic.icl | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -85,17 +85,15 @@ needs_parentheses_right :: Expr -> Bool needs_parentheses_right (App2 _ _ (B _)) = False needs_parentheses_right (App2 _ _ (Atom _)) = False needs_parentheses_right (App2 _ _ (App1 Not _)) = False -needs_parentheses_right (App2 _ op1 (App2 _ op2 _)) = binds_stronger op1 op2 +needs_parentheses_right (App2 _ op1 (App2 _ op2 _)) = not (binds_stronger op2 op1) // Associativity rules binds_stronger :: Op2 Op2 -> Bool -binds_stronger And _ = True // And is left-associative -binds_stronger _ And = False -binds_stronger Or Or = False // All others are right-associative -binds_stronger Or _ = True +binds_stronger _ And = False // And is left-associative +binds_stronger And _ = True +binds_stronger Or _ = True // The rest is right-associative binds_stronger _ Or = False -binds_stronger Impl Impl = False binds_stronger Impl _ = True binds_stronger _ Impl = False -binds_stronger Equiv Equiv = False +binds_stronger Equiv Equiv = True |