lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> > Would you mind explaining how these changes make writing and composing
> > grammars *much* more convenient?
> 
> The second change lets the grammar writer refactor a non-terminal to a
> definition without adding % to all of its uses.

Can't you simply keep the non-terminal as a non-terminal, adding one new
rule like this?

  non-terminal -> %new-definition

    

> The first change, when combined with the second, just lets Luma offer
> _ as a predef for Lua whitespace (in the lexer sense) for the user's
> grammars, which is useful in a lot of grammars and less obstrusive
> than %space or %s.

Several examples in LPeg use the symbols 'S' or 's' for whitespace; the
specification for XML uses 'S'. They do not seem obstrusive. (You may
prefer 's' to avoid hitting the shift key.)

When combined with the first comment, you might add 's -> %s*' to any
grammar to achieve what you want.

I see these changes as minor adjustments, and may even add them to LPeg
(the "second" change is a little controversial); but to claim they add
*much* more convenience seems to me a bit exaggerated.

-- Roberto