How Compiler Framework for generating Machine-native Code makes it easier to roll out new Languages

With new programming languages development landscape becoming harder by the day, thus forestalling the improvements on existing ones, like Mozilla’s Rust, Apple’s Swift, and Jetbrains’s Kotlin, among other several new languages with different range of choices for speed, convenience and portability, and so forth.

Low-Level Virtual Machine (LLVM), is an open source project developed by Swift language creator Chris Lattner as a research project at the University of Illinois, to help in that direction.

While LLVM provide tools for automating the most tasking parts of language generation: compiler creation, porting the code to multiple platforms and architectures, and coding to handle common language exceptions.

It also makes it easier to enhance the development of existing programming languages, and the liberal licensing makes it freely reusable as a software component or as a service.

Both Apple’s Swift language and Rust uses LLVM as its compiler framework, or as a core component of its tool chain, with many compilers haven an LLVM edition, such as Clang, the C/C++ compiler (C-lang), which is a project directly allied with LLVM.

Kotlin, on the other hand, is nominally a JVM language, which means it's developing a version of the language called Kotlin Native that uses LLVM to compile to machine-native code.

Albeit, the most common use case for LLVM is as a ahead-of-time (AOT) compiler for a language, even though some situations require code to be generated on the fly at runtime, rather than compiled ahead of time.

For developers who are curious about how to use LLVM libraries to build new language, there's a detailed tutorial for LLVM, using either C++ or OCAML, to guide you through creating a simple language.
Next Post »