Skip to content

Instantly share code, notes, and snippets.

@3v0k4
Last active December 21, 2019 00:18
Show Gist options
  • Save 3v0k4/3ecafce8eb3519122cfd7a16017ee59a to your computer and use it in GitHub Desktop.
Save 3v0k4/3ecafce8eb3519122cfd7a16017ee59a to your computer and use it in GitHub Desktop.
input :: String
input =
"add 1 sub 6 add 3 2"
main :: Effect Unit
main = do
logShow $ runParser astParser input
-- (Right (Add 1 (Sub 6 (Add 3 2))))
logShow $ map generate $ runParser astParser input
-- (Right "(1 + (6 - (3 + 2)))")
logShow $ map evaluate $ runParser astParser input
-- (Right 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment