[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problems with epsilon productions
From: |
Arlen Cox |
Subject: |
Problems with epsilon productions |
Date: |
Mon, 17 Oct 2005 15:57:57 -0600 |
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, I was trying to replicate it. I've tried two ways:
File:
Module File
|
;
And
File:
File File
| Module
|
;
The problem with the first approach is that it just selects the epsilon
production on a file that has a module in it (it never selects the first
production).
The problem with the second approach is that it can't handle more than one
Module in a row. It just loops until there is a stack overflow (I get a
warning about the first production of that rule).
What am I doing wrong?
(I should mention that this is my first heavily expanded use of Bison. I
was using ANTLR, but I didn't like the library dependencies, so I moved to
Bison. ANTLR does support the ( Module )* construct so this was never an
issue.
Thanks,
Arlen
- Problems with epsilon productions,
Arlen Cox <=