[Metalua-list] Offline globals protection with metalua?

Alexander Gladysh agladysh at gmail.com
Fri Dec 14 16:49:43 GMT+3 2007


> Welcome on board :)

Thank you! :)

[ lot of very helpful stuff skipped ]

Aha! So, one can do AST pattern-patching in metalua! I was
disappointed when I haven't found it in the docs and examples.
Probably the manual should at least some list of currently
undocumented (major) features with micro descriptions (even single
sentence would do) -- so one would know at least that they are there.
This, in my opinion, could be helpful even if the feature is
experimental and would be transformed into something completely
different in the next release -- after all, every one is aware that
metalua is still in beta.

The code and explanations, you've provided, do look very close to what
I need -- I will report to the list as soon as I would gain progress
on that matter. Any documentation will, of course, help me a lot --
but I'm not at all reluctant to dig into metalua's source -- I find it
quite worth the reading.

> >        -{ block:
> >           mlp.lexer:add { "declare" }
> >          mlp.expr:add {
> >            name = "global symbol declaration";
> >            "declare", gg.optkeyword("("), mlp.string, gg.optkeyword(")") ;
> >            builder = function(symbol)
> >              print("declare", symbol[2][1])
> >              return +{ declare( -{symbol[2]} ) }
> >            end
> >          }
> >        }

> This approach is more complex, and harder to make robust, than necessary. As
> suggested above, since you don't actually want to change the syntax, you'd
> better let the parser alone and analyze the resulting AST, which is more
> abstract and easier to manipulate.

I see. AST analisys is of course more appropriate here -- I just did
not realize it is available in metalua.

[ more very helpful details skipped ]

> > So, the question: would it work and does it worth it?

> It definitely does! And if you're allowed to contribute your work back to
> the community, it's likely to interest other people in similar situations as
> yours, and help disseminate metalua :)

I would be happy to share any useful results I'll get on this matter
in the most full form I would be able to.

Thank you very much for your extensive help!

Leaving to lay out the bricks you have given me to build my long-wanted tool.
Alexander.



More information about the Metalua-list mailing list