changeset 389:497d4ef0a89f

documentation work
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 24 Apr 2015 12:25:50 -0600
parents 12ee9a336b95
children bfbbce690bba
files website/src/diff.html.luan website/src/manual.html.luan
diffstat 2 files changed, 56 insertions(+), 75 deletions(-) [+]
line wrap: on
line diff
diff -r 12ee9a336b95 -r 497d4ef0a89f website/src/diff.html.luan
--- a/website/src/diff.html.luan	Thu Apr 23 18:54:35 2015 -0600
+++ b/website/src/diff.html.luan	Fri Apr 24 12:25:50 2015 -0600
@@ -131,19 +131,19 @@
 
 <p>Luan has no numeric <b>for</b> statement.  Luan only has generic <b>for</b> statement.  Instead of the numeric <b>for</b> statement, Luan uses the <tt>range</tt> function in a generic <b>for</b> statement like this:</p>
 
-<tt><pre>
+<p><tt><pre>
 	for i in range(from,to,step) do <i>block</i> end
-			</pre></tt>
+</pre></tt></p>
 
-			<p>The Luan generic <b>for</b> statement is simpler than the Lua version because Luan only uses and expression, not an explist.  So a <b>for</b> statement like:</p>
+<p>The Luan generic <b>for</b> statement is simpler than the Lua version because Luan only uses and expression, not an explist.  So a <b>for</b> statement like:</p>
 
-			<tt><pre>
+<p><tt><pre>
 	for var_1, ยทยทยท, var_n in exp do block end
-			</pre></tt>
+</pre></tt></p>
 
-			<p>is equivalent to the code:</p>
+<p>is equivalent to the code:</p>
 
-			<tt><pre>
+<p><tt><pre>
 	do
 		local f = exp
 		while true do
@@ -152,37 +152,37 @@
 			block
 		end
 	end
-</pre></tt>
+</pre></tt></p>
 
 <h4 margin-top="1em"><a name="logical">Logical Statements</a></h4>
 
 <p>Unlike Lua, Luan allows <b>or</b> and <b>and</b> expressions to be stand-alone statements.  This is useful in cases like this:</p>
 
-<tt><pre>
+<p><tt><pre>
 	x==5 or error "x should be 5"
-</pre></tt>
+</pre></tt></p>
 
 <h4 margin-top="1em"><a name="template-stmt">Template Statements</a></h4>
 
 <p>Template statements are based on <a href="#template-expr">template exressions</a> and provide the full equivalent of <a href="http://en.wikipedia.org/wiki/JavaServer_Pages">JSP</a> but in a general way.  Template statements write the equivalent template exression to standard output.  For example:</p>
 
-<tt><pre><%=Html.encode[[
+<p><tt><pre><%=Html.encode[[
 	local name = "Bob"
 	%>
 	Hello <%=name%>!
 	Bye <%=name%>.
 	<%
-]]%></pre></tt>
+]]%></pre></tt></p>
 
 <p>is equivalent to the code:</p>
 
-<tt><pre><%=Html.encode[[
+<p><tt><pre><%=Html.encode[[
 	local name = "Bob"
 	require("luan:Io").stdout.write( %>
 	Hello <%=name%>!
 	Bye <%=name%>.
 	<% )
-]]%></pre></tt>
+]]%></pre></tt></p>
 
 <h3 margin-top="1em"><a name="expr">Expressions</a></h3>
 
@@ -202,17 +202,17 @@
 
 <p>Luan adds a new type of expression based on <a href="http://en.wikipedia.org/wiki/JavaServer_Pages">JSP</a> called template expressions.  Template expressions return multiple values.  Here is an example:</p>
 
-<tt><pre><%=Html.encode[[
+<p><tt><pre><%=Html.encode[[
 	local name = "Bob"
 	write( %>Hello <%=name%>!<% )
-]]%></pre></tt>
+]]%></pre></tt></p>
 
 <p>This is equivalent to the code:</p>
 
-<tt><pre>
+<p><tt><pre>
 	local name = "Bob"
 	write( "Hello ", name, "!" )
-</pre></tt>
+</pre></tt></p>
 
 <p>The strings in template expressions may be multiple lines.</p>
 
diff -r 12ee9a336b95 -r 497d4ef0a89f website/src/manual.html.luan
--- a/website/src/manual.html.luan	Thu Apr 23 18:54:35 2015 -0600
+++ b/website/src/manual.html.luan	Fri Apr 24 12:25:50 2015 -0600
@@ -48,6 +48,12 @@
 	<ul>
 		<li><a href="#lex">Lexical Conventions</a></li>
 		<li><a href="#vars">Variables</a></li>
+		<li>
+			<a href="#stmts">Statements</a>
+			<ul>
+				<li><a href="#blocks">Blocks</a></li>
+			</ul>
+		</li>
 	</ul>
 </div>
 
@@ -525,12 +531,12 @@
 and cannot be used as names:
 
 
-<p><pre>
+<p><tt><pre>
      and       break     do        else      elseif    end
      false     for       function  goto      if        in
      local     nil       not       or        repeat    return
      then      true      until     while
