
2009/3/31 Zachary Turner
Hi,
I downloaded the package lispparser to, well, parse lisp code. I really have absolutely no idea what I'm doing though. I can look at the source of the module and see that it's exporting a single data type called LispVal and a single function called parseExpr, so somehow I should be able to pass an arbitrary block of lisp code into this function and get back a LispVal. But for the life of me I can't figure out how. I've looked at the documentation but I get even more confused because it links me to the Parsec documentation which is probably way over my head. Basically I just want a simple function:
parse :: String -> LispVal parse expr = ???
presumably by making some use of the exported 'thing' (since I'm not really sure how to interpret its type)
parseExpr :: Parser LispVal
Thanks for any help
You should be able to use the function "parse" from the parsec package like so:
parse parseExp "name of source for error reporting" "(some lisp expression")
The function "parse" returns a value of type (Either ParseError a), where in this case the type-var 'a' wil be a LispVal. Does that help? Antoine