Browse Source

Updated some parts of documentation

Yentl Van Tendeloo 8 years ago
parent
commit
9d5dbb7566
8 changed files with 28 additions and 342 deletions
  1. 2 82
      doc/actionlanguage.rst
  2. 0 14
      doc/advanced.rst
  3. 0 99
      doc/examples.rst
  4. 5 114
      doc/howto.rst
  5. 5 10
      doc/index.rst
  6. 6 4
      doc/installation.rst
  7. 10 17
      doc/internal.rst
  8. 0 2
      doc/upload.sh

+ 2 - 82
doc/actionlanguage.rst

@@ -6,12 +6,10 @@ This language serves as a nicer representation of the underlying Modelverse Grap
 The action language gets parsed by the parser, resulting in a kind of abstract syntax graph.
 The action language gets parsed by the parser, resulting in a kind of abstract syntax graph.
 This abstract syntax graph highly resembles an executable graph in the Modelverse Graph Language.
 This abstract syntax graph highly resembles an executable graph in the Modelverse Graph Language.
 
 
-Users will mainly use this language to write actions and constraints, but maybe also to implement their own interfaces, or override core functionality of the Modelverse.
+Users will mainly use this language to write actions and constraints, or even model operations.
 
 
 .. warning::
 .. warning::
-   The current parser is unable to handle whitespaces in a general way.
-   As such, all indentation needs to be done using tabs, and the difference needs to be exactly 1.
-   This is different from Python, where tabs and whitespaces can be mixed, and the number can even vary.
+   The current action language compiler is rather basic and contains quite some problems.
 
 
 Files
 Files
 -----
 -----
@@ -236,81 +234,3 @@ User input and output is done through the keyworded operations *input()* and *ou
 
 
 All I/O is done using queues: the value is only read and written to a specific place in the Modelverse.
 All I/O is done using queues: the value is only read and written to a specific place in the Modelverse.
 To actually read or write it at the client side, these special places should be accessed through dedicated Modelverse operations.
 To actually read or write it at the client side, these special places should be accessed through dedicated Modelverse operations.
-
-Examples
---------
-
-We now show some simple code fragments written in valid Action Language code.
-As this code is directly executable in the Modelverse, the main function is always called "main" and all includes are also present.
-We do not currently handle how to execute this code: this is explained further on.
-
-Fibonacci
-^^^^^^^^^
-
-The Fibonacci code is fairly simple.
-First, the primitives are imported to make sure that we know about all operations on primitives.
-Then, a function *fib* is defined, which will recursively compute the specified Fibonacci number.
-This is wrapped by a *main* function, which takes input from the user and outputs the result of the *fib* function.
-
-This code looks as follows::
-
-    include "primitives.alh"
-
-    Integer function fib(param : Integer):
-        if (param <= 2):
-            return 1!
-        else:
-            return fib(param - 1) + fib(param - 2)!
-
-    Void function main():
-        while(True):
-            output(fib(input()))
-        return!
-
-Factorial
-^^^^^^^^^
-
-Similarly, the code for computing a factorial is given below::
-
-    include "primitives.alh"
-
-    Integer function factorial(n : Integer):
-        if(n <= 1):
-            return 1!
-        else:
-            return n * factorial(n - 1)!
-
-    Void function main():
-        while(True):
-            output(factorial(input()))
-        return!
-
-Binary to decimal converter
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-A simple binary to decimal converter is given below::
-
-    include "primitives.alh"
-
-    Integer function b2d(param : String):
-        Integer value
-        value = 0
-        Integer length
-        length = string_len(param)
-        Integer counter
-        counter = integer_subtraction(length, 1)
-        Integer accumul
-        accumul = 1
-
-        while (counter >= 0):
-            if (string_get(param, counter) == "1"):
-                value = integer_addition(value, accumul)
-            accumul = integer_multiplication(accumul, 2)
-            counter = integer_subtraction(counter, 1)
-
-        return value!
-
-    Void function main():
-        while(True):
-            output(b2d(input()))
-        return!

+ 0 - 14
doc/advanced.rst

