[Haskell-cafe] Parser problem continued

Tomasz Zielonka tomasz.zielonka at gmail.com
Tue Mar 15 10:47:16 EST 2005


On Tue, Mar 15, 2005 at 03:44:55PM -0000, Nicola Whitehead wrote:
> perhaps like this:
> 
> > expr = do t <- term
> >           (do symbol "+"
> >               e <- expr
> >               return (t+e)
> >           )
> >           +++
> >           (return t)
> >
> >although I think you may also want a 'try' before the first alternative.
> 
> No, that still gives the same undefined variable error. :(

Sometimes I prefer to write such code in a lispy way:

expr = do t <- term
          ((+++)
              (do symbol "+"
                  e <- expr
                  return (t+e))
              (return t))

Best regards
Tomasz


More information about the Haskell-Cafe mailing list