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?
I've searched every web page with every search engine I could find on Java
CUP and while there are one or two good tutorials out there I don't seem to
be able to find what I'm looking for. This is needed as part of a larger
grammar specification so any help would be greatly appreciated.
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" <sm...@sjfc.edu> wrote in message news:<01-1...@comp.compilers>...