[antlr-interest] Beginner question, about syntactic predicates. YES but...

Anthony Brenelière abreneliere at telys.com
Thu Feb 6 01:34:18 PST 2003


The difference between 'attribute' and 'entity' is there is '
simpleAttribute' at the end of 'attribute'.

I would like to keep the attribute rule because i would like to use it
as a not in a tree.

That kind of rules worked fine with a LR grammar, but does not seem to
work in the LL grammar.

So when i test the grammar on a sample code, attributes are not
predicted in the rule entSetAtt, so 'ent1:ent2:ent3.att' is a syntax
error, thought it should be accepted by the grammar.

I tought real LL parsers tried the rule 'entity', and if there was a
syntax error, returned back to the rule 'entSetAtt' to try for other
alternatives, like the 'attribute' rule..

I see no solution for my problem

---

entSetAtt   // HERE IS THE NON-DETERMINISM THAT CAUSE ERRORS WITH VALID
CODE
	:	entity 
	|	attribute
;

entity // (supplier WHERE name="Telys"):client
	:	entityComponent (COLON entity)?
;

attribute	// ::supplier:client.address
	:	entity simpleAttribute 
	|	simpleAttribute 
;

entityComponent // (supplier WHERE name="Telys")
	:	LPAREN IDENTIFIER clause RPAREN
	|	IDENTIFIER 
;

simpleAttribute	// .name
	:	DOT IDENTIFIER 
;

---

Cordially,
Anthony


 

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



More information about the antlr-interest mailing list