picolisp/src/Expression.hs

16 lines
443 B
Haskell
Raw Permalink Normal View History

module Expression where
-- The basic unit of the language are Expressions, so we make an
-- Expression data with the primitive expression values as the
-- constructors
2021-02-27 23:20:42 +00:00
data Expression = Number Double
| Symbol String
| SExpr [Expression]
deriving (Eq)
instance Show Expression where
show (Number n) = show n
show (Symbol s) = show s
show (SExpr es) = "(" ++ unwords (map show es) ++ ")"