[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LR(1) paser generator based on Pager's algorithm

From: Joel E. Denny
Subject: Re: LR(1) paser generator based on Pager's algorithm
Date: Sun, 1 Apr 2007 19:54:40 -0400 (EDT)

On Sun, 1 Apr 2007, Joel E. Denny wrote:

> I am studying Menhir (and OCaml) now to figure out what it does with this 
> grammar.

Menhir version 20070322 does not detect the problem.  It does at least 
report a useless production (A: 'a' 'a') that results from the problem, 
and Bison (sigh) fails to report even that because it fails to eliminate 
the associated unreachable state.

Here's an extended grammar that makes the production useful again:

  S: 'a' A 'a'
   | 'b' A 'b'
   | 'c' c
  A: 'a' 'a'
   | 'a'
  c: 'a' 'b'
   | A

With the %left 'a' declaration, neither Bison nor Menhir reports any 
warning for this grammar.  Both report a syntax error at the dot in the 


Again, canonical LR(1) would accept this input.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]