[antlr-interest] Re: exact matching verses sufficient matches plz help

Muhammad Masoom Alam doublemalam at yahoo.co.uk
Mon Nov 22 23:35:26 PST 2004



Dear Michael

The problem is that i got no error

but wrong traversing of the tree is done by ANTLR e.g.

startrule
        : (check_rule)+
        ;
check_rule
          : and_implies
          | check1 
          ;
and_implies
          : 
          ( #(AND #(OR and_implies) #(IMPLIES 
implies_tree))) => #(AND #(OR and_implies) #(IMPLIES
implies_tree))

;
 check1 
       :

( #(AND check)) => #(AND check #(IMPLIES
implies_tree))

;


Problem

The problem is that always after matching the first
node and that is the root node and AND it executes the
first rule i.e and_implies and not check at all. even
if the 2nd rule is applicable

This solution i have taken from ANTLR documentation
which says some thing about the exact matching and
sufficient matching.
and even i remove the => sign and write the rule in
original form , i cant parse the exact matching .

Error which comes
<AST>:0:0: expecting "or", found 'And'

why i am saying that it performs sufficient matches,
becaz if u remove the rule and_implies , it directly
matches the check rule.

with Best regards.
Muhammad.



	
	
		
___________________________________________________________ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list