@@ -1,14 +0,0 @@
-Advanced examples
-=================
-
-These advanced examples show you how the core algorithms of the Modelverse are implemented and how you can potentially modify them.
-This part is still TODO, since this is probably not of interest to you.
-
-Inheritance Semantics
----------------------
-
-Instantiation Semantics
------------------------
-
-Conformance Semantics
----------------------

+ 0 - 99
doc/examples.rst

@@ -1,99 +0,0 @@
-Examples
-========
-
-To run this code, store it in a file (*e.g.*, test.alc), and execute the following commands::
-
-    python scripts/run_local_modelverse.py 8001 &
-    python scripts/make_parallel.py http://localhost:8001 test test.alc bootstrap/primitives.alc
-    python scripts/prompt.py
-
-In the prompt, log on to http://localhost:8001 as user *test*.
-Now, all input you send, will be caught in the *input()* calls seen in the code.
-Results will also be printed.
-
-Note that all content will, by default, be typed as string.
-If you want to send integers or so, prepend the input with a backslash (\\), which allows you to directly input the JSON code.
-For example, input *5* will be received as the string "5".
-To send the integer 5, the input should be *\\5*.
-
-Uploading a model, and using it, is very similar to what you usually do.
-The exception is that your model will be added before any code is executed.
-That way, you can just execute the same code, but include a model in it.
-
-The command for this is (instead of the *make_all.py* script)::
-
-    python scripts/execute_model.py http://localhost:8001 test bootstrap/*.alc integration/code/pn_interface.alc integration/code/rpgame.mvc
-
-This should **NOT** be used to upload all types of models during execution, as it will anonymously create the model.
-The model is only visible in the internals of the Modelverse, and not visible to any user, as it wasn't taken into account in the Modelverse Formalism Graph (in the MvC).
-
-Fibonacci Server
-----------------
-
-The first example is a simple Fibonacci server.
-The code is identical to the action language example from before, as this already included the *server* part (*i.e.*, the while loop).
-Now we will just connect to it using *prompt.py* and try out the code directly.
-
-The code is repeated below::
-
-    include "primitives.alh"
-
-    Integer function fib(param : Integer):
-        if (param <= 2):
-            return 1!
-        else:
-            return fib(param - 1) + fib(param - 2)!
-
-    Void function main():
-        while(True):
-            output(fib(input()))
-
-To run this code, save it to a file (*e.g.*, fibonacci.alc) and execute the following command::
-
-    python scripts/run_local_modelverse.py 8001
-    
-Now, the Modelverse is running, but we still need to upload our code.
-To compile the file, together with the primitives.alc file, execute the following command::
-
-    python scripts/make_parallel.py http://localhost:8001 test fibonacci.alc bootstrap/primitives.alc
-
-When this finishes, the Modelverse now stores a copy of our code in its own format.
-The Modelverse will automatically create the user *test* and start executing the *main* function as this user.
-We can therefore simply connect to the Modelverse as the *test* user and start seeing the responses.
-To start the prompt, execute the following command::
-
-    python scripts/prompt.py
-    
-In this prompt tool, you first have to configure the location of the Modelverse and the username.
-The defaults should be fine, so just press <return> twice.
-After that, you are in direct connection with the Modelverse.
-Each message you type in, is made available in the *input()* function of the code.
-Remember that, to send integers, you have to prefix this with a backslash (\\).
-To get, for example, the 1st Fibonacci number, type in the command::
-
-    \1
-
-You will now see the following.
-
-.. image:: img/prompt_fibonacci.png
-
-Since we are in an unconditional loop, you can send as many requests as you want, as long as they are understandable by the *fib* function.
-
-.. image:: img/prompt_fibonacci_more.png
-
-Inputting a string directly, such as *1* instead of *\\1*, will make the Modelverse crash on the execution of this code.
-This is normal, though in the future the Modelverse will keep running for other users: only the current user's code will be interrupted.
-
-Modelling Server
-----------------
-
-The simple Fibonacci server is not very relevant to the primary concern of the Modelverse: (meta-)modelling.
-But since we can create whatever kind of server we want, a simple (meta-)modelling server is created.
-The code offers an interface for users to execute modelling operations.
-The interface itself mostly just relays the incoming messages and operations to the internal modelling library.
-
-The full code is shown in the :download:`MvC Core Algorithm <../core/core_algorithm.alc>`.
-
-Its behaviour is not too complex, as it relays most operations to the library functions.
-Nonetheless, it implements most operations related to user access control and user management in general.
-When changes need to be made to the interface (*e.g.*, make it computer-readable instead of human-readable), only this file's output statements should be altered.

