Re: epsilon productions in Java CUP? (Luiz Lau)
20 Dec 2001 00:40:29 -0500

          From comp.compilers

Related articles
epsilon productions in Java CUP? (Smith, Doug) (2001-12-15)
Re: epsilon productions in Java CUP? (2001-12-20)
| List of all articles for this month |

From: (Luiz Lau)
Newsgroups: comp.compilers
Date: 20 Dec 2001 00:40:29 -0500
References: 01-12-071
Keywords: Java, parse
Posted-Date: 20 Dec 2001 00:40:29 EST

I'm not sure the following lines will help, but if we have the following:
non terminal EndOrElse, SeqCmds
terminal END, ELSE

Consider the following production:

EndOrElse ::= END {: RESULT = null; :}
                          | ELSE SeqCmds:cmd END {: RESULT = cmd; :};

the null or epsilon production is achieved in CUP by assigning the value
"null" to the Result.
The above production is intended to avoid the dangling if -then - else

        -- lee

"Smith, Doug" <> wrote in message news:01-12-071...
> I'm looking for information on how to specify epsilon productions in Java
> CUP. For example if one wanted to specify the grammar of valid balanced
> parenthesis they would use the production:
> S -> (S)S | p
> where "|" means alternation and p is an epsilon or null production.
> In CUP one would specify the terminals and non-terminals, the precedence and
> then the grammar as above. But how does CUP understand the concept or
> meaning of a null production?

Post a followup to this message

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