Related articles |
---|
epsilon productions in Java CUP? smith@sjfc.edu (Smith, Doug) (2001-12-15) |
Re: epsilon productions in Java CUP? lee_lau@hotmail.com (2001-12-20) |
From: | lee_lau@hotmail.com (Luiz Lau) |
Newsgroups: | comp.compilers |
Date: | 20 Dec 2001 00:40:29 -0500 |
Organization: | http://groups.google.com/ |
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
problem.
-- lee
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
"Smith, Doug" <smith@sjfc.edu> 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?
Return to the
comp.compilers page.
Search the
comp.compilers archives again.