lua-users home
lua-l archive

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

Just want to bring this to attention.  caffeine-hx [1] contains what
appears to be an experimental version of haXe [2] supporting compiling
haXe sources to Lua.  It is under /trunk/projects/compiler .  In
particular, the translator for Lua is implemented in [3],
an OCaml file.  There's some brief notes by the author [4] stating
that he resorted to patching [5] Lua 5.1.3 (a.k.a. "halelua") to
support bitwise opcodes.  On examination, the patch also contains a
try/catch/finally extension [6].  (Sidenote: there have been serious
proposals for similar functionality in Lua 5.2.)

Although halelua builds fine, I didn't get their customized haXe to
compile here.  There was some error about being missing.
That file does exist in the haXe mainline, but even after adding it, I
then get an error about File "", line 302, characters 27-28:
Parse error: [stream_patt_comp_err_list] expected after ";" (in
[stream_patt]).  As said [3], the project is currently dormant unless
others have interest in it.

I brought this up due to some of the recent discussions of porting Lua
to other languages (e.g. C# and Java).  Machine translating the Lua C
sources to other languages is likely not practical without introducing
a lot of cruft due to the explicitness of C (e.g. what does this void
pointer represent?).  However, I think it's more achievable if one
first manually translates to some intermediate form X that is more
amenable to machine translation.  Something like haXe might be that
intermediate form.  One one occasion, I used m4 for X, so that, for
example, METHOD_CALL(object, name) would expand to when
generating C++ and $object->name() when generating Perl.  Lisp may
have been more suitable.