Terra, hybrid of Lua and C
Posted: Fri Dec 19, 2014 3:08 pm
A co-worker told me about this a while ago but I didn't look too deeply into it and I forgot. Then a tweet from Klaim last night got my attention (didn't realise I'd already heard of it until I told the same co-worker about it today).
Terra is a combination of Lua with a C compatible system level programming language.
The two are tightly integrated. Every Terra datatype, function and structure is a first class Lua type. Lua and Terra can call each other.
Lua remains a dynamically typed scripting language, while the Terra side is statically typed compiled language using LLVM.
Effectively, Lua is like a macro or template processor for the Terra language, you can use Lua to build Terra source code, compile it and call the result.
Performance of the Terra side is within 5% of the performance of raw C.
Pretty damn interesting.
Have a look at http://terralang.org for lots of examples (such as lua code that generates a terra compiled program based on a string of brainfuck).
Terra is a combination of Lua with a C compatible system level programming language.
The two are tightly integrated. Every Terra datatype, function and structure is a first class Lua type. Lua and Terra can call each other.
Lua remains a dynamically typed scripting language, while the Terra side is statically typed compiled language using LLVM.
Effectively, Lua is like a macro or template processor for the Terra language, you can use Lua to build Terra source code, compile it and call the result.
Performance of the Terra side is within 5% of the performance of raw C.
Pretty damn interesting.
Have a look at http://terralang.org for lots of examples (such as lua code that generates a terra compiled program based on a string of brainfuck).
