🌐
GitHub
github.com › numba › llvmlite
GitHub - numba/llvmlite: A lightweight LLVM python binding for writing JIT compilers · GitHub
A lightweight LLVM python binding for writing JIT compilers - numba/llvmlite
Starred by 2.3K users
Forked by 363 users
Languages   Python 75.4% | C++ 18.9% | Shell 1.9% | CMake 1.7% | Batchfile 1.4% | LLVM 0.6% | C 0.1%
Discussions

Writing a toy language compiler in Python with LLVM—feasible?
It is quite possible. Consider lark or PLY for parsing, and you can emit llvmir directly in text, or use llvmlite (bindings to generate llvm) More on reddit.com
🌐 r/Compilers
18
14
June 2, 2025
Codon: A high-performance Python-like compiler using LLVM
Reality-check: Why do you think type hints and type checkers like mypy and pyright take such a long time to get going and even they are not there yet? If this was all so easy with just ignoring some obscure rarely used features then mypy would work with essentially no type annotations, all ... More on news.ycombinator.com
🌐 news.ycombinator.com
179
317
December 11, 2022
Mapping Python to LLVM
Yo this looks dope - I'm always excited for anything LLVM , and a python-like compiled languages has been something I've wanted for ages!! Will definitely be following this project closely, and will be looking forwards to how it develops! More on reddit.com
🌐 r/programming
14
80
January 9, 2023
Codon: a high-performance Python compiler using LLVM
This looks cool, but can you call it a Python compiler when it doesn't support all the Python syntax features? Isn't it more like a compiled language that's based on Python? More on reddit.com
🌐 r/programming
30
139
December 8, 2022
🌐
Llvmpy
llvmpy.org
QuickStart — llvmpy
llvmpy is a Python wrapper around the llvm C++ library which allows simple access to compiler tools.
🌐
LPython
lpython.org
LPython
It can be used as a Jupyter kernel, allowing Python/Julia-style rapid prototyping and an exploratory workflow (conda install jupyter lpython). It can also be used from the command-line with an interactive prompt (REPL). Support for diverse hardware LLVM makes it possible to run LPython on diverse hardware. We plan to support a wide range of hardware platforms, including: CPUs: compile Python code to run on CPUs of all architectures, including x86, ARM, and POWER.
just-in-time compiler for numerical functions in the Python programming language
Numba is an open-source JIT compiler that translates a subset of Python and NumPy into fast machine code using LLVM, via the llvmlite Python package. It offers a range of options for … Wikipedia
Factsheet
Original author Continuum Analytics
Developer Community project
Release 15 August 2012; 13 years ago (2012-08-15)
Factsheet
Original author Continuum Analytics
Developer Community project
Release 15 August 2012; 13 years ago (2012-08-15)
🌐
PyData
numba.pydata.org
Numba: A High Performance Python Compiler
Numba is an open source JIT compiler ... code. Learn More Try Numba » · Numba translates Python functions to optimized machine code at runtime using the industry-standard LLVM compiler library....
🌐
Exaloop
exaloop.io › blog › mapping-python-to-llvm
Mapping Python to LLVM | Exaloop
At a high level, the Codon compiler works in these steps: Parse source code into an abstract syntax tree (AST). Perform type checking on the AST using a modified Hindley-Milner-like algorithm.
🌐
Reddit
reddit.com › r/compilers › writing a toy language compiler in python with llvm—feasible?
r/Compilers on Reddit: Writing a toy language compiler in Python with LLVM—feasible?
June 2, 2025 -

Hi everyone!

A while ago, I started writing a C compiler in C—for learning and fun. Now I'm thinking it could be fun to write a compiler for a toy language of my own as well.

The thing is, unlike C, the syntax and structure of this toy language will evolve as I go, so I want to be able to iterate quickly. Writing another compiler entirely in C might not be the best option for this kind of rapid experimentation.

So I'm considering writing the frontend in Python, and then using LLVM via its C API, called from Python, to handle code generation. My questions:

  • Does this sound feasible?

  • Has anyone here done something similar?

  • Are there better approaches or tools you’d recommend for experimenting with toy languages and compiling them down to native code?

Thanks in advance—curious to hear your thoughts and experiences!

