Click here to Skip to main content
15,881,687 members
Articles / Programming Languages / Lua

Writing Compiler Front-Ends for LLVM with Lua using Mewa

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
26 May 2021MIT30 min read 10.1K   49   9  
In this article we see how a very primitive compiler is written in Lua using Mewa and how to compile and run a simple demo program in the shell.
LLVM IR text representation makes it possible to write a compiler front-end without being bound to an API. We can map the source text to the text of LLVM IR and use the tools of the Clang compiler for further compilation steps. This opens the doors to implement compiler front-ends in different ways. Mewa tries to optimize the amount of code written. It targets single authors that would like to write a prototype of a non-trivial programming language fast, but at the expense of a structure supporting collaborative work. This makes it rather a tool for experiment than for building a product.

Views

Daily Counts

Downloads

Weekly Counts

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Europe Europe
I am a software engineer living in Zürich.
My main interests are information retrieval, document processing, compiler building, formal languages and domain specific languages.

Comments and Discussions