Hi folks,
 
I have a parser problem. I have a basic calculator program (Graham Hutton's from Nottingham) which contains the following code:
 
-- Define a parser to handle the input
expr :: Parser Int
expr = do t <- term
              do symbol "+"
                   e <- expr
                   return (t + e)
          +++ return t

term :: Parser Int
term = do f <- factor
               do symbol "*"
               e <- expr
               return (f * t)
          +++ return f

factor :: Parser Int
factor = do symbol "("
                e <- expr
                symbol ")"
                return e
            +++ natural
symbol and natural are defined elsewhere and work fine, but when I compile it I get the error
 
ERROR "C:/HUGS/Calculator.hs":66 - Undefined variable "t"   
 
I suspect I'm missing something obvious, but for the life of me I can't see it. Any suggestions?
 
Thanks,
 
Nik
(Trying to keep a couple of weeks ahead of her students)
 
Dr Nik Freydís Whitehead
University of Akureyri, Iceland
*********************************************************************
Having the moral high ground is good.
Having the moral high ground and an FGMP-15 is better.
*********************************************************************