-</pre></p>
+</pre></tt></p>
 
 <p>
 Luan is a case-sensitive language:
@@ -541,13 +547,13 @@
 <p>
 The following strings denote other tokens:
 
-<p><pre>
+<p><tt><pre>
      +     -     *     /     %     ^     #
      &amp;     ~     |     &lt;&lt;    &gt;&gt;    //
      ==    ~=    &lt;=    &gt;=    &lt;     &gt;     =
      (     )     {     }     [     ]     ::
      ;     :     ,     .     ..    ...
-</pre></p>
+</pre></tt></p>
 
 <p>
 <i>Literal strings</i>
@@ -626,7 +632,7 @@
 As an example
 the five literal strings below denote the same string:
 
-<p><pre>
+<p><tt><pre>
      a = 'alo\n123"'
      a = "alo\n123\""
      a = '\97lo\10\04923"'
@@ -635,7 +641,7 @@
      a = [==[
      alo
      123"]==]
-</pre></p>
+</pre></tt></p>
 
 <p>
 A <i>numerical constant</i> (or <i>numeral</i>)
@@ -652,17 +658,17 @@
 otherwise it denotes an integer.
 Examples of valid integer constants are
 
-<p><pre>
+<p><tt><pre>
      3   345   0xff   0xBEBADA
-</pre></p>
+</pre></tt></p>
 
 <p>
 Examples of valid float constants are
 
-<p><pre>
+<p><tt><pre>
      3.0     3.1416     314.16e-2     0.31416E1     34e1
      0x0.1E  0xA23p-4   0X1.921FB54442D18P+1
-</pre></p>
+</pre></tt></p>
 
 <p>
 A <i>comment</i> starts with a double hyphen (<tt>--</tt>)
@@ -691,9 +697,9 @@
 (or a function's formal parameter,
 which is a particular kind of local variable):
 
-<p><pre>
+<p><tt><pre>
 	var ::= Name
-</pre></p>
+</pre></tt></p>
 
 <p>
 Name denotes identifiers, as defined in <a href="#3.1">&sect;3.1</a>.
@@ -714,9 +720,9 @@
 <p>
 Square brackets are used to index a table:
 
-<p><pre>
+<p><tt><pre>
 	var ::= prefixexp &lsquo;<b>[</b>&rsquo; exp &lsquo;<b>]</b>&rsquo;
-</pre></p>
+</pre></tt></p>
 
 <p>
 The meaning of accesses to table fields can be changed via metatables.
@@ -732,9 +738,9 @@
 The syntax <tt>var.Name</tt> is just syntactic sugar for
 <tt>var["Name"]</tt>:
 
-<p><pre>
+<p><tt><pre>
 	var ::= prefixexp &lsquo;<b>.</b>&rsquo; Name
-</pre></p>
+</pre></tt></p>
 
 <p>
 An access to a global variable <tt>x</tt>
@@ -746,10 +752,10 @@
 
 
 
-<h2>3.3 &ndash; <a name="3.3">Statements</a></h2>
-
-<p>
-Lua supports an almost conventional set of statements,
+<h3 margin-top="1em"><a name="stmts">Statements</a></h3>
+
+<p>
+Luan supports an almost conventional set of statements,
 similar to those in Pascal or C.
 This set includes
 assignments, control structures, function calls,
@@ -757,59 +763,34 @@
 
 
 
-<h3>3.3.1 &ndash; <a name="3.3.1">Blocks</a></h3>
+<h3 margin-top="1em"><a name="blocks">Blocks</a></h3>
 
 <p>
 A block is a list of statements,
 which are executed sequentially:
 
-<pre>
+<p><tt><pre>
 	block ::= {stat}
-</pre><p>
-Lua has <em>empty statements</em>
+</pre></tt></p>
+
+<p>
+Luan has <i>empty statements</i>
 that allow you to separate statements with semicolons,
 start a block with a semicolon
 or write two semicolons in sequence:
 
-<pre>
+<p><tt><pre>
 	stat ::= &lsquo;<b>;</b>&rsquo;
-</pre>
-
-<p>
-Function calls and assignments
-can start with an open parenthesis.
-This possibility leads to an ambiguity in Lua's grammar.
-Consider the following fragment:
-
-<pre>
-     a = b + c
-     (print or io.write)('done')
-</pre><p>
-The grammar could see it in two ways:
-
-<pre>
-     a = b + c(print or io.write)('done')
-     
-     a = b + c; (print or io.write)('done')
-</pre><p>
-The current parser always sees such constructions
-in the first way,
-interpreting the open parenthesis
-as the start of the arguments to a call.
-To avoid this ambiguity,
-it is a good practice to always precede with a semicolon
-statements that start with a parenthesis:
-
-<pre>
-     ;(print or io.write)('done')
-</pre>
+</pre></tt></p>
 
 <p>
 A block can be explicitly delimited to produce a single statement:
 
-<pre>
+<p><tt><pre>
 	stat ::= <b>do</b> block <b>end</b>
-</pre><p>
+</pre></tt></p>
+
+<p>
 Explicit blocks are useful
 to control the scope of variable declarations.
 Explicit blocks are also sometimes used to