Re: top-down vs bottom-up parsers

tim@wagner.Princeton.EDU (Tim Hollebeek)
10 Dec 1997 00:39:41 -0500

          From comp.compilers

Related articles
Bottom-up versus Top-down (Jack Olsen) (1997-11-23)
Re: Bottom-up versus Top-down (1997-11-29)
top-down vs bottom-up parsers (Dennis Taylor) (1997-12-05)
Re: top-down vs bottom-up parsers tim@wagner.Princeton.EDU (1997-12-10)
Re: top-down vs bottom-up parsers (Chris Clark USG) (1997-12-15)
| List of all articles for this month |

From: tim@wagner.Princeton.EDU (Tim Hollebeek)
Newsgroups: comp.compilers
Date: 10 Dec 1997 00:39:41 -0500
Organization: Chemistry Department, Princeton University
References: 97-11-123 97-11-155 97-12-035
Keywords: parse, syntax

Dennis Taylor <> writes:
> Or take a situation with right-associative and left-associative
> operators, like in c. any declaration like
> *(*(*oop)())[]
> or some such, must be parse-able, but how? I've read all the "usual"
> books, but they just give pat answers and simple examples. None that
> I've seen actually explains what happens in the less straightforward
> cases.

I remember this was very confusing to me, as well. What I would
suggest is writing (or finding) a parser for such a construct, then
turn the debugging on (e.g. YYDEBUG in bison) and look at the output.
Feed it the smallest construct whose parsing confusing you. Read
through its output as it parses the expression, possibly also refering
to the table of states and rules (generated by bison -verbose).
Iterate until no finite token string confuses you. After doing that,
the lightbulb above my head entered the 'on' state.

Tim Hollebeek

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.