+ 5 - 114
doc/howto.rst

@@ -4,51 +4,7 @@ How to run
 Running the Modelverse is all done through the use of scripts to coordinate the three different projects.
 Running the Modelverse is all done through the use of scripts to coordinate the three different projects.
 
 
 The following scripts are included by default.
 The following scripts are included by default.
-
-check_objects.py
-----------------
-
-Checks whether all compiled objects can be found, and if their symbol table does not contain undefined references.
-This script cannot be executed directly and is only a helper.
-
-compile.py
-----------
-
-Compiles the provided code with the selected mode.
-This should also not be called by end-tasks, though it is possible.
-
-Invocation::
-
-    python scripts/compile.py address file taskname object mode
-
-============== ====================================== =====================
-Parameter name Description                            Example              
-============== ====================================== =====================
-address        Address of the Modelverse              http://localhost:8001
-file           File to be compiled                    file.alc             
-taskname       Taskname to use when compiling         test_task            
-object         Object name to export to               object.o             
-mode           Either CO (constructors) or PO (graph) PO                   
-============== ====================================== =====================
-
-execute_model.py
-----------------
-
-Compile a model and action language files together, executing the action language.
-First, all models are added, and then the action language is executed, starting at function "main".
-Models being created are temporary, so they need to be exported before they can be accessed in the action language.
-
-Invocation::
-
-    python scripts/execute_model.py address taskname file1 file2 ...
-
-============== ======================================= =====================
-Parameter name Description                             Example
-============== ======================================= =====================
-address        Address of the Modelverse               http://localhost:8001
-taskname       Taskname to use when compiling          test
-file           File to compile (either .mvc or .alc)   test.alc
-============== ======================================= =====================
+Despite the various files, only *run_local_modelverse.py* is required for most cases.
 
 
 fix_files.py
 fix_files.py
 ------------
 ------------
@@ -84,58 +40,6 @@ Invocation::
     
     
     python scripts/generate_bootstrap.py
     python scripts/generate_bootstrap.py
 
 
-link_and_load.py
-----------------
-
-This takes a set of objects in the Modelverse, links them together in a single "executable" and executes it immediately.
-Generally not needed by end-tasks.
-
-Invocation::
-
-    python scripts/link_and_load.py address taskname object1 object2 ...
-
-============== ======================================= =====================
-Parameter name Description                             Example
-============== ======================================= =====================
-address        Address of the Modelverse               http://localhost:8001
-taskname       Taskname to use when compiling          test
-object         File to compile (either .mvc or .alc)   test.alc
-============== ======================================= =====================
-
-make_all.py
------------
-
-Compile a set of files and executes them immediately.
-
-Invocation::
-
-    python scripts/make_all.py address taskname file1 file2 ...
-
-============== ======================================= =====================
-Parameter name Description                             Example
-============== ======================================= =====================
-address        Address of the Modelverse               http://localhost:8001
-taskname       Taskname to use when compiling          test
-file           File to compile (either .mvc or .alc)   test.alc
-============== ======================================= =====================
-
-make_parallel.py
-----------------
-
-A parallel version of make_all.py.
-
-Invocation::
-
-    python scripts/make_parallel.py address taskname file1 file2 ...
-
-============== ======================================= =====================
-Parameter name Description                             Example
-============== ======================================= =====================
-address        Address of the Modelverse               http://localhost:8001
-taskname       Taskname to use when compiling          test
-file           File to compile (either .mvc or .alc)   test.alc
-============== ======================================= =====================
-
 prompt.py
 prompt.py
 ---------
 ---------
 
 
