Get the latest tech news

Writing a DSL in Lua (2015)


DSLs, or domain specific languages, are programming languages that are designed to implement a set of features specific to a particular problem or field. An example could be Make , the build tool, which is a specially designed language for combining ...

An example could be Make, the build tool, which is a specially designed language for combining commands and files while managing dependencies. In this trivial example the benefits might not be obvious, but typically your DSL would be implemented in another module, and each place you invoke it is not necessary to bring each function into scope manually, but rather activate the whole sscope with run_with_env. append_all uses Lua’s built in function select to avoid any extra allocations by querying the varargs object instead of creating a new table.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of DSL

DSL

Photo of lua

lua

Related news:

News photo

Decorator JITs: Python as a DSL

News photo

Show HN: Modest – musical harmony library for Lua

News photo

Show HN: Lua-libuv – A Lua with libuv experiments