summaryrefslogtreecommitdiff
path: root/docs/tutorial/OCamlLangImpl5.html
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2011-04-23 00:30:22 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2011-04-23 00:30:22 +0000
commitf5af6ada3b0570db1afc19029cad8fb8320676ef (patch)
tree4df12ad7fe5c5902fd8601d164291a94fa078f10 /docs/tutorial/OCamlLangImpl5.html
parent624dc1d4abf26a3ccd474f85a39058a99a9053ca (diff)
downloadllvm-f5af6ada3b0570db1afc19029cad8fb8320676ef.tar.gz
llvm-f5af6ada3b0570db1afc19029cad8fb8320676ef.tar.bz2
llvm-f5af6ada3b0570db1afc19029cad8fb8320676ef.tar.xz
docs: Introduce cascading style <div> and <p> continued on <h[2-5]>.
<h2>Section Example</h2> <div> <!-- h2+div is applied --> <p>Section preamble.</p> <h3>Subsection Example</h3> <p> <!-- h3+p is applied --> Subsection body </p> <!-- End of section body --> </div> FIXME: Care H5 better. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130040 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/tutorial/OCamlLangImpl5.html')
-rw-r--r--docs/tutorial/OCamlLangImpl5.html36
1 files changed, 18 insertions, 18 deletions
diff --git a/docs/tutorial/OCamlLangImpl5.html b/docs/tutorial/OCamlLangImpl5.html
index 59c17492a3..d356f126a4 100644
--- a/docs/tutorial/OCamlLangImpl5.html
+++ b/docs/tutorial/OCamlLangImpl5.html
@@ -55,7 +55,7 @@ User-defined Operators</li>
<h2><a name="intro">Chapter 5 Introduction</a></h2>
<!-- *********************************************************************** -->
-<div class="doc_text">
+<div>
<p>Welcome to Chapter 5 of the "<a href="index.html">Implementing a language
with LLVM</a>" tutorial. Parts 1-4 described the implementation of the simple
@@ -72,7 +72,7 @@ have an if/then/else expression plus a simple 'for' loop.</p>
<h2><a name="ifthen">If/Then/Else</a></h2>
<!-- *********************************************************************** -->
-<div class="doc_text">
+<div>
<p>
Extending Kaleidoscope to support if/then/else is quite straightforward. It
@@ -112,14 +112,12 @@ Since Kaleidoscope allows side-effects, this behavior is important to nail down.
<p>Now that we know what we "want", lets break this down into its constituent
pieces.</p>
-</div>
-
<!-- ======================================================================= -->
<h4><a name="iflexer">Lexer Extensions for If/Then/Else</a></h4>
<!-- ======================================================================= -->
-<div class="doc_text">
+<div>
<p>The lexer extensions are straightforward. First we add new variants
for the relevant tokens:</p>
@@ -155,7 +153,7 @@ stuff:</p>
<h4><a name="ifast">AST Extensions for If/Then/Else</a></h4>
<!-- ======================================================================= -->
-<div class="doc_text">
+<div>
<p>To represent the new expression we add a new AST variant for it:</p>
@@ -176,7 +174,7 @@ type expr =
<h4><a name="ifparser">Parser Extensions for If/Then/Else</a></h4>
<!-- ======================================================================= -->
-<div class="doc_text">
+<div>
<p>Now that we have the relevant tokens coming from the lexer and we have the
AST node to build, our parsing logic is relatively straightforward. First we
@@ -214,7 +212,7 @@ let rec parse_primary = parser
<h4><a name="ifir">LLVM IR for If/Then/Else</a></h4>
<!-- ======================================================================= -->
-<div class="doc_text">
+<div>
<p>Now that we have it parsing and building the AST, the final piece is adding
LLVM code generation support. This is the most interesting part of the
@@ -331,7 +329,7 @@ directly.</p>
<h4><a name="ifcodegen">Code Generation for If/Then/Else</a></h4>
<!-- ======================================================================= -->
-<div class="doc_text">
+<div>
<p>In order to generate code for this, we implement the <tt>Codegen</tt> method
for <tt>IfExprAST</tt>:</p>
@@ -488,11 +486,13 @@ another useful expression that is familiar from non-functional languages...</p>
</div>
+</div>
+
<!-- *********************************************************************** -->
<h2><a name="for">'for' Loop Expression</a></h2>
<!-- *********************************************************************** -->
-<div class="doc_text">
+<div>
<p>Now that we know how to add basic control flow constructs to the language,
we have the tools to add more powerful things. Lets add something more
@@ -521,13 +521,11 @@ variables, it will get more useful.</p>
<p>As before, lets talk about the changes that we need to Kaleidoscope to
support this.</p>
-</div>
-
<!-- ======================================================================= -->
<h4><a name="forlexer">Lexer Extensions for the 'for' Loop</a></h4>
<!-- ======================================================================= -->
-<div class="doc_text">
+<div>
<p>The lexer extensions are the same sort of thing as for if/then/else:</p>
@@ -557,7 +555,7 @@ support this.</p>
<h4><a name="forast">AST Extensions for the 'for' Loop</a></h4>
<!-- ======================================================================= -->
-<div class="doc_text">
+<div>
<p>The AST variant is just as simple. It basically boils down to capturing
the variable name and the constituent expressions in the node.</p>
@@ -577,7 +575,7 @@ type expr =
<h4><a name="forparser">Parser Extensions for the 'for' Loop</a></h4>
<!-- ======================================================================= -->
-<div class="doc_text">
+<div>
<p>The parser code is also fairly standard. The only interesting thing here is
handling of the optional step value. The parser code handles it by checking to
@@ -624,7 +622,7 @@ let rec parse_primary = parser
<h4><a name="forir">LLVM IR for the 'for' Loop</a></h4>
<!-- ======================================================================= -->
-<div class="doc_text">
+<div>
<p>Now we get to the good part: the LLVM IR we want to generate for this thing.
With the simple example above, we get this LLVM IR (note that this dump is
@@ -669,7 +667,7 @@ expressions, and some basic blocks. Lets see how this fits together.</p>
<h4><a name="forcodegen">Code Generation for the 'for' Loop</a></h4>
<!-- ======================================================================= -->
-<div class="doc_text">
+<div>
<p>The first part of Codegen is very simple: we just output the start expression
for the loop value:</p>
@@ -842,11 +840,13 @@ to our poor innocent language.</p>
</div>
+</div>
+
<!-- *********************************************************************** -->
<h2><a name="code">Full Code Listing</a></h2>
<!-- *********************************************************************** -->
-<div class="doc_text">
+<div>
<p>
Here is the complete code listing for our running example, enhanced with the