[antlr-interest] Ambiguity caused by recursion (I think)

Cameron Ross cross at kojeware.com
Thu Apr 8 17:29:11 PDT 2010


Hi,

I have a grammar that calls a rule from two different "levels".  This leads
to an ambiguity being reported from the two different calls to the rule.
 Oddly, the ambiguity points to the same place, so I'm not sure why its
"ambiguous".  The pertinent parts of the grammar are shown below and I've
attached a screen grab of the syntax diagram from AntlrWorks.


start_rule
: clif_file
;

clif_file
: cltext+
;

cltext
: (OPEN CL_MODULE) => module -> ^(CLTEXT module)
| text -> ^(CLTEXT text)
;
module
: OPEN CL_MODULE interpretablename exclusion_set? cltext CLOSE -> ^(MODULE
^(MODULE_IDENTIFIER interpretablename) exclusion_set? cltext)
;
text
: phrase+ -> ^(TEXT phrase+)
;

phrase
: (OPEN CL_MODULE) => module -> ^(PHRASE module)
| (OPEN CL_IMPORTS) => importation -> ^(PHRASE importation)
| (OPEN CL_COMMENT) => commented_text -> ^(PHRASE commented_text)
| sentence -> ^(PHRASE sentence)
;
...

Thanks,
Cameron.
-- 
Kojeware Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text_rule_ambiguity.png
Type: image/png
Size: 31724 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20100408/e422b902/attachment.png 


More information about the antlr-interest mailing list