Skip to content

Instantly share code, notes, and snippets.

@arbu
arbu / parser.hs
Last active February 2, 2016 23:15 — forked from anonymous/parser.hs
import Data.List
data Formula = Atom String | Unary String Formula | Binary String Formula Formula
instance Show Formula where
show (Atom name) = name
show (Unary op remaining) = op ++ " " ++ (show remaining)
show (Binary op left right) = "(" ++ (show left) ++ " " ++ op ++ " " ++ (show right) ++ ")"
unaries = ["-"]