@@ -144,6 +48,8 @@ You can log in as a specific task and start sending input messages to the Modelv
 All output sent by the Modelverse will be printed in the console.
 All output sent by the Modelverse will be printed in the console.
 There is no logic in the prompt itself, making it completely generic.
 There is no logic in the prompt itself, making it completely generic.
 
 
+While this is not the most usable way of communicating with the Modelverse, it provides a minimal interface.
+
 Invocation::
 Invocation::
 
 
     python scripts/prompt.py
     python scripts/prompt.py
@@ -156,16 +62,12 @@ This combines MvK and MvS at the same system, and actually makes a direct link b
 While this is kind of a hack at the moment, it is really necessary for performance.
 While this is kind of a hack at the moment, it is really necessary for performance.
 To split them up, there just needs to be a statechart in between both of them (which is already written and working).
 To split them up, there just needs to be a statechart in between both of them (which is already written and working).
 
 
+The port option is optional, and defaults to 8001.
+
 Invocation::
 Invocation::
 
 
     python scripts/run_local_modelverse.py port
     python scripts/run_local_modelverse.py port
 
 
-============== ============================== =======
-Parameter name Description                    Example
-============== ============================== =======
-port           Port to host the Modelverse on 8001
-============== ============================== =======
-
 run_tests.py
 run_tests.py
 ------------
 ------------
 
 
@@ -174,14 +76,3 @@ Run the tests for all parts of the Modelverse.
 Invocation::
 Invocation::
 
 
     python scripts/run_tests.py
     python scripts/run_tests.py
-
-run_MvC_server.py
------------------
-
-Run the Modelverse with a modelling interface pre-loaded and fully operational.
-This is probably the only command you will need to start the Modelverse server on your local machine.
-You are advised to check the global variables of the script for all configuration parameters, such as the server port and the username and password of the root user.
-
-Invocation::
-
-    python scripts/run_MvC_server.py

+ 5 - 10
doc/index.rst

@@ -3,8 +3,8 @@
    You can adapt this file completely to your liking, but it should at least
    You can adapt this file completely to your liking, but it should at least
    contain the root `toctree` directive.
    contain the root `toctree` directive.
 
 
-Welcome to Modelverse's documentation!
-======================================
+Welcome to the Modelverse documentation!
+========================================
 
 
 Contents:
 Contents:
 
 
@@ -12,15 +12,10 @@ Contents:
    :maxdepth: 2
    :maxdepth: 2
     
     
    Installation <installation>
    Installation <installation>
-   Modelverse components <components>
    How to run <howto>
    How to run <howto>
+   Modelverse components <components>
    Action Language <actionlanguage>
    Action Language <actionlanguage>
    Modelling Language <modellanguage>
    Modelling Language <modellanguage>
-   Examples <examples>
-   Advanced examples <advanced>
-   Modelverse core <mvc>
-   Mini modify <mini_modify>
+   Wrappers <wrappers>
    Common problems and solutions <problems>
    Common problems and solutions <problems>
-   Internal workings <internal>
-   Interface <interface>
-   Network communication models <communication_models>
+   Internals <internal>

+ 6 - 4
doc/installation.rst

@@ -1,7 +1,6 @@
 Installation
 Installation
 ============
 ============
 
 
-
 Dependencies
 Dependencies
 ------------
 ------------
 
 
@@ -34,20 +33,23 @@ Tests
 -----
 -----
 
 
 To make sure that everything is working correctly, you can execute the tests with the script *scripts/run_tests.sh*.
 To make sure that everything is working correctly, you can execute the tests with the script *scripts/run_tests.sh*.
-Total execution time is rather slow, even with all advanced performance optimizations (e.g., 1200 seconds on a i5-4570 using PyPy).
 
 
 Executing the tests is as simple as the following command::
 Executing the tests is as simple as the following command::
 
 
     python scripts/run_tests.py
     python scripts/run_tests.py
 
 
 This will run a set of tests for all different projects.
 This will run a set of tests for all different projects.
+Note that this also causes some bootstrap files to be created, which might take some time on slow machines.
+A faster alternative is to only run the overall tests::
+
+    python -m pytest integration
 
 
 PyPy
 PyPy
 ^^^^
 ^^^^
 
 
 The default way of executing tests is probably through CPython.
 The default way of executing tests is probably through CPython.
