Changed display of expressions

This commit is contained in:
Ivy 2021-01-30 22:07:16 +01:00
parent ee13a75141
commit 4807eb0cbe
1 changed files with 12 additions and 5 deletions

View File

@ -7,9 +7,16 @@ data Expr = IntE Integer
| LambdaE String Expr | LambdaE String Expr
| QuotedE Expr | QuotedE Expr
| NilE | NilE
deriving (Show)
-- instance Show Expr where -- Make set! and lambda(?) parsed as cons, detect later set! and lambda as special procedures
-- show (IntE x) = show x
-- show (VarE x) = x ++ " ; var" instance Show Expr where
-- show NilE = "nil" show (IntE x) = show x
show (VarE x) = x
show (SetE _ _) = "#set"
show c@(ConsE _ _) = "(" ++ showCons c
where showCons (ConsE _ NilE) = ")"
showCons (ConsE x xs) = show x ++ " " ++ showCons xs
show (LambdaE s e) = "#lambda"
show (QuotedE e) = show e
show NilE = "nil"