Text.Parsec
and Text.Parsec.String
are modules in the parsec package version 3. The old parsec-2
interface is accessible from the compatibility modules with the traditional names Text.ParserCombinators.Parsec.*
, But there is no *.String
module new in parsec-3
. If you have installed parsec-2
or no parsec
, I recommend installing parsec-3
with the canonical cabal install parsec
.
Edit:
If you want to parse less rigid syntax for trees, supporting the input of your example,
pBranch = do a <- letter do char '(' t0 <- pTree char ',' t1 <- pTree char ')' return $ Branch a t0 t1 <|> return (Branch a Empty Empty)
By default, two empty children are set if the letter is not followed by an opening bracket.
source share