lua-users home
lua-l archive

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


On Fri, Apr 15, 2011 at 3:24 PM, Henk Boom <henk@henk.ca> wrote:
>
> The convention that I follow with lua libraries as git repos is to put
> the library files at the top level, so that the repo can be used
> directly as a git-submodule of another git repo, and the .lua files
> found transparently by the lua loader.
>

The problem with that is the pollution in the top-level... perhaps you
can copy things to the right places with a hook?

> >From reading the discussion thread, it seems like this is a more
> complex issue than it appeared. I have to say that I understand the
> desire to use the % prefix for external definitions, but at the same
> time _ parses very well for "glob whitespace". It does seem a problem
> that the basic rules would shadow local rules, especially for 'name'
> which seems natural as a local grammar rule for many macros.

I bit the bullet fixed the precedence issue. Now non-terminals shadow
definitions, not the other way around. I pushed the updated re.lua to
http://github.com/mascarenhas/luma, and will make a new tarball and
new rocks later.

If you are curious about the implementation, I now do two passes over
the RE pattern, the first pass does not capture anything, but builds a
tree of grammars (because RE allows nested grammars), where each one
has a "names" hash with all the defined names set to true. This tree
is used in the second pass, the one that actually compiles the
grammar.

This means that there are two RE grammars, one without captures, the
other with the pattern-building captures. This means duplication.
Removing duplication means factoring out a lot of things to their own
rules, and putting several things that are defined outside of the
grammar inside it, as new rules. I don't think the RE grammar is going
to change so much that this will be worth the trouble and the reduced
efficiency.

>    henk
>
>

--
Fabio Mascarenhas