[augeas-devel] Detecting ambiguity in recursive lens

David Lutterkort lutter at redhat.com
Mon Aug 16 21:34:37 UTC 2010


On Mon, 2010-08-16 at 15:40 -0400, Francis Giraldeau wrote:
> The put ambiguity is tested for recursive lens, but not the get  
> ambiguity. I faced this problem for httpd and xml lenses.

Yes, because the get direction in that case uses a context-free
language, whereas the put still uses a regular tree grammar. So put
ambiguities won't show up until the Earley parser runs into them when
its processing a string.

> I'm thinking about create a small function to output the grammar to  
> the format accepted by dk.brics.grammar, and run the tool on it to  
> test ambiguity. Would such a patch be suitable for Augeas? It would be  
> better to get the grammar analysis inside augeas itself, but that  
> would require more job...

I'd be more than happy to have dk.brics.grammar-style syntax checks in
Augeas, though that's a lot of work. In quite a few cases, you'd also
need a way to unroll the grammar one or two levels, and that would be a
serious amount of work (for unrolling, you'd need to expand the
alphabet; realistically, that would require to switch all of Augeas'
innards to wide characters, plus it's not clear to me how to handle the
user interaction you need for unrolling)

But outputting the grammar in a format that is easy to digest with
dk.brics.grammar would be a great addition - could be as simple as
adding an additional debug flag.

David






More information about the augeas-devel mailing list