A question about ParseC library

Yu Di diyu60607@yahoo.com
Fri, 11 Jul 2003 20:14:35 -0700 (PDT)


Hi, I want to have a parser like:

p = 
      do 
        eof
        return something
  <|> do
        patternA
        update_parser_state
        p
  <|> do
        patternB
        update_parser_state_in_another_way
        p
  <|> do
        anyToken
        p

i.e., go through the content, if pattern A occurs,
update my internal state, if pattern B occurs, update
the state in another way. Also, the exact forms of
pattern A and pattern B might be dependent on the
internal state at that time (e.g., whenever I encount
pattern A, I increase a counter in my internal state,
and that counter is included in pattern B). Finally,
when I reach the end, I will then return something
based on the final internal state.

I did it in the above recursive fashion, but when I
ran it, it caused a stack overflow error. So what is
the best way to do this kind of parsing? 

Thanks!

Di, Yu
7.11

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com