From 824d7ecd447b3dd06a80bf5664e6012922a7a855 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Wed, 4 Feb 2015 16:10:32 -0800 Subject: [PATCH] Update the README to be actually useful --- README.rst | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.rst b/README.rst index af4cd81..307df8d 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,39 @@ Pykaleidoscope ============== +What is this? +------------- + +LLVM comes with a `great tutorial `_ that builds +a compiler for a simple language called Kaleidoscope. The compiler parses +Kaleidoscope into an AST, from which LLVM code is then generated using the LLVM +IR building APIs. Once we have LLVM IR, it can be JITed to generate machine code +and run it. In other words, convert your language into LLVM IR and leave the +rest to LLVM itself (including world-class optimizations). + +The tutorial is presented in several "chapters" that start with a simple lexer +and build up the language step by step. + +This repository contains a chapter-by-chapter translation of the LLVM tutorial +into Python, using the `llvmlite `_ package +that exposes LLVM to Python. For tips on setting up ``llvmlite`` with LLVM, `see +this blog post +`_. + +How to use this code +-------------------- + +Go through the `LLVM tutorial `_. The files in +this repository are named after tutorial chapters and roughly correspond to the +C++ code presented in the tutorial. In each source file, the ``__main`` section +of code in the bottom is a small sample of usage, and there are also unit tests +that check a variety of cases. + +Version of LLVM, Python and llvmlite +------------------------------------ + +I tested with Python 3.4, LLVM 3.5 and top-of-tree ``llvmlite``. + Testing -------