lua-users home
lua-l archive

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


在 2015/8/17 2:36, Dibyendu Majumdar 写道:
On 15 August 2015 at 23:13, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
You can view progress at the following location where I will put
sample Lua programs to demonstrate the api.

Hi - I am pleased to report that I can code a do nothing C function in
Lua! The updated demo program is here:

https://github.com/dibyendumajumdar/ravi/blob/master/llvmbinding/basics.lua

Next step, get it to say 'hello world!'

Regards
Dibyendu


you might want to borrow some idea from terra, see [1] for a simple example.

imho, LLVM's API is, by definition, too low-level. I don't think I would like
to write a compiler in Lua using such low level API. I just can't keep
the contexts in mind. I'd rather deal with things like AST or similar.

I'm very interested in the idea of terra.

terra has a simple yet flexible syntax design. it is very much like Lua, with
some straightforward extensions like static type annotation. terra is mixed
with Lua. a keyword `terra` is used to switch the context.

what's most interesting is that Lua can be regard as the meta-language of terra.
a terra function is just a Lua value. you can manipulate the AST in Lua.
in addition, terra also has quotes and escapes, making meta-programming easy.

terra also has the interoperability with C. you can import definitions directly
from C header files.




[1] http://terralang.org/getting-started.html#terra-functions-are-lua-objects

--
the nerdy Peng / 书呆彭 / Sent from Thunderbird