help-bison
[Top][All Lists]
Advanced

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

Re: Problems with epsilon productions


From: Hans Aberg
Subject: Re: Problems with epsilon productions
Date: Tue, 18 Oct 2005 01:21:38 +0200

On 17 Oct 2005, at 23:57, Arlen Cox wrote:

I am trying to implement a grammar that may have 0 or more of a construct.
Effectively I want to have a grammar like this:

File:
    ( Module )*

I've looked through the manual and it appears bison does not support this
construct,

Right, Bison doesn't support that.

I was trying to replicate it.  I've tried two ways:

Waite & Goos, "Compiler construction", gives the following rewritings
  Abbreviation               Meaning
  x -> alpha u* gamma        x -> alpha [u+] gamma
  x -> alpha u+ gamma        x -> alpha Y gamma, where y -> u | y u
  x -> alpha [beta] gamma    x -> alpha gamma | alpha (beta) gamma
  x -> alpha (beta) gamma    x -> alpha y gamma, where y -> beta
This should suffice -- I'm too tired too solve this for you. :-)

  Hans Aberg






reply via email to

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