lua-users home
lua-l archive

Re: Luma errors

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


> [...]
> 
> And, so, the <> became superfluous. So, maybe the % is superfluous too.
> (But maybe I do not recall correctly...)
The '%' is not gratuitous. The patch for Luma gives definitions
priority over non terminals. This seems to me a big mistake; local names
should always have priority over further ones.
If I write something like
 p = re.compile([[p -> . p / '']], defs)
I will have weird surprises if 'p' happens to be defined in 'defs'.
We could ameliorate the problem by raising an error if a non-terminal
is defined with the name of a definition, but this still seems wrong
to me. A correct, stand-alone grammar could be made invalid depending
of the definitions given in its compilation.
(The patch also distinguishes between pre-definitions [that still need
the '%'] and 'non-pre'definitions; this distinction also creates some
confusion).
In my view, the correct think would be to give non-terminals priority
over definitions; this is harder to implement, but not impossible.
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /