]> ruin.nu Git - proglang.git/blobdiff - Printsyntax.hs
streamlined the binary operators
[proglang.git] / Printsyntax.hs
index 0e549511ce4275a12b895072d1a216b7f8bf45e8..feb0b2332dce7a464f6db733404e1df969d77f70 100644 (file)
@@ -104,7 +104,6 @@ instance Print Stm where
 instance Print Exp where
   prt i e = case e of
    EAss id exp -> prPrec i 0 (concatD [prt 0 id , doc (showString "=") , prt 0 exp])
-   BExp exp0 bop exp -> prPrec i 0 (concatD [prt 1 exp0 , prt 0 bop , prt 1 exp])
    EVar id -> prPrec i 3 (concatD [prt 0 id])
    EInt n -> prPrec i 3 (concatD [prt 0 n])
    ENeg exp -> prPrec i 3 (concatD [doc (showString "-") , prt 3 exp])
@@ -113,7 +112,7 @@ instance Print Exp where
    EReadB  -> prPrec i 3 (concatD [doc (showString "readBool")])
    ExpT type' exp -> prPrec i 0 (concatD [prt 0 type' , prt 0 exp])
    EDefault  -> prPrec i 0 (concatD [])
-   OpExp exp0 op exp -> prPrec i 0 (concatD [prt 0 exp0 , prt 0 op , prt 0 exp])
+   BiOpExp exp0 op exp -> prPrec i 0 (concatD [prt 0 exp0 , prt 0 op , prt 0 exp])
    EPost id op -> prPrec i 0 (concatD [prt 0 id , prt 1 op])
 
 
@@ -122,7 +121,7 @@ instance Print Stms where
    Program stms -> prPrec i 0 (concatD [prt 0 stms])
 
 
-instance Print BOp where
+instance Print Op where
   prt i e = case e of
    Lt  -> prPrec i 0 (concatD [doc (showString "<")])
    ELt  -> prPrec i 0 (concatD [doc (showString "<=")])
@@ -130,10 +129,6 @@ instance Print BOp where
    EGt  -> prPrec i 0 (concatD [doc (showString ">=")])
    Eq  -> prPrec i 0 (concatD [doc (showString "==")])
    NEq  -> prPrec i 0 (concatD [doc (showString "!=")])
-
-
-instance Print Op where
-  prt i e = case e of
    Plus  -> prPrec i 1 (concatD [doc (showString "+")])
    Minus  -> prPrec i 1 (concatD [doc (showString "-")])
    Times  -> prPrec i 2 (concatD [doc (showString "*")])