Related articles |
---|
Bottom-up versus Top-down jacko@post8.tele.dk (Jack Olsen) (1997-11-23) |
Re: Bottom-up versus Top-down gclind01@spd.louisville.edu (1997-11-29) |
top-down vs bottom-up parsers dennis_taylor@pctc.com (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 clark@quarry.zk3.dec.com (Chris Clark USG) (1997-12-15) |
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 <dennis_taylor@pctc.com> 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
email: tim@wfn-shop.princeton.edu
URL: http://wfn-shop.princeton.edu/~tim
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.