|
 |
Darren New wrote:
> Actually, that's not *quite* right.
>
> What Haskell is using is called a recursive-descent parser: the parser
> basically uses the run-time stack in place of an explicit stack. It's
> best for LALR(1) syntaxes, which means "Look Ahead Left to Right 1
> token". I.e., a language you can parse by running strictly from left to
> right, looking only one element ahead, so you don't need the "P_Try()"
> function. Some languages (like Pascal) are explicitly designed this way
> to make it easy to build a recursive descent parser.
OK, well since you seem to know something about this... using the
formalisms developed here, how would you go about parsing a grammar that
can consist of integers, variable names, and + - / * ( ), such that the
operators have the correct precidence?
I thought I had this working, but it seems that bracketing the
expressions in unusual but valid ways causes the parser to trip over in
inexplicable ways. :-(
Post a reply to this message
|
 |