lua-users home
lua-l archive

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



I think token filters should not be activated on the command line but
instead separately for each chunk. [...] For loading one could reuse the
existing require-mechanism

So do I. If there are several variants of the language, it's important that the variant in which a file is written is remembered by the file itself, not by a Makefile.

Metalua's approach to this is that all compile-time operations, including plugging stuff into the parser, happens between
-{ ... }. So you can load a parser extension module with -{require "myextension"}. Since nontrivial extensions often also require a runtime support, there is an adapted variant of require, extension(), which takes take of both compile-time and runtime loadings. For instance, if a file uses pattern matching and extended list syntax, it should start with:

-{extension "match"}
-{extension "clist"}

An example of a macro system relying on command line options is OCaml's camlp4. Since OCaml partially automates Makefile generation, handling a project with some camlp4 quickly becomes baroque, to say the least.