Re: Intricate problem with scannerless LALR(1) parser

"Paul B Mann" <paul@paulbmann.com>
Thu, 26 Jun 2008 23:14:08 -0600

          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: "Paul B Mann" <paul@paulbmann.com>
Newsgroups: comp.compilers
Date: Thu, 26 Jun 2008 23:14:08 -0600
Organization: Compilers Central
References: 08-06-010 08-06-063 08-06-066
Keywords: parse
Posted-Date: 27 Jun 2008 00:40:57 EDT

>>>start: a
>>>a: b 'XX'
>>>b: c | '[' b ']'
>>>c: 'X' | c 'X'
>
>> XX is valid, but ambiguous, either a keyword or two X's.


> Are you sure it is ambiguous? Maybe it isn't LALR(1), though.
> Since there is no a in b or c, it looks to me that it only matches
> strings ending in 'XX'. If b is 'XX' then it still must be followed
> by another 'XX'.


You are right. I was wrong.


X XX is valid
XX XX is valid
XXX XX is valid.


The parser needs 2 characters of lookahead to correctly
parse this language, depending on how spaces are processed.




Paul B Mann


Post a followup to this message

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