Can LLVM generate a compiler once implemented?

Joakim via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Mon May 2 18:22:52 PDT 2016


On Monday, 2 May 2016 at 23:29:53 UTC, Justice wrote:
> Essentially, is LLVM a compiler generator or does it simply a 
> generic compiler that one builds languages for?

It was originally a set of libraries that facilitated working 
with a kind of generic assembly language, the LLVM Intermediate 
Representation (IR), that most languages could be compiled to.  
Eventually, Apple wrote their own compiler for C and C++, clang, 
that built on llvm, and other languages like Haskell have 
followed suit.  Maybe there are more LLVM tools now to help you 
transform your language to the IR in the first place, ie parsers 
and the like, but ldc uses the dmd frontend for that.

> e.g., could I design my own language using LLVM and get 
> something like "myLang++.exe" and use independently of anything 
> LLVM? (e.g., sell it, include it in an app to compile user 
> programs, etc?)

Yes, LLVM is made available under the very liberal UIUC license, 
which allows you to do almost anything you want with it:

http://llvm.org/docs/DeveloperPolicy.html#copyright-license-and-patents

However, the license does not deal with patents.  They are 
considering re-licensing as Apache, despite the statement in that 
link about the difficulty of re-licensing, and the Apache license 
is still very liberal while having some language covering patents 
too.


More information about the digitalmars-d-ldc mailing list