[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Yet another request for information and tips about making Lua syntax JavaScript like.
- From: Matthew Frazier <leafstormrush@...>
- Date: Mon, 26 Dec 2011 18:22:22 -0500
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.
[1] http://moonscript.org/
Thanks,
Matthew Frazier
http://leafstorm.us/