diff options
author | Erick Tryzelaar <idadesub@users.sourceforge.net> | 2008-03-30 19:14:31 +0000 |
---|---|---|
committer | Erick Tryzelaar <idadesub@users.sourceforge.net> | 2008-03-30 19:14:31 +0000 |
commit | d564686dff04c329285a68308cdf84df7afd5e37 (patch) | |
tree | 411c465387137144d1c3a367ebcc900f40aa0187 /docs/tutorial/OCamlLangImpl1.html | |
parent | 8dd65058681c3b8c9c7cb1a0885ec452f5e14cd9 (diff) |
Fix some documentation for the tutorial.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48966 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/tutorial/OCamlLangImpl1.html')
-rw-r--r-- | docs/tutorial/OCamlLangImpl1.html | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/docs/tutorial/OCamlLangImpl1.html b/docs/tutorial/OCamlLangImpl1.html index 4b252a411e..c7b0954021 100644 --- a/docs/tutorial/OCamlLangImpl1.html +++ b/docs/tutorial/OCamlLangImpl1.html @@ -219,15 +219,15 @@ type token = </div> <p>Each token returned by our lexer will be one of the token variant values. -An unknown character like '+' will be returned as <tt>Kwd '+'</tt>. If the -curr token is an identifier, the value will be <tt>Ident s</tt>. If the -current token is a numeric literal (like 1.0), the value will be -<tt>Number 1.0</tt>. +An unknown character like '+' will be returned as <tt>Token.Kwd '+'</tt>. If +the curr token is an identifier, the value will be <tt>Token.Ident s</tt>. If +the current token is a numeric literal (like 1.0), the value will be +<tt>Token.Number 1.0</tt>. </p> <p>The actual implementation of the lexer is a collection of functions driven -by a function named <tt>lex</tt>. The <tt>lex</tt> function is called to -return the next token from standard input. We will use +by a function named <tt>Lexer.lex</tt>. The <tt>Lexer.lex</tt> function is +called to return the next token from standard input. We will use <a href="http://caml.inria.fr/pub/docs/manual-camlp4/index.html">Camlp4</a> to simplify the tokenization of the standard input. Its definition starts as:</p> @@ -245,13 +245,13 @@ let rec lex = parser </div> <p> -<tt>lex</tt> works by recursing over a <tt>char Stream.t</tt> to read +<tt>Lexer.lex</tt> works by recursing over a <tt>char Stream.t</tt> to read characters one at a time from the standard input. It eats them as it recognizes -them and stores them in in a <tt>token</tt> variant. The first thing that it -has to do is ignore whitespace between tokens. This is accomplished with the +them and stores them in in a <tt>Token.token</tt> variant. The first thing that +it has to do is ignore whitespace between tokens. This is accomplished with the recursive call above.</p> -<p>The next thing <tt>lex</tt> needs to do is recognize identifiers and +<p>The next thing <tt>Lexer.lex</tt> needs to do is recognize identifiers and specific keywords like "def". Kaleidoscope does this with this a pattern match and a helper function.<p> @@ -300,8 +300,8 @@ and lex_number buffer = parser <p>This is all pretty straight-forward code for processing input. When reading a numeric value from input, we use the ocaml <tt>float_of_string</tt> function -to convert it to a numeric value that we store in <tt>NumVal</tt>. Note that -this isn't doing sufficient error checking: it will raise <tt>Failure</tt> +to convert it to a numeric value that we store in <tt>Token.Number</tt>. Note +that this isn't doing sufficient error checking: it will raise <tt>Failure</tt> if the string "1.23.45.67". Feel free to extend it :). Next we handle comments: </p> |