Re: Intricate problem with scannerless LALR(1) parser

kamal <kamalpr@hp.com>
Sun, 8 Jun 2008 21:54:27 -0700 (PDT)

          From comp.compilers

Related articles
Intricate problem with scannerless LALR(1) parser mailings@jmksf.com (2008-06-06)
Re: Intricate problem with scannerless LALR(1) parser kamalpr@hp.com (kamal) (2008-06-08)
Re: Intricate problem with scannerless LALR(1) parser GeniusVczh@gmail.com (vczh) (2008-06-09)
Re: Intricate problem with scannerless LALR(1) parser paul@paulbmann.com (Paul B Mann) (2008-06-25)
Re: Intricate problem with scannerless LALR(1) parser gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-06-26)
Re: Intricate problem with scannerless LALR(1) parser paul@paulbmann.com (Paul B Mann) (2008-06-26)
Re: Intricate problem with scannerless LALR(1) parser parsersinc@earthlink.net (SLK Mail) (2008-06-27)
| List of all articles for this month |
From: kamal <kamalpr@hp.com>
Newsgroups: comp.compilers
Date: Sun, 8 Jun 2008 21:54:27 -0700 (PDT)
Organization: Compilers Central
References: 08-06-010
Keywords: parse
Posted-Date: 09 Jun 2008 19:05:41 EDT

> possibly situation this kind of problems comes up? How can it find out
> that "c" is the nonterminal which possibly matches the keyword? Please
> note, that now shift-reduce conflict will come up, because "X" and
> "XX" are two different terminals.
>
> Any ideas on this topic?
>
> Best regards
> Jan
> [Your grammar is ambiguous. To see where, replace "XX" with xx and
> define it like this: xx: "X" "X"


yes -if the grammar had terminal y instead of XX -then (I think) there
wouldn't have been a conflict. The LALR(1) grammar will resolve shift-
reduce conflicts in favour of shifts, and you can use yyerror()[error
recovery] to recover from a reduce-reduce conflict.


  Further, I am not sure why you want a scannerless parser while most
people would want to use a scanner to provide syntactic sugar [as in
hide inherent ambiguities in the language].


regards
-kamal


> Assuming you want to use normal tokenizing rules, your "X" token is
> really "X followed by something other than a letter or digit, and if
> the something is white space, skip over the white space. Oh, and skip
> comments, too." Now you know why we use separate lexer and parser
> generators, because they need separate state machines to keep the
> parser grammar frome exploding. -John]



Post a followup to this message

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