Commit ed816ac5 by Zachary Snow

fix silly bugs from AST reorg

parent 8907ac86
...@@ -47,7 +47,7 @@ instance Show Expr where ...@@ -47,7 +47,7 @@ instance Show Expr where
show (Repeat e l ) = printf "{%s {%s}}" (show e) (commas $ map show l) show (Repeat e l ) = printf "{%s {%s}}" (show e) (commas $ map show l)
show (Concat l ) = printf "{%s}" (commas $ map show l) show (Concat l ) = printf "{%s}" (commas $ map show l)
show (UniOp a b ) = printf "(%s %s)" (show a) (show b) show (UniOp a b ) = printf "(%s %s)" (show a) (show b)
show (BinOp a o b) = printf "(%s %s %s)" (show a) (show o) (show b) show (BinOp o a b) = printf "(%s %s %s)" (show a) (show o) (show b)
show (Cast t e ) = printf "%s'(%s)" (show t) (show e) show (Cast t e ) = printf "%s'(%s)" (show t) (show e)
show (Dot e n ) = printf "%s.%s" (show e) n show (Dot e n ) = printf "%s.%s" (show e) n
show (Mux c a b) = printf "(%s ? %s : %s)" (show c) (show a) (show b) show (Mux c a b) = printf "(%s ? %s : %s)" (show c) (show a) (show b)
......
...@@ -41,11 +41,11 @@ data Stmt ...@@ -41,11 +41,11 @@ data Stmt
instance Show Stmt where instance Show Stmt where
show (Block name decls stmts) = show (Block name decls stmts) =
printf "begin%s\n%s\n%s\nend" header (block decls) (block stmts) printf "begin%s\n%s\nend" header body
where where
header = maybe "" (" : " ++) name header = maybe "" (" : " ++) name
block :: Show t => [t] -> String bodyLines = (map show decls) ++ (map show stmts)
block = indent . unlines' . map show body = indent $ unlines' bodyLines
show (Case u kw e cs def) = show (Case u kw e cs def) =
printf "%s%s (%s)\n%s%s\nendcase" uniqStr (show kw) (show e) bodyStr defStr printf "%s%s (%s)\n%s%s\nendcase" uniqStr (show kw) (show e) bodyStr defStr
where where
...@@ -66,7 +66,7 @@ instance Show Stmt where ...@@ -66,7 +66,7 @@ instance Show Stmt where
show (If a b Null) = printf "if (%s) %s" (show a) (show b) show (If a b Null) = printf "if (%s) %s" (show a) (show b)
show (If a b c ) = printf "if (%s) %s\nelse %s" (show a) (show b) (show c) show (If a b c ) = printf "if (%s) %s\nelse %s" (show a) (show b) (show c)
show (Return e ) = printf "return %s;" (show e) show (Return e ) = printf "return %s;" (show e)
show (Timing t s ) = printf "%s%s" (show t) (show s) show (Timing t s ) = printf "%s %s" (show t) (show s)
show (Null ) = ";" show (Null ) = ";"
data CaseKW data CaseKW
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment