Incomplete grammars
Do incomplete grammars have a place in a world of modular Invisible XML?
I’ve been thinking more about modularity in Invisible XML. Michael Sperberg-McQueen first drew my attention to the similarities between Invisible XML and RELAX NG: they are both expressions of a grammar that parses a sequence of input tokens, perhaps ambiguously.
The RELAX NG tutorial includes a nested grammar example that relates to tables. It didn’t take me long to construct a roughly analogous example in iXML:
table = row+ .
row = (-'|', cell)+, -'|', nl .
cell = -cell-content .
-nl = -#a .
In the RELAX NG case, you could define cell-content as notAllowed, but iXML
doesn’t have anything like “not allowed”, so I’ve left the rule out. That’s an
incomplete grammar that won’t parse.
But suppose that you had a modularity framework that let you say: “use that
tables grammar with this definition of cell-content”:
cell-content = -" "*, ["0"-"9"]+, (".", ["0"-"9"]*)?, -" "* .
Now you’d have a grammar that would parse a table of numbers. Similarly, if you
defined cell-content this way, you’d have a grammar that would parse a table
of words:
cell-content = -" "*, [L]+, -" "* .
That seems like it could be interesting.