lua-users home
lua-l archive

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

On Dec 26, 2011, at 16:24 , [ex] wrote:

> Hello all,
> I'd been searching the wiki and forums for information and tips about
> modifying the Lua syntax to be more like JavaScript/C/AS3..
> Please don't answer this with a list of reasons why this could be a
> "wrong" idea, I'm only interested in the technical
> difficulties this task implies. I'm not interested in in using
> metalua, I'm planning to modify the C lexer and parser.directly.
> The resulting language doesn't need to be Lua compatible, it could be
> something different but using the Lua VM and C Lua API
> (hopefully with minor modifications).
> I'm not a compiler specialist, so if someone has done or tried to do
> this in the past, I would love to hear about it.
> Just to clarify, I really love the simplicity of Lua and its C API
> support, but the same way some people prefer blue over red,
> I would prefer another variant of the language with the same philosophy behind.
> Laurens R.

If I were to create a variant of Lua where most of the differences were syntactic, I would use something along the lines of MoonScript [1] - instead of modifying the Lua compiler to compile your language, write a translator that translates your language into standard Lua, then just load it into Lua directly. This means (a) you don't have to muck about in the Lua core, and (b) you get full interoperability with the existing body of standard Lua code.


Matthew Frazier