On 07/07/2010 05:42 PM, David Maier wrote:

> thanks for your quick reply Andrew. But shouldn't the following rule be
> enough to make ANTRL aware of that it can be void:
> 
> sp_decls:  (sp_decl ';')* -> (sp_decl)*;

That part is fine.  sp_block_content, however, don't know that sp_decls
might return a void result.

> I mean that the Kleene operator (*) means to also match the empty word,
> right? So I think the following is true for rules named 'a', 'b' and 'c':
> 
> 
> (1) My variant
> 
> a : b;
> b : c*;
> 
> 
> with
> 
> c* := /*empty*/ | c+
> 
> and if I resolve it then 'a' means:
> 
> a: /*empty*/ | c+
> 
> 
> (2) Your variant
> 
> a: b?;
> b: c*;
> 
> with
> 
> b?:= /*empty*/ | b
> 
> b:= /*empty*/ | c+
> 
> and so
> 
> a:= /*empty*/ | /*empty*/ | c+ := /*empty*/ | c+
> 
> 
> So you can see that both should mean the same. So is it a kind of ANTLR
> issue that I would have to use the (?) operator here?

Did you try it?  If so, did it work?

The rewrite rules are not part of the formal grammar as such, and you may
need to do things you don't expect.

As to whether this is an ANTLR bug, I don't know.  I can't find anything
in the spec one way or the other.

Andrew.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to