llvm.org GIT mirror llvm / 5e6fce1
[Kaleidoscope] Tiny typo fixes Fixes for "lets" references which should be "let's" in the Kaleidoscope tutorial. Patch by: Robin Dupret Differential Revision: https://reviews.llvm.org/D44990 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328772 91177308-0d34-0410-b5e6-96231b3b80d8 Sjoerd Meijer 1 year, 4 months ago
5 changed file(s) with 14 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
1919 `Operator-Precedence
2020 Parsing `_ to
2121 parse the Kaleidoscope language (the latter for binary expressions and
22 the former for everything else). Before we get to parsing though, lets
22 the former for everything else). Before we get to parsing though, let's
2323 talk about the output of the parser: the Abstract Syntax Tree.
2424
2525 The Abstract Syntax Tree (AST)
715715 Full Code Listing
716716 =================
717717
718 Here is the complete code listing for our running example. Because this
718 Here is the complete code listing for our running example. Because this
719719 uses the LLVM libraries, we need to link them in. To do this, we use the
720720 `llvm-config `_ tool to inform
721721 our makefile/command line about which options to use:
260260 Code generation for prototypes and functions must handle a number of
261261 details, which make their code less beautiful than expression code
262262 generation, but allows us to illustrate some important points. First,
263 lets talk about code generation for prototypes: they are used both for
263 let's talk about code generation for prototypes: they are used both for
264264 function bodies and external function declarations. The code starts
265265 with:
266266
202202 experiment with passes from the command line, so you can see if they do
203203 anything.
204204
205 Now that we have reasonable code coming out of our front-end, lets talk
205 Now that we have reasonable code coming out of our front-end, let's talk
206206 about executing it!
207207
208208 Adding a JIT Compiler
334334 ``InitializeModuleAndPassManager``) is still open and waiting for new code to be
335335 added.
336336
337 With just these two changes, lets see how Kaleidoscope works now!
337 With just these two changes, let's see how Kaleidoscope works now!
338338
339339 ::
340340
513513 the JIT and open a new module. In HandleExtern, we just need to add one line to
514514 add the prototype to FunctionProtos.
515515
516 With these changes made, lets try our REPL again (I removed the dump of the
516 With these changes made, let's try our REPL again (I removed the dump of the
517517 anonymous functions this time, you should get the idea by now :) :
518518
519519 ::
2626 it shows how easy it is to "grow" a language over time, incrementally
2727 extending it as new ideas are discovered.
2828
29 Before we get going on "how" we add this extension, lets talk about
29 Before we get going on "how" we add this extension, let's talk about
3030 "what" we want. The basic idea is that we want to be able to write this
3131 sort of thing:
3232
5353 Kaleidoscope allows side-effects, this behavior is important to nail
5454 down.
5555
56 Now that we know what we "want", lets break this down into its
56 Now that we know what we "want", let's break this down into its
5757 constituent pieces.
5858
5959 Lexer Extensions for If/Then/Else
175175 introduce new concepts. All of the code above has been thoroughly
176176 described in previous chapters.
177177
178 To motivate the code we want to produce, lets take a look at a simple
178 To motivate the code we want to produce, let's take a look at a simple
179179 example. Consider:
180180
181181 ::
275275 Phi nodes directly, if convenient. In this case, it is really
276276 easy to generate the Phi node, so we choose to do it directly.
277277
278 Okay, enough of the motivation and overview, lets generate code!
278 Okay, enough of the motivation and overview, let's generate code!
279279
280280 Code Generation for If/Then/Else
281281 --------------------------------
428428 =====================
429429
430430 Now that we know how to add basic control flow constructs to the
431 language, we have the tools to add more powerful things. Lets add
431 language, we have the tools to add more powerful things. Let's add
432432 something more aggressive, a 'for' expression:
433433
434434 ::
449449 to return, we'll just define the loop as always returning 0.0. In the
450450 future when we have mutable variables, it will get more useful.
451451
452 As before, lets talk about the changes that we need to Kaleidoscope to
452 As before, let's talk about the changes that we need to Kaleidoscope to
453453 support this.
454454
455455 Lexer Extensions for the 'for' Loop
618618 }
619619
620620 This loop contains all the same constructs we saw before: a phi node,
621 several expressions, and some basic blocks. Lets see how this fits
621 several expressions, and some basic blocks. Let's see how this fits
622622 together.
623623
624624 Code Generation for the 'for' Loop
302302 Now we have useful user-defined binary operators. This builds a lot on
303303 the previous framework we built for other operators. Adding unary
304304 operators is a bit more challenging, because we don't have any framework
305 for it yet - lets see what it takes.
305 for it yet - let's see what it takes.
306306
307307 User-defined Unary Operators
308308 ============================