[augeas-devel] brics grammar

David Lutterkort lutter at redhat.com
Thu Nov 18 11:06:00 UTC 2010


[ Sorry for the extreme delay in responding ]

On Mon, 2010-09-27 at 15:39 -0400, Francis Giraldeau wrote:
> When playing with it, I found something anoying, because some ambiguity
> are reported and they are not. 
> 
> Be this small grammar:
> 
> LETTER = [a]+ (MAX)
> 
> S[s1] : S E
> S[s2] :
> E[e1] : <LETTER>
> 
> The error is:
> checking horizontal ambiguities...
> horizontal check: S[s1] at index 1
> *** horizontal ambiguity: S[s1]: S <--> E
> ambiguous string: "aa"
> matched as "" <--> "aa" or "a" <--> "a"
> the grammar is ambiguous!
> 
> 
> The language generated by this grammar is a^n, and since the MAX
> argument is used for the regexp, there is no way to split the string in
> two. The MAX argument is not taken into account, and it's a known
> limitation [1]. How could we make the MAX keyword disambiguate this
> grammar? 

The normal typechecker in Augeas also doesn't take greediness into
account, so it behaves as if the (MAX) operator in brics grammar wasn't
there. I'd be hesitant to make the type checker depend on a greedy
matcher, since it precludes us from ever swithcing to a non-greedy one.

David





More information about the augeas-devel mailing list