diff --git a/docs/source/doc/kaleidoscope/PythonLangImpl1.rst b/docs/source/doc/kaleidoscope/PythonLangImpl1.rst index 9259d42..54ca0b6 100644 --- a/docs/source/doc/kaleidoscope/PythonLangImpl1.rst +++ b/docs/source/doc/kaleidoscope/PythonLangImpl1.rst @@ -26,7 +26,7 @@ We've tried to put this tutorial together in a way that makes chapters easy to skip over if you are already familiar with or are uninterested in the various pieces. The structure of the tutorial is: -- **`Chapter 1 <#language>`_: Introduction to the Kaleidoscope +- :ref:`Chapter 1 `: **Introduction to the Kaleidoscope language, and the definition of its Lexer** -- This shows where we are going and the basic functionality that we want it to do. In order to make this tutorial maximally understandable and hackable, we @@ -34,44 +34,44 @@ in the various pieces. The structure of the tutorial is: parser generators. LLVM obviously works just fine with such tools, feel free to use one if you prefer. -- **`Chapter 2 `_: Implementing a Parser and +- `Chapter 2 `_: **Implementing a Parser and AST** -- With the lexer in place, we can talk about parsing techniques and basic AST construction. This tutorial describes recursive descent parsing and operator precedence parsing. Nothing in Chapters 1 or 2 is LLVM-specific, the code doesn't even import the LLVM modules at this point. :) -- **`Chapter 3 `_: Code generation to LLVM IR** +- `Chapter 3 `_: **Code generation to LLVM IR** -- With the AST ready, we can show off how easy generation of LLVM IR really is. -- **`Chapter 4 `_: Adding JIT and Optimizer +- `Chapter 4 `_: **Adding JIT and Optimizer support** -- Because a lot of people are interested in using LLVM as a JIT, we'll dive right into it and show you the 3 lines it takes to add JIT support. LLVM is also useful in many other ways, but this is one simple and "sexy" way to shows off its power. :) -- **`Chapter 5 `_: Extending the Language: +- `Chapter 5 `_: **Extending the Language: Control Flow** -- With the language up and running, we show how to extend it with control flow operations (if/then/else and a 'for' loop). This gives us a chance to talk about simple SSA construction and control flow. -- **`Chapter 6 `_: Extending the Language: +- `Chapter 6 `_: **Extending the Language: User-defined Operators** -- This is a silly but fun chapter that talks about extending the language to let the user program define their own arbitrary unary and binary operators (with assignable precedence!). This lets us build a significant piece of the "language" as library routines. -- **`Chapter 7 `_: Extending the Language: +- `Chapter 7 `_: **Extending the Language: Mutable Variables** -- This chapter talks about adding user-defined local variables along with an assignment operator. The interesting part about this is how easy and trivial it is to construct SSA form in LLVM: no, LLVM does *not* require your front-end to construct SSA form! -- **`Chapter 8 `_: Conclusion and other useful +- `Chapter 8 `_: **Conclusion and other useful LLVM tidbits** -- This chapter wraps up the series by talking about potential ways to extend the language, but also includes a bunch of pointers to info about "special topics" like adding garbage @@ -94,8 +94,10 @@ play with languages! -------------- -The Basic Language # {#language} -================================ +.. _chapter1anchor: + +The Basic Language +==================== This tutorial will be illustrated with a toy language that we'll call "`Kaleidoscope `_\ " (derived @@ -152,7 +154,7 @@ Lets dive into the implementation of this language! -------------- -The Lexer # {#lexer} +The Lexer ==================== When it comes to implementing a language, the first thing needed is the