Skip to content

Instantly share code, notes, and snippets.

@ChrisPenner
Last active August 16, 2018 14:22
Show Gist options
  • Save ChrisPenner/e99c36ed7b4e6f1f2c9086a27e8d9fa3 to your computer and use it in GitHub Desktop.
Save ChrisPenner/e99c36ed7b4e6f1f2c9086a27e8d9fa3 to your computer and use it in GitHub Desktop.
Lisp Parser in a tweet :)
module LispParser where
import Text.Megaparsec
import Text.Megaparsec.String
import Text.Megaparsec.Lexer hiding (space)
data E=L[E]|S String|N Integer deriving Show
e=(char '('*>(L<$>some e)<*char ')'<|>N<$>integer<|>S<$>some letterChar)<*space::Parser E
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment