lua-users home
lua-l archive

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


On Thu, Dec 6, 2012 at 7:52 AM, Vasiliy Tolstov <v.tolstov@selfip.ru> wrote:
> can be possible via base lua or using lpeg.

The advantage of lpeg of course is that your DSL is defined exactly
and does not suffer from the problems of being a fully-executable Lua
script (much as JavaScript people would never parse JSON by simply
interpreting it).

An entertaining project (or maybe it already exists?) would be a
lpeg-based DSL generation tool

You would give it something like:

MUST directory STRING {
  owner IDEN
  group IDEN
  mode STRING
  action IDEN
}

which would match this syntax (there MUST be a directory clause)

directory "/etc/" {
  owner root
  group wheel
  mode "0755"
  action create
}

and create a parser that brings this in as a table structure. ( It
would issue sensible errors at the right place, which is a tricky
thing with lpeg)

steve d.