diff --git a/doc/manual/i-overview.html b/doc/manual/i-overview.html deleted file mode 100644 index 006c42110fc7b5dd17798b44fe1d51b6186ff43c..0000000000000000000000000000000000000000 --- a/doc/manual/i-overview.html +++ /dev/null @@ -1,88 +0,0 @@ -<h1>Design overview</h1> - -In this document, we will describe how �LPC works and why it was made that -way. Examples in this chapgter will be in C because �LPC is written in C, -so some knowledge of C syntax and semantics is required. - -<p>As mentioned earlier, �LPC is interpreted. To be more precise the �LPC -interpreter compiles �LPC source into <b>byte-code</b>. <b>Byte-code</b> can -be compared to machine language, which the �LPC interpreter will later -execute. For instance, our simple "Hello world" program would roughly -compile to the following bytecode: - -<pre> - mark - push "Hello world\n" - write -</pre> - -<p>For now we don't have to know how these instructions are stored, -instead we will concentrate at what these instructions do. But first -we have to know about the two stacks that �LPC uses. One is a stack of -values each can hold an �LPC value of any type. You could say that it -is an mixed * to use �LPC terminology. This stack hold local -variables, function arguments and much more. This stack will be -refered to as the <b>value stack</b> so not to confuse it with the -<b>marker stack</b>. The marker stack can only hold pointers to -elements in the first stack and is used to remember the start of an -argument list. - -<p>What <b>mark</b> does is that it pushes the number of elements on the -value stack onto the marker stack. Then <b>push</b> will push the string -"Hello world\n" onto the value stack. Then <b>write</b> will take the top -value from the marker stack and the differance between this value and the -number of values on the value stack will tell <b>write</b> how many -arguments it has received. Write will then write the string to stdout and -remove all it's arguments from the stack. - -<p>All functions in �LPC receives their arguments on the stack like this, -builtin and user-defined. - -<h2>The value stack</h2> - -As mentioned the value stack is an array of elements that can hold any value. -Each of these elements is a 'struct svalue' which looks like this: - -<pre> - struct svalue - { - short type; - short subtype; - union anything; - }; -</pre> - -<p>The type is a number representing the type, defines like T_ARRAY -or T_STRING are made to specify which type has which number. The subtype -field is not used by most types and can be ignored for now. The 'union -anything' is a union that can contain a float, integer or a pointer to -a struct containing additional data. - -<p> ... (To be continued) - -<h2>The different types (draft)</h2> - -<dl> -<dt>Integers and Floats -<dd>Integers and Floats are stored directly in the union. -<dt>Strings -<dd>For string values, the union contains a pointer to a struct lpc_string, -this struct is a part of a shared string table. That means that all equal -strings actually point to the same struct. This makes string comparison very -fast, but creating new strings somewhat slow. -<dt>Arrays -<dd>In an array value, the union contains a pointer to a struct array, which -in it's turn contains a number of struct svalues. -<dt>Mappings -<dd>Mappings are structs which contains one pointer to an array of indices -and one pointer to an array of values. These two arrays are sorted so that -lookup can use a binary search algorithm for speed. -<dt>Lists -<dd>Lists works just like mappings, except there is no value array. -<dt>Objects -<dd>Objects are merely structs containing a pointer to the program for this -object and any global variables needed this object needs. -<dt>Programs -<dd>Programs are pointers to a 'struct program'. This struct contains the -<b>byte-code</b> and additional information needed by the interpreter. -</ul> \ No newline at end of file diff --git a/doc/manual/index.html b/doc/manual/index.html deleted file mode 100644 index 13d0a9c00e3263b528ecde1610aef806ab2e4646..0000000000000000000000000000000000000000 --- a/doc/manual/index.html +++ /dev/null @@ -1,75 +0,0 @@ -<h1>The �LPC Programming Language</h1> -<h2>by Lars Aronsson and Fredrik H�binette</h2> - -<h3>What is this?</h3> - -�LPC (Micro L.P.C., sometimes written ulpc or uLPC) is an interpreted, -object-oriented programming language for flexible and yet efficient -application development and prototyping. It features multiple -inheritance, data abstraction, advanced built-in datatypes, such as -associative arrays, dynamic arrays and multi-sets, and high-level -character string and array operations. - -<p>The following documents describe the language: - -<dl> -<dt>�LPC Tutorial -<dt>�LPC Language Reference Manual -<dt>The Design and Implementation of �LPC -</dl> - -<h3>�LPC Tutorial</h3> - -<blockquote><i>This is an introduction to programming in the �LPC -language. Some previous programming experience is -required.</i></blockquote> - -<dl> -<dt><a href="t-hello.html">Hello world</a> -<dt>Variables and Loops -<dt>Strings -<dt>Arrays -<dt>Using files -<dt>Objects and Inheritance -<dt>Spinner -<dt>Appendix A: Where and how to get �LPC -<dt>Appendix B: How to Install the �LPC Distribution -</dl> - -<h3>�LPC Language Reference Manual</h3> - -<blockquote><i>This document describes the details of the �LPC -programming language, in a somewhat semi-cryptic way.</i></blockquote> - -<dl> -<dt>Introduction -<dt>Lexical Conventions -<dt>Syntax Notation -<dt>Identifiers -<dt>Objects and Lvalues -<dt>Type conversion -<dt>Expressions -<dt>Declarations -<dt>Statements -<dt>External Declarations -<dt>Scope and Binding -<dt>Preprocessor -<dt>Grammar -<dt>Standard Library -</dl> - - -<h3>The Design and Implementation of �LPC</h3> - - -<blockquote><i>This document describes the inner workings of the �LPC -implementation, and some of the design decisions we have made. This -can be interesting if you are into computer science, if you have found -strange behavior, or if you want to add your own modules in C that -become part of the �LPC language.</i></blockquote> - -<dl> -<dt>Overview -<dt>Adding Modules to �LPC -<dt>Some Design Decisions -</dl> diff --git a/doc/manual/t-hello.html b/doc/manual/t-hello.html deleted file mode 100644 index 93075cfdaa658cde9154e13d7e34a0e4d8b131c1..0000000000000000000000000000000000000000 --- a/doc/manual/t-hello.html +++ /dev/null @@ -1,66 +0,0 @@ -<h1>Hello world!</h1> - -In this chapter, you will learn to write a complete program in the -�LPC language. All this program does is to print "Hello world!" on -your screen. You can then make additions and changes to the program, -as you learn to handle more features of the language in the following -chapters. - -<p>This is typical for how you develop programs in �LPC: step by step, -making them more advanced, adding functionality, as you go. Since -�LPC is an interpreted language, you don't get lagged by frequent -recompilations. You just change the program, and it is ready to run. - -<p>Enough said! Let's take a look at the program now: - -<pre> - #!/usr/local/bin/ulpc - - int main(int argc, string *argv) - { - write ("Hello world!\n"); - return 0; - } -</pre> - -<p>That's all there is! Use your favorite text editor and save the -results in a file called <b>hello.lpc</b>. - -<p>We are not quite ready to run yet. First, you must use the -<b>chmod</b> command to make your program executable. You only have -to do this once for each program. Here, the dollar sign is your UNIX -prompt, which could also be any odd character (such as % or #). - -<pre> - $ chmod +x hello.lpc - $ hello.lpc - Hello world! - $ -</pre> - -<p>Obviously, our program is a success! Let's try and understand why. - -<p>The first line of <b>hello.lpc</b> starts with the two characters -<b>#!</b> (hash bang) followed by a file name. This is a UNIX trick to -make script programs executable. Normally, scripts are written in -shell commands, awk or perl. All script programs need an interpreter -to read the script commands and execute them. The "hash bang" tells -UNIX that the this is a script file and that the file name of an -interpreter follows. For example, shell scripts use a UNIX shell -/bin/sh as their interpreter, so their first line should be #!/bin/sh. - -<dl> -<dt>NOTE: - -<dd>For this to work properly, the "hash bang" (#!) must be the first -two characters of the file. There must not be any white space before -or empty line above them! - -</dl> - -<p>For �LPC programs, the interpreter is the <b>ulpc</b> program, -which we shall assume is installed in <b>/usr/local/bin</b> -directory. Turn to appendices A and B if this program is not -properly installed on your computer. - -<p>The next few lines of the program ... (to be continued)