home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!utcsri!neat.cs.toronto.edu!mdhutton
- Newsgroups: comp.theory
- From: mdhutton@cs.toronto.edu (Mike Hutton)
- Subject: Re: What kind of an automaton is this?
- Message-ID: <92Sep11.123701edt.47914@neat.cs.toronto.edu>
- Organization: Department of Computer Science, University of Toronto
- References: <4QU69WW@math.fu-berlin.de>
- Date: 11 Sep 92 16:37:11 GMT
- Lines: 53
-
- In article <4QU69WW@math.fu-berlin.de> dww@inf.fu-berlin.de writes:
- >We've been discussing on comp.compilers the kind of parsing automaton that is described in
- >DeRemer[CACM 71] as being an SLR-Parser. It is not the kind of PDA I
- >learned about when I studied Automata Theory with the next state and the
- >output being determined by the current state, the top of the stack, and
- >the current symbol in the input. In this "strange" automaton the lhs of
- >the production being reduced is returned to the input after the stack
- >has been popped. This is not just backing up over input, but non-terminals
- >can be built up on the input, perhaps with a number of epsilon productions.
- >Some people have said "oh yes, we like that and have a hack to use it"
- >but it is unclear what exactly the computational complexity of this
- >automaton is. LR parsing is clearly a subset of what this automaton can
- >do - just don't do any of the strange reductions.
- >
- >Has anyone encountered this type of automaton before? What does it buy
- >me, i.e. what special problems could be solved with this type of
- >automaton that we can't do with LR-parsers? Pointers or ideas of
- >any kind are welcome.
- >
-
- You state SLR differently than I have seen it before; are you thinking
- of noncanonical SLR [Tai 1979]?
-
- Fischer and LeBlanc (Crafting a Compiler) defines the SLR(1) machine as
- an extension of the LR(0) machine to include one symbol of (canonical,
- i.e. temrminal symbols only) lookahead (but no new states); LALR(1) is
- a reduction of the full LR(1) machine to merge redundant states. Both
- are attempting to gain the expressiveness of the LR(1) machine with
- cost closer to the LR(0) machine, just from different directions.
-
- SLR parsers are still canonical parsers though; I don't see how the
- description given above matches with the definition in Fischer and
- LeBlanc or with my memory.
-
- To disagree with the previous two responses, even if you extend to allow
- noncanonical lookahead (i.e. allow 2 stacks to go through the
- input and put nonterminals back on the input stack), you still have a
- context-free-like grammar (just with a more powerful lookahead
- ability) defining the language. That the noncanonical parser *uses* two
- stacks doesn't imply that any language acceptable by an arbitrary
- 2-stack automaton (i.e. Turing Machine) can be expressed with an appropriate
- NLR(k) or NSLR(k) grammar---you still have k-bounded lookahead, even if
- it can also include nonterminals.
-
- The point of noncanonical extensions was firstly to allow grammars to
- be written more "naturally" (no contortions to make them LALR(1) parsable)
- not really to extend the class of recognizable languages. However, you
- can get some non-LR(k) (non DCFL) languages with noncanonical parsers, and
- this would be useful for some language constructions.
-
- I wrote a grad-course paper surveying this about 3 years ago which
- has most of the relevant references; if still interested send email.
-
-