[Haskell-beginners] Using Parsec to parse Haskell Language

Sean Cormican seancormican1 at gmail.com
Thu Jan 31 17:40:49 CET 2013


I'm working on a project in which I am attempting to write a parser for
Haskell within Haskell itself using Parsec.

The parser itself only deals with a subset of the features of the full
Haskell implementation but I'm having difficulty figuring out how to
implement the grammar with precedence of operations for example boolean
expression involving && over || and also 'if then else" statements in
relation to other operations.

I'm attempting to do this with the Text.Parsec.Expr module more
specifically BuildExpressionParser combinator using table and term as used
in a number of tutorials I have seen which deal with arithmetic expression.
Is this the correct course of action? Or will it fail to meet my needs.

Will it be necessary to create an AST for the grammar by creating new data
types as outlined in the following tutorial?
http://www.haskell.org/haskellwiki/Parsing_a_simple_imperative_language

Also what's the difference between the modules:
Text.Parsec.Expr
Text.ParserCombinators.Parsec.Expr

Thanks in advance,
Seán
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130131/dc787da8/attachment.htm>


More information about the Beginners mailing list