Hi all,

I'm using the Parsec library to parse the following grammar

expr = atom+
atom = integer | var | (expr)

The input to the parser is a list of (Token, SourcePos). I have the following code for atom:

atom
 =  try variable <|> try integerr <|>
do{sat(== Reserved "("); (e,pos) <- expression; sat(==Reserved ")"); return (e,pos)} sat p = do (t,pos) <- item
           if p t then return(t,pos) else pzero
When I run the code on the input "(_ineg_ 0)" the parser fails, but removing

sat(==Reserved ")")

and it succeeds. Can any one see why?

E.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to