Find elsewhere
🌐
GitHub
github.com › eliben › pykaleidoscope
GitHub - eliben/pykaleidoscope: Implementation of the LLVM tutorial in Python using llvmlite · GitHub
This repository contains a chapter-by-chapter translation of the LLVM tutorial into Python, using the llvmlite package that exposes LLVM to Python.
Starred by 343 users
Forked by 37 users
Languages   Python 99.9% | Vim Script 0.1%
🌐
Hacker News
news.ycombinator.com › item
Codon: A high-performance Python-like compiler using LLVM | Hacker News
December 11, 2022 - Reality-check: Why do you think type hints and type checkers like mypy and pyright take such a long time to get going and even they are not there yet? If this was all so easy with just ignoring some obscure rarely used features then mypy would work with essentially no type annotations, all ...
🌐
Reddit
reddit.com › r/programming › mapping python to llvm
r/programming on Reddit: Mapping Python to LLVM
January 9, 2023 - It's a Codon compiler not a "Python compiler", and it compiles Codon and Codon-compatible Python code, not "Python code". Gotta love when documentation lies and ends up confusing/misleading me, feels a bit too common lately. ... int can become an LLVM i64 (note that this deviates from Python’s arbitrary- width integers, but it turns out 64 bits are more than enough for most applications)
🌐
LLVM
llvm.org › docs › GettingStarted.html
Getting Started with the LLVM System — LLVM 23.0.0git documentation
Contains bindings for the LLVM compiler infrastructure to allow programs written in languages other than C or C++ to take advantage of the LLVM infrastructure. The LLVM project provides language bindings for OCaml and Python.
🌐
LLVM
llvm.org
The LLVM Compiler Infrastructure Project
The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines. The name "LLVM" itself is not an acronym; it is the full name of the project · LLVM began as a research project at the University ...
🌐
PyPI
pypi.org › project › wasmer-compiler-llvm
wasmer-compiler-llvm · PyPI
wasmer is a complete and mature WebAssembly runtime for Python. wasmer_compiler_llvm provides the LLVM compiler to wasmer, so that wasmer is able to compile WebAssembly module.
      » pip install wasmer-compiler-llvm
    
Published   Jan 07, 2022
Version   1.1.0
🌐
Python Developer's Guide
devguide.python.org › clang
Dynamic Analysis with Clang - Python Developer's Guide
August 14, 2021 - Clang is the C, C++ and Objective C front-end for the LLVM compiler. The front-end provides access to LLVM’s optimizer and code generator.
🌐
PyCon US
us.pycon.org › 2016 › schedule › presentation › 1995
Presentation: Wrestling Python into LLVM Intermediate Representation | PyCon 2016 in Portland, OR
Most engineers may prefer to write their machine learning algorithms in Python over C++, so the goal of this project is to make that possible. This talk will go through the steps of writing a comprehensive Python front-end for TupleWare with a focus on the construction of a compiler from a limited subset of Python to LLVM-IR.
🌐
Reddit
reddit.com › r/programming › codon: a high-performance python compiler using llvm
r/programming on Reddit: Codon: a high-performance Python compiler using LLVM
December 8, 2022 - This means that Nuitka is not a standalone compiler, but rather an extension or a replacement of the Python interpreter. You still need to have Python installed on your system to use Nuitka. More replies ... LLVM is great but I'd wish they would simplify compilation and integration of functionality.
🌐
Readthedocs
llvmlite.readthedocs.io › en › latest
llvmlite — llvmlite 0.49.0dev0+29.gaba4d7b.dirty documentation
February 25, 2021 - Compilation and optimization of the module into machine code. The construction of an LLVM module does not call the LLVM C++ API. Rather, it constructs the LLVM intermediate representation (IR) in pure Python.
🌐
Python Developer's Guide
devguide.python.org › advanced-tools › clang
Dynamic Analysis with Clang
June 7, 2022 - Clang is the C, C++ and Objective C front-end for the LLVM compiler. The front-end provides access to LLVM’s optimizer and code generator.
🌐
Eli Bendersky
eli.thegreenplace.net › 2015 › python-version-of-the-llvm-tutorial
Python version of the LLVM tutorial - Eli Bendersky's website
February 8, 2015 - Enter Pykaleidoscope, a project I put on GitHub that follows the steps of the official LLVM tutorial, but implementing the Kaleidoscope compiler in Python, using llvmlite as the binding to LLVM.
🌐
If Not Nil
ifnotnil.com › python
Python LLVM - Python - If Not Nil
August 6, 2021 - I was mildly curious whether anyone has ever attempted to create an llvm compiler for python. This sort of thing is way above my pay grade and I suspect there’s an issue with dynamic typing (although I’ve heard tell of a static type checker for python). At any rate, I came across this page.