... to define the typesystem of your language like this:
class Obj
{
function run( param : int ) -> int;
}
intType = typedb:def_type( 0, "int" )
function call( func) return function( this, arg ) ... end end
function init( obj) return function( address) ... end end
object = typedb:def_type( 0, "Obj" )
mt = typedb:def_type( object, "run" )
run = typedb:def_type( mt, "()", call( "Obj_run"), {intType} )
typedb:def_reduction( intType, run, init( intType) )
Mewa is a compiler-compiler for prototyping of compiler front-ends for statically-typed programming languages in Lua. You write an attributed grammar in a custom language, a sort of Bison/Yacc-style BNF. The parser creates an AST (Abstract Syntax Tree) with a fixed schema. Lua function calls attached as attributes are called on the AST tree traversal triggered by the compiler after the syntax analysis. A Lua module written in C++ (see typedb API) provides assistance to define the type system of your programming language in a declarative way.
The examples provided here use the intermediate representation (IR) of LLVM for code generation. For reading more see the collected links.
I consider the software as ready for use in projects.
Currently, there is only GNU Makefile support. CMake support is not planned for this project because the project is too small to justify it and it has not many dependencies. I would rather like to have Makefiles for platforms where GNU Makefile support is not available (e.g. Windows).
Issues around target platforms are discussed here.