lua-users home
lua-l archive

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


‎Hi,

Just a question: why the DSL has side effects on the upper scope?

‎I understand that the idea is to use the keywords without scoping. I tend not to do this anymore rather using scope: that allows having a local context. This is not so unusual with XML schemas, xs:...

If I don't need these contexts, I still scope the language ‎and use local var to unscope rather than using env.

local mydsl= require'my.dsl.grammar'
‎local kw1, kw2 = mydsl.kw1, mydsl.kw2 -- easy copy/paste

How your grammar ‎looks like?

Https://bitbucket.org/spoludo/tools/src

From: Marc Lepage
Sent: mardi 20 mai 2014 07:32
To: Lua mailing list
Reply To: Lua mailing list
Subject: Loading DSL Data

Hi, looking for some thoughts on loading DSL style data.

I have it working but would like to swap out the environment when doing so, so it doesn't trample on the global environment.