home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!udel!gvls1!faatcrl!iecc!compilers-sender
- From: dww@inf.fu-berlin.de
- Newsgroups: comp.compilers
- Subject: Parsing wars
- Keywords: parse, LR(1), question, comment
- Message-ID: <92-09-006@comp.compilers>
- Date: 31 Aug 92 16:13:40 GMT
- Sender: compilers-sender@iecc.cambridge.ma.us
- Reply-To: dww@inf.fu-berlin.de
- Organization: Free University of Berlin
- Lines: 28
- Approved: compilers@iecc.cambridge.ma.us
-
- I have encountered a parsing method that I do not understand. Perhaps it's
- just some sort of fancy technique, maybe I overlooked something. If
- someone can either tell me how this works or else state <rtfm,book,topic>
- I would be grateful.
-
- The parsing is called shift-reduce parsing, and I thought I had understood
- that. What happens on a reduction though is, instead of pushing the
- nonterminal of the lhs of the reduced production onto a symbol stack and
- digging through the goto table for the appropriate state to push onto the
- state stack, the nonterminal is *prepended* to the input sequence of
- tokens and parsing resumes as normal. The other actions, shift, accept and
- error are as expected, an action shiftreduce combines the normal shift and
- the strange reduce.
-
- My question: how and why does this work? What does it buy me? (Is it
- extremely efficient? Use compact tables? Wrong?)
-
- Thanks for any clues!
- --
- Debora Weber-Wulff dww@inf.fu-berlin.de
- Institut fuer Informatik +49 30 89691 124
- Nestorstr. 8-9, D-W-1000 Berlin 31
- [It sounds to me like a way to combine the shift and goto tables, since
- pushing the nonterminal and then shifting it would be equivalent to a
- goto. -John]
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-