How do I use syntactic predicates with loops?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jonathan_Sergent
Posted On:   Saturday, April 14, 2001 09:11 PM

How do I match something like this: protected A: 'a'..'z' | '0'..'9'; protected B: A | '-'; protected Name: (A (B)*)? A; Name can only have hyphens if they are not the first or last character. The use of Name is always followed by ':' or '/'. The above is ambiguous with the exit from (B)* on A. How do I do this with k=1? I want to use a syntactic predicate with the (B)*: protected Name: (A ((B B)=>B)*)? A; But of course there's only one alternative. What's the trick here? I'm missing something obvious, I think. I'm trying to avoid recursion and k=2.    More>>

How do I match something like this:


			
protected A: 'a'..'z' | '0'..'9';
protected B: A | '-';

protected Name: (A (B)*)? A;


Name can only have hyphens if they are not the first or last character.
The use of Name is always followed by ':' or '/'.
The above is ambiguous with the exit from (B)*
on A.



How do I do this with k=1?
I want to use a syntactic predicate with the (B)*:


			
protected Name: (A ((B B)=>B)*)? A;


But of course there's only one alternative.
What's the trick here? I'm missing something obvious, I think.



I'm trying to avoid recursion and k=2.

   <<Less

Re: How do I use syntactic predicates with loops?

Posted By:   Monty_Zukowski  
Posted On:   Monday, April 16, 2001 07:28 AM

The problem is that both A and B start with A, hence the ambiguity. You should really have

Name: A ('-' A)?

Re: How do I use syntactic predicates with loops?

Posted By:   Priyank_RASTOGI  
Posted On:   Monday, April 16, 2001 06:55 AM

in the case you have mentioned above.. i guess you can define Name as

protected Name: (A)? A;
i dont see any reason to have (A (B)*)?

regards
priyank@consultant.com
About | Sitemap | Contact