-Note, however, that CPython is a very slow implementation of Python, which makes everything in the Modelverse slower.
-While it is not impossible to use CPython, using PyPy is highly recommended for the server!
+Note, however, that CPython is a slow implementation of Python, which makes everything in the Modelverse slower.
+While it is not impossible to use CPython, using PyPy is recommended for the server!
 Nonetheless, PyPy is often not the default interpreter.
 Nonetheless, PyPy is often not the default interpreter.
 You will therefore have to explicitly give control to PyPy instead of CPython.
 You will therefore have to explicitly give control to PyPy instead of CPython.
 
 

+ 10 - 17
doc/internal.rst

@@ -25,13 +25,6 @@ The Modelverse graph is then stored in RDF representation and all operations on
 Due to this level of indirection, performance is extremely slow.
 Due to this level of indirection, performance is extremely slow.
 To increase performance, we would likely have to make more *composite* operations, or even group different requests together internally.
 To increase performance, we would likely have to make more *composite* operations, or even group different requests together internally.
 
 
-Status codes
-^^^^^^^^^^^^
-
-The MvS returns, apart from its actual return value, a status code for the request.
-This value is not used by the MvK at all, since sometimes a request is expected to give an error (*e.g.*, checking whether an element is present).
-When debugging the MvS, however, these status codes can come in handy.
-
 Modelverse Kernel
 Modelverse Kernel
 -----------------
 -----------------
 
 
@@ -101,6 +94,16 @@ Whereas primitives are required for a functional Modelverse, precompiled functio
 This is interesting, since with precompiled functions, no intermediate values will be visible.
 This is interesting, since with precompiled functions, no intermediate values will be visible.
 Additionally, precompiled functions cannot be changed, as they are Python code instead of being explicitly modelled.
 Additionally, precompiled functions cannot be changed, as they are Python code instead of being explicitly modelled.
 
 
+Modelling operations
+^^^^^^^^^^^^^^^^^^^^
+
+Apart from the simple action language interpreter presented before, the Modelverse State is loaded with modelling logic.
+This includes common functions, such as conformance checking, model transformation, and instantiation.
+As the code is loaded in the MvS by default, the MvK will automatically start executing that code.
+Therefore, most users will only experience the Modelverse as a modelling environment.
+Nonetheless, the Modelverse Kernel is more generic than this, and would also allow for users to define their own interface.
+As all aspects of the Modelverse are explicitly modelled, it is possible to alter the pre-loaded model and thus update the built-in behaviour.
+
 Modelverse Interface
 Modelverse Interface
 --------------------
 --------------------
 
 
@@ -139,16 +142,6 @@ This is bad if the interface suddenly accepts new keywords or removes support fo
 During the execution of the visitor, it would already be possible to start transmitting the list to the Modelverse, such that the Modelverse can create the code in parallel with the actual parsing.
 During the execution of the visitor, it would already be possible to start transmitting the list to the Modelverse, such that the Modelverse can create the code in parallel with the actual parsing.
 While this is possible, we currently split this up in different phases: first the list is generated completely, and then it is transferred to the Modelverse in a single request.
 While this is possible, we currently split this up in different phases: first the list is generated completely, and then it is transferred to the Modelverse in a single request.
 
 
-Primitives visitor
-^^^^^^^^^^^^^^^^^^
-
-The primitives visitor generates a Modelverse graph directly.
-Its use is deprecated, as the constructors are much more elegant.
-While direct use of this visitor is not recommended, except for performance reasons, the bootstrap visitor (discussed next) is based on this visitor.
-
-This visitor creates a serialized version of the graph and transmits it to the Modelverse.
-The Modelverse has a built-in primitive to decode this graph and store it.
-
 Bootstrap visitor
 Bootstrap visitor
 ^^^^^^^^^^^^^^^^^
 ^^^^^^^^^^^^^^^^^
 
 

+ 0 - 2
doc/upload.sh

@@ -1,2 +0,0 @@
-#!/bin/bash
-rsync -v --progress --recursive _build/html/* yentl@msdl.uantwerpen.be:/var/www/msdl/documentation/modelverse/