Explorar o código

Link to the new MvC code

Yentl Van Tendeloo %!s(int64=8) %!d(string=hai) anos
pai
achega
ec59f92b93

BIN=BIN
doc/_build/doctrees/actionlanguage.doctree


BIN=BIN
doc/_build/doctrees/examples.doctree


BIN=BIN
doc/_build/doctrees/howto.doctree


BIN=BIN
doc/_build/doctrees/index.doctree


BIN=BIN
doc/_build/doctrees/modellanguage.doctree


+ 22 - 2
doc/_build/html/_sources/actionlanguage.txt

@@ -64,12 +64,26 @@ Conditions and actions are similar to the If construct.
 Break
 ^^^^^
 
-Whereas this is supported in the Modelverse, the parser currently does not consider this keyword.
+The BREAK construct is similar to that found in other languages.
+Contrary to Python, it is followed by an exclamation mark to differentiate it from the variable *break*.
+Its structure is as follows::
+
+    while condition:
+        break!
+
+While the Modelverse supports breaking out of multiple loops simultaneously, this is not currently supported by the HUTN parser.
 
 Continue
 ^^^^^^^^
 
-Whereas this is supported in the Modelverse, the parser currently does not consider this keyword.
+The CONTINUE construct is similar to that found in other languages.
+Contrary to Python, it is followed by an exclamation mark to differentiate it from the variable *continue*.
+Its structure is as follows::
+
+    while condition:
+        continue!
+
+While the Modelverse supports continuing a higher loop directly, this is not currently supported by the HUTN parser.
 
 Return
 ^^^^^^
@@ -81,6 +95,9 @@ Its structure is as follows::
     return expression!
 
 The expression can be any expression, similar to the condition in an If and While.
+When the function has returntype void, the expression must be empty::
+
+    return!
 
 Function call
 ^^^^^^^^^^^^^
@@ -248,6 +265,7 @@ This code looks as follows::
     Void function main():
         while(True):
             output(fib(input()))
+        return!
 
 Factorial
 ^^^^^^^^^
@@ -265,6 +283,7 @@ Similarly, the code for computing a factorial is given below::
     Void function main():
         while(True):
             output(factorial(input()))
+        return!
 
 Binary to decimal converter
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -294,3 +313,4 @@ A simple binary to decimal converter is given below::
     Void function main():
         while(True):
             output(b2d(input()))
+        return!

+ 15 - 385
doc/_build/html/_sources/examples.txt

@@ -16,6 +16,17 @@ If you want to send integers or so, prepend the input with a backslash (\\), whi
 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
 ----------------
 
@@ -81,389 +92,8 @@ But since we can create whatever kind of server we want, a simple (meta-)modelli
 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 seen below::
-
-    include "primitives.alh"
-    include "constructors.alh"
-    include "object_operations.alh"
-    include "library.alh"
-    include "conformance_scd.alh"
-    include "io.alh"
-    include "metamodels.alh"
-    include "modelling.alh"
-    include "compilation_manager.alh"
-
-    Element function model_loaded(model : Element):
-        String cmd
-
-        Element attr_list_pn
-        Element attr_keys_pn
-        String attr_key_pn
-        Element metamodel_element_pn
-        String typename
-        Boolean bottom
-        Element other_metamodel
-
-        bottom = False
-        other_metamodel = create_node()
-        dict_add(other_metamodel, "model", model["model"])
-        dict_add(other_metamodel, "type_mapping", create_node())
-        dict_add(other_metamodel, "metamodel", import_node("models/LTM_bottom"))
-        dict_add(other_metamodel, "inheritance", other_metamodel["metamodel"]["model"]["__Inheritance"])
-
-        output("Model loaded, ready for commands!")
-        output("Use 'help' command for a list of possible commands")
-
-        while (True):
-            output("Please give your command.")
-            cmd = input()
-            if (cmd == "help"):
-                output("Generic model operations:")
-                output("  instantiate -- Create a new model element")
-                output("  delete      -- Delete an existing element")
-                output("  attr_add    -- Add an attribute to an element")
-                output("  attr_del    -- Delete an attribute of an element")
-                output("  constrain   -- Add a constraint function to the model")
-                output("  rename      -- Rename an existing element")
-                output("  modify      -- Modify the attributes of an element")
-                output("  list        -- Prints the list of elements in the model")
-                output("  types       -- Prints the list of elements that can be instantiated")
-                output("  read        -- Prints the current state of a model element")
-                output("  verify      -- Check whether the model conforms to the metamodel")
-                output("  retype      -- Change the type of an element")
-                output("  switch      -- Switch between conformance bottom and the linguistic metamodel")
-                output("  exit        -- Unload the model and go back to the loading prompt")
-            elif (cmd == "exit"):
-                return model!
-            elif (cmd == "instantiate"):
-                String mm_type_name
-                output("Type to instantiate?")
-                mm_type_name = input()
-                if (dict_in(model["metamodel"]["model"], mm_type_name)):
-                    String element_name
-                    output("Name of new element?")
-                    element_name = input()
-                    if (dict_in(model["model"], element_name)):
-                        output("Element already exists; aborting")
-                    else:
-                        if (is_edge(model["metamodel"]["model"][mm_type_name])):
-                            output("Source name?")
-                            String src_name
-                            src_name = input()
-                            if (dict_in(model["model"], src_name)):
-                                output("Destination name?")
-                                String dst_name
-                                dst_name = input()
-                                if (dict_in(model["model"], dst_name)):
-                                    instantiate_link(model, mm_type_name, element_name, src_name, dst_name)
-                                    output("Instantiation successful!")
-                                else:
-                                    output("Unknown destination; aborting")
-                            else:
-                                output("Unknown source; aborting")
-                        else:
-                            instantiate_node(model, mm_type_name, element_name)
-                            output("Instantiation successful!")
-                else:
-                    output("Unknown type specified; aborting")
-            elif (cmd == "set_inheritance"):
-                String inh_name
-
-                output("Which link in the metamodel is the inheritance link?")
-                inh_name = input()
-
-                if (dict_in(model["metamodel"]["model"], inh_name)):
-                    dict_add(model, "inheritance", model["metamodel"]["model"][inh_name])
-                    output("Set inheritance link!")
-                else:
-                    output("Element not found in metamodel; aborting")
-
-            elif (cmd == "constrain"):
-                output("Element to constrain (empty for global)?")
-                String model_name
-                model_name = input()
+The full code is shown in the :download:`MvC Core Algorithm <../core/core_algorithm.alc>`.
 
-                if (model_name == ""):
-                    // Global constraint
-                    output("Give input to function constructors for GLOBAL constraint!")
-                    set_model_constraints(model, construct_function())
-                elif (dict_in(model["model"], model_name)):
-                    // Local constraint for this model
-                    output("Give input to function constructors for LOCAL constraint!")
-                    add_constraint(model, model_name, construct_function())
-                    output("Added constraint to model!")
-                else:
-                    // Local constraint, but model not found
-                    output("Unknown model; aborting")
-            elif (cmd == "modify"):
-                String model_name
-                output("Element to modify?")
-                model_name = input()
-                if (dict_in(model["model"], model_name)):
-                    Element attrs
-                    attrs = getAttributeList(model, model_name)
-                    String attr_name
-                    output("Attribute to modify?")
-                    attr_name = input()
-                    if (set_in(dict_keys(attrs), attr_name)):
-                        output("New value?")
-                        unset_attribute(model, model_name, attr_name)
-                        instantiate_attribute(model, model_name, attr_name, input())
-                        output("Modified!")
-                    else:
-                        output("No such attribute!")
-                else:
-                    output("No such model!")
-            elif (cmd == "attr_add"):
-                String model_name
-                output("Which model do you want to assign an attribute to?")
-                model_name = input()
-                if (dict_in(model["model"], model_name)):
-                    Element attrs
-                    attrs = getAttributeList(model, model_name)
-                    String attr_name
-                    output("Which attribute do you wish to assign?")
-                    attr_name = input()
-                    if (set_in(dict_keys(attrs), attr_name)):
-                        output("Value of attribute?")
-                        instantiate_attribute(model, model_name, attr_name, input())
-                        output("Added attribute!")
-                    else:
-                        output("No such attribute!")
-                else:
-                    output("No such model!")
-            elif (cmd == "attr_del"):
-                String model_name
-                output("Which model do you want to remove an attribute of?")
-                model_name = input()
-                if (dict_in(model["model"], model_name)):
-                    Element attrs
-                    attrs = getAttributeList(model, model_name)
-                    String attr_name
-                    output("Which attribute do you want to delete?")
-                    attr_name = input()
-                    if (set_in(dict_keys(attrs), attr_name)):
-                        unset_attribute(model, model_name, attr_name)
-                        output("Attribute deleted!")
-                    else:
-                        output("No such attribute!")
-                else:
-                    output("No such model!")
-            elif (cmd == "delete"):
-                output("What is the name of the element you want to delete?")
-                cmd = input()
-                if (dict_in(model["model"], cmd)):
-                    model_delete_element(model, cmd)
-                    output("Deleted!")
-                else:
-                    output("No such element; aborting")
-            elif (cmd == "rename"):
-                output("Old name?")
-                String old_name_e
-                old_name_e = input()
-                if (dict_in(model["model"], old_name_e)):
-                    output("New name?")
-                    String new_name_e
-                    new_name_e = input()
-                    if (dict_in(model["model"], new_name_e)):
-                        output("New name already used; aborting")
-                    else:
-                        dict_add(model["model"], new_name_e, model["model"][old_name_e])
-                        dict_delete(model["model"], old_name_e)
-                        output("Rename complete!")
-                else:
-                    output("Unknown element; aborting")
-            elif (cmd == "list"):
-                Element keys_m
-                keys_m = dict_keys(model["model"])
-                output("List of all elements:")
-                String v_m
-                while (read_nr_out(keys_m) > 0):
-                    v_m = set_pop(keys_m)
-                    // Filter out anonymous objects
-                    if (bool_not(string_startswith(v_m, "__"))):
-                        typename = reverseKeyLookup(model["metamodel"]["model"], dict_read_node(model["type_mapping"], model["model"][v_m]))
-                        output((("  " + v_m) + " : ") + typename)
-            elif (cmd == "read"):
-                output("Element to read?")
-                cmd = input()
-                if (dict_in(model["model"], cmd)):
-                    Element read_elem
-                    read_elem = model["model"][cmd]
-                    metamodel_element_pn = dict_read_node(model["type_mapping"], read_elem)
-
-                    output("Name: " + cmd)
-                    output("Type: " + reverseKeyLookup(model["metamodel"]["model"], metamodel_element_pn))
-                    if (is_edge(read_elem)):
-                        output("Source: " + reverseKeyLookup(model["model"], read_edge_src(read_elem)))
-                        output("Destination: " + reverseKeyLookup(model["model"], read_edge_dst(read_elem)))
-                    if (cast_v2s(read_elem) != "None"):
-                        output("Value: " + cast_v2s(read_elem))
-                    output("Defines attributes:")
-                    attr_list_pn = getInstantiatableAttributes(model, read_elem)
-                    attr_keys_pn = dict_keys(attr_list_pn)
-                    while (0 < read_nr_out(attr_keys_pn)):
-                        attr_key_pn = set_pop(attr_keys_pn)
-                        output(((("  " + attr_key_pn) + " : ") + cast_v2s(attr_list_pn[attr_key_pn])))
-                    output("Attributes:")
-                    attr_list_pn = getAttributeList(model, cmd)
-                    attr_keys_pn = dict_keys(attr_list_pn)
-                    while (0 < read_nr_out(attr_keys_pn)):
-                        attr_key_pn = set_pop(attr_keys_pn)
-                        output((((("  " + cast_v2s(attr_key_pn)) + " : ") + cast_v2s(attr_list_pn[attr_key_pn])) + " = ") + cast_v2s(read_attribute(model, reverseKeyLookup(model["model"], read_elem), attr_key_pn)))
-                else:
-                    output("Unknown element; aborting")
-            elif (cmd == "verify"):
-                output(conformance_scd(model))
-            elif (cmd == "types"):
-                Element keys_t
-                keys_t = dict_keys(model["metamodel"]["model"])
-                output("List of types:")
-                String v_t
-                while (read_nr_out(keys_t) > 0):
-                    v_t = set_pop(keys_t)
-                    if (bool_not(string_startswith(v_t, "__"))):
-                        output(string_join(("  " + v_t) + " : ", reverseKeyLookup(model["metamodel"]["metamodel"]["model"], dict_read_node(model["metamodel"]["type_mapping"], model["metamodel"]["model"][v_t]))))
-            elif (cmd == "retype"):
-                output("Element to retype?")
-                String elementname
-                elementname = input()
-                if (dict_in(model["model"], elementname)):
-                    output("New type")
-                    typename = input()
-                    if (dict_in(model["metamodel"]["model"], typename)):
-                        // OK, do the retyping
-                        // First try removing the previous type if it exists
-                        dict_delete(model["type_mapping"], model["model"][elementname])
-                        // Now add the new type
-                        dict_add(model["type_mapping"], model["model"][elementname], model["metamodel"]["model"][typename])
-                        output("Retyped!")
-                    else:
-                        output("Unknown type; aborting")
-                else:
-                    output("Unknown element; aborting")
-            elif (cmd == "switch"):
-                bottom = bool_not(bottom)
-
-                Element tmp_model
-                tmp_model = model
-                model = other_metamodel
-                other_metamodel = tmp_model
-
-                if (bottom):
-                    // The type mapping we are using is probably not complete for our model
-                    // so we completely recreate it from the model we have.
-                    output("Switching to conformance bottom mode!")
-                    generate_bottom_type_mapping(model)
-                else:
-                    // We already switched the models and such, so we are already done!
-                    output("Switching to linguistic metamodel!")
-            else:
-                output("Unknown command: " + cast_v2s(cmd))
-                output("Use command 'help' to get a list of available commands")
-
-    Element function main():
-        output("Welcome to the Model Management Interface, running live on the Modelverse!")
-        output("Use 'help' command for a list of possible commands")
-        String command
-        Element root
-        Element metamodel
-        String name
-        Element my_model
-        String mm_name
-
-        root = create_metamodels()
-
-        while (True):
-            output("Please give your command.")
-            command = input()
-
-            if (command == "help"):
-                output("Currently no model is loaded, so your operations are limited to:")
-                output("  new    -- Create a new model and save it for future use")
-                output("  load   -- Load a previously made model")
-                output("  rename -- Rename a previously made model")
-                output("  delete -- Delete a previously made model")
-                output("  list   -- Show a list of all stored models")
-                output("  help   -- Show a list of possible commands")
-            elif (command == "new"):
-                output("Metamodel to instantiate?")
-                mm_name = input()
-                if (dict_in(root, mm_name)):
-                    output("Name of model?")
-                    name = input()
-                    if (dict_in(root, name)):
-                        output("Model exists; aborting")
-                    else:
-                        my_model = instantiate_model(root[mm_name])
-                        dict_add(root, name, my_model)
-                        model_loaded(my_model)
-                else:
-                    output("Unknown metamodel; aborting")
-            elif (command == "load"):
-                output("Model to load?")
-                name = input()
-                if (dict_in(root, name)):
-                    my_model = root[name]
-                    model_loaded(my_model)
-                else:
-                    output("Model not found; aborting")
-            elif (command == "list"):
-                Element keys
-                String m_menu_list
-                keys = dict_keys(root)
-                output("Found models:")
-                while (read_nr_out(keys) > 0):
-                    m_menu_list = set_pop(keys)
-                    output((("  " + m_menu_list) + " : ") + reverseKeyLookup(root, root[m_menu_list]["metamodel"]))
-            elif (command == "delete"):
-                output("Model to delete?")
-                name = input()
-                if (dict_in(root, name)):
-                    dict_delete(root, name)
-                    output("Deleted!")
-                else:
-                    output("Model not found; aborting")
-            elif (command == "rename"):
-                output("Old name?")
-                String old_name
-                old_name = input()
-                if (dict_in(root, old_name)):
-                    output("New name?")
-                    String new_name
-                    new_name = input()
-                    if (dict_in(root, new_name)):
-                        output("Model exists; aborting")
-                    else:
-                        dict_add(root, new_name, root[old_name])
-                        dict_delete(root, old_name)
-                        output("Rename complete!")
-                else:
-                    output("Model not found; aborting")
-            elif (command == "actions"):
-                output("Switching to compilation manager!")
-                compilation_manager()
-                output("Back in model manager!")
-            else:
-                output("Command not recognized, use 'help' for a list of possible commands")
-
-This code implements a very simple (meta-)modelling tool.
-Its use is documented with the provided *help* function.
-A simple example of its use is shown below.
-
-.. image:: img/prompt_pn_interface.png
-
-In this case, note that the value of tokens is the string 3 instead of the integer (or natural) 3.
-Therefore, the conformance check will flag this value as incorrectly typed.
-
-Upload model
-------------
-
-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 modelling server, but include a model in it.
-Doing that, your interface will see additional models with the *list* command.
-
-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
+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.

+ 12 - 1
doc/_build/html/_sources/howto.txt

@@ -153,7 +153,7 @@ run_local_modelverse.py
 
 Locally runs an instance of the Modelverse at the requested port.
 This combines MvK and MvS at the same system, and actually makes a direct link between them, omitting the slow use of sockets.
-While this is kind of a hack at the moment, it is really necessary with the current low 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).
 
 Invocation::
@@ -174,3 +174,14 @@ Run the tests for all parts of the Modelverse.
 Invocation::
 
     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

+ 8 - 0
doc/_build/html/_sources/modellanguage.txt

@@ -7,6 +7,8 @@ With this language, models (*i.e.*, data) can be defined in addition to the algo
 This language is still mostly work in progress, but should be decent enough to construct simple metamodels and instantiate them.
 All models have the extension \*.mvc, indicating that they are models and should be compiled as such.
 
+If you want to create models interactively, such as with another tool, it is strongly recommended to use the interactive interface to do this, as the modelling language is completely static.
+
 Language description
 --------------------
 
@@ -172,3 +174,9 @@ The previous metamodel can then be instantiated::
     }
 
     export my_petrinet to models/my_petrinet
+
+Use in interactive interface
+----------------------------
+
+The interactive interface, such as the *prompt.py* script, can also invoke the model compiler.
+In this case, however, the import, export, and model type and model name parameters are ignored as they have to be defined and checked in the bigger context of the MvC.

+ 24 - 3
doc/_build/html/actionlanguage.html

@@ -106,11 +106,25 @@ Its structure is as follows:</p>
 </div>
 <div class="section" id="break">
 <h3>Break<a class="headerlink" href="#break" title="Permalink to this headline">¶</a></h3>
-<p>Whereas this is supported in the Modelverse, the parser currently does not consider this keyword.</p>
+<p>The BREAK construct is similar to that found in other languages.
+Contrary to Python, it is followed by an exclamation mark to differentiate it from the variable <em>break</em>.
+Its structure is as follows:</p>
+<div class="highlight-default"><div class="highlight"><pre>while condition:
+    break!
+</pre></div>
+</div>
+<p>While the Modelverse supports breaking out of multiple loops simultaneously, this is not currently supported by the HUTN parser.</p>
 </div>
 <div class="section" id="continue">
 <h3>Continue<a class="headerlink" href="#continue" title="Permalink to this headline">¶</a></h3>
-<p>Whereas this is supported in the Modelverse, the parser currently does not consider this keyword.</p>
+<p>The CONTINUE construct is similar to that found in other languages.
+Contrary to Python, it is followed by an exclamation mark to differentiate it from the variable <em>continue</em>.
+Its structure is as follows:</p>
+<div class="highlight-default"><div class="highlight"><pre>while condition:
+    continue!
+</pre></div>
+</div>
+<p>While the Modelverse supports continuing a higher loop directly, this is not currently supported by the HUTN parser.</p>
 </div>
 <div class="section" id="return">
 <h3>Return<a class="headerlink" href="#return" title="Permalink to this headline">¶</a></h3>
@@ -120,7 +134,11 @@ Its structure is as follows:</p>
 <div class="highlight-default"><div class="highlight"><pre>return expression!
 </pre></div>
 </div>
-<p>The expression can be any expression, similar to the condition in an If and While.</p>
+<p>The expression can be any expression, similar to the condition in an If and While.
+When the function has returntype void, the expression must be empty:</p>
+<div class="highlight-default"><div class="highlight"><pre>return!
+</pre></div>
+</div>
 </div>
 <div class="section" id="function-call">
 <h3>Function call<a class="headerlink" href="#function-call" title="Permalink to this headline">¶</a></h3>
@@ -296,6 +314,7 @@ Integer function fib(param : Integer):
 Void function main():
     while(True):
         output(fib(input()))
+    return!
 </pre></div>
 </div>
 </div>
@@ -313,6 +332,7 @@ Integer function factorial(n : Integer):
 Void function main():
     while(True):
         output(factorial(input()))
+    return!
 </pre></div>
 </div>
 </div>
@@ -342,6 +362,7 @@ Integer function b2d(param : String):
 Void function main():
     while(True):
         output(b2d(input()))
+    return!
 </pre></div>
 </div>
 </div>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 13 - 384
doc/_build/html/examples.html


+ 12 - 1
doc/_build/html/howto.html

@@ -291,7 +291,7 @@ There is no logic in the prompt itself, making it completely generic.</p>
 <h2>run_local_modelverse.py<a class="headerlink" href="#run-local-modelverse-py" title="Permalink to this headline">¶</a></h2>
 <p>Locally runs an instance of the Modelverse at the requested port.
 This combines MvK and MvS at the same system, and actually makes a direct link between them, omitting the slow use of sockets.
-While this is kind of a hack at the moment, it is really necessary with the current low 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).</p>
 <p>Invocation:</p>
 <div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="n">run_local_modelverse</span><span class="o">.</span><span class="n">py</span> <span class="n">port</span>
@@ -325,6 +325,16 @@ To split them up, there just needs to be a statechart in between both of them (w
 </pre></div>
 </div>
 </div>
+<div class="section" id="run-mvc-server-py">
+<h2>run_MvC_server.py<a class="headerlink" href="#run-mvc-server-py" title="Permalink to this headline">¶</a></h2>
+<p>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.</p>
+<p>Invocation:</p>
+<div class="highlight-default"><div class="highlight"><pre><span class="n">python</span> <span class="n">scripts</span><span class="o">/</span><span class="n">run_MvC_server</span><span class="o">.</span><span class="n">py</span>
+</pre></div>
+</div>
+</div>
 </div>
 
 
@@ -348,6 +358,7 @@ To split them up, there just needs to be a statechart in between both of them (w
 <li><a class="reference internal" href="#prompt-py">prompt.py</a></li>
 <li><a class="reference internal" href="#run-local-modelverse-py">run_local_modelverse.py</a></li>
 <li><a class="reference internal" href="#run-tests-py">run_tests.py</a></li>
+<li><a class="reference internal" href="#run-mvc-server-py">run_MvC_server.py</a></li>
 </ul>
 </li>
 </ul>

+ 2 - 1
doc/_build/html/index.html

@@ -75,6 +75,7 @@
 <li class="toctree-l2"><a class="reference internal" href="howto.html#prompt-py">prompt.py</a></li>
 <li class="toctree-l2"><a class="reference internal" href="howto.html#run-local-modelverse-py">run_local_modelverse.py</a></li>
 <li class="toctree-l2"><a class="reference internal" href="howto.html#run-tests-py">run_tests.py</a></li>
+<li class="toctree-l2"><a class="reference internal" href="howto.html#run-mvc-server-py">run_MvC_server.py</a></li>
 </ul>
 </li>
 <li class="toctree-l1"><a class="reference internal" href="actionlanguage.html">Action Language</a><ul>
@@ -87,12 +88,12 @@
 <li class="toctree-l2"><a class="reference internal" href="modellanguage.html#language-description">Language description</a></li>
 <li class="toctree-l2"><a class="reference internal" href="modellanguage.html#merge-with-action-language">Merge with Action Language</a></li>
 <li class="toctree-l2"><a class="reference internal" href="modellanguage.html#examples">Examples</a></li>
+<li class="toctree-l2"><a class="reference internal" href="modellanguage.html#use-in-interactive-interface">Use in interactive interface</a></li>
 </ul>
 </li>
 <li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a><ul>
 <li class="toctree-l2"><a class="reference internal" href="examples.html#fibonacci-server">Fibonacci Server</a></li>
 <li class="toctree-l2"><a class="reference internal" href="examples.html#modelling-server">Modelling Server</a></li>
-<li class="toctree-l2"><a class="reference internal" href="examples.html#upload-model">Upload model</a></li>
 </ul>
 </li>
 <li class="toctree-l1"><a class="reference internal" href="advanced.html">Advanced examples</a><ul>

+ 7 - 0
doc/_build/html/modellanguage.html

@@ -55,6 +55,7 @@
 With this language, models (<em>i.e.</em>, data) can be defined in addition to the algorithms.</p>
 <p>This language is still mostly work in progress, but should be decent enough to construct simple metamodels and instantiate them.
 All models have the extension *.mvc, indicating that they are models and should be compiled as such.</p>
+<p>If you want to create models interactively, such as with another tool, it is strongly recommended to use the interactive interface to do this, as the modelling language is completely static.</p>
 <div class="section" id="language-description">
 <h2>Language description<a class="headerlink" href="#language-description" title="Permalink to this headline">¶</a></h2>
 <p>The modelling language defines data structures, which will be formed as models in the Modelverse.</p>
@@ -210,6 +211,11 @@ SCD PetriNets{
 </div>
 </div>
 </div>
+<div class="section" id="use-in-interactive-interface">
+<h2>Use in interactive interface<a class="headerlink" href="#use-in-interactive-interface" title="Permalink to this headline">¶</a></h2>
+<p>The interactive interface, such as the <em>prompt.py</em> script, can also invoke the model compiler.
+In this case, however, the import, export, and model type and model name parameters are ignored as they have to be defined and checked in the bigger context of the MvC.</p>
+</div>
 </div>
 
 
@@ -235,6 +241,7 @@ SCD PetriNets{
 <li><a class="reference internal" href="#petri-net-instance">Petri Net instance</a></li>
 </ul>
 </li>
+<li><a class="reference internal" href="#use-in-interactive-interface">Use in interactive interface</a></li>
 </ul>
 </li>
 </ul>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 1
doc/_build/html/searchindex.js


+ 22 - 2
doc/actionlanguage.rst

@@ -64,12 +64,26 @@ Conditions and actions are similar to the If construct.
 Break
 ^^^^^
 
-Whereas this is supported in the Modelverse, the parser currently does not consider this keyword.
+The BREAK construct is similar to that found in other languages.
+Contrary to Python, it is followed by an exclamation mark to differentiate it from the variable *break*.
+Its structure is as follows::
+
+    while condition:
+        break!
+
+While the Modelverse supports breaking out of multiple loops simultaneously, this is not currently supported by the HUTN parser.
 
 Continue
 ^^^^^^^^
 
-Whereas this is supported in the Modelverse, the parser currently does not consider this keyword.
+The CONTINUE construct is similar to that found in other languages.
+Contrary to Python, it is followed by an exclamation mark to differentiate it from the variable *continue*.
+Its structure is as follows::
+
+    while condition:
+        continue!
+
+While the Modelverse supports continuing a higher loop directly, this is not currently supported by the HUTN parser.
 
 Return
 ^^^^^^
@@ -81,6 +95,9 @@ Its structure is as follows::
     return expression!
 
 The expression can be any expression, similar to the condition in an If and While.
+When the function has returntype void, the expression must be empty::
+
+    return!
 
 Function call
 ^^^^^^^^^^^^^
@@ -248,6 +265,7 @@ This code looks as follows::
     Void function main():
         while(True):
             output(fib(input()))
+        return!
 
 Factorial
 ^^^^^^^^^
@@ -265,6 +283,7 @@ Similarly, the code for computing a factorial is given below::
     Void function main():
         while(True):
             output(factorial(input()))
+        return!
 
 Binary to decimal converter
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -294,3 +313,4 @@ A simple binary to decimal converter is given below::
     Void function main():
         while(True):
             output(b2d(input()))
+        return!

+ 15 - 385
doc/examples.rst

@@ -16,6 +16,17 @@ If you want to send integers or so, prepend the input with a backslash (\\), whi
 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
 ----------------
 
@@ -81,389 +92,8 @@ But since we can create whatever kind of server we want, a simple (meta-)modelli
 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 seen below::
-
-    include "primitives.alh"
-    include "constructors.alh"
-    include "object_operations.alh"
-    include "library.alh"
-    include "conformance_scd.alh"
-    include "io.alh"
-    include "metamodels.alh"
-    include "modelling.alh"
-    include "compilation_manager.alh"
-
-    Element function model_loaded(model : Element):
-        String cmd
-
-        Element attr_list_pn
-        Element attr_keys_pn
-        String attr_key_pn
-        Element metamodel_element_pn
-        String typename
-        Boolean bottom
-        Element other_metamodel
-
-        bottom = False
-        other_metamodel = create_node()
-        dict_add(other_metamodel, "model", model["model"])
-        dict_add(other_metamodel, "type_mapping", create_node())
-        dict_add(other_metamodel, "metamodel", import_node("models/LTM_bottom"))
-        dict_add(other_metamodel, "inheritance", other_metamodel["metamodel"]["model"]["__Inheritance"])
-
-        output("Model loaded, ready for commands!")
-        output("Use 'help' command for a list of possible commands")
-
-        while (True):
-            output("Please give your command.")
-            cmd = input()
-            if (cmd == "help"):
-                output("Generic model operations:")
-                output("  instantiate -- Create a new model element")
-                output("  delete      -- Delete an existing element")
-                output("  attr_add    -- Add an attribute to an element")
-                output("  attr_del    -- Delete an attribute of an element")
-                output("  constrain   -- Add a constraint function to the model")
-                output("  rename      -- Rename an existing element")
-                output("  modify      -- Modify the attributes of an element")
-                output("  list        -- Prints the list of elements in the model")
-                output("  types       -- Prints the list of elements that can be instantiated")
-                output("  read        -- Prints the current state of a model element")
-                output("  verify      -- Check whether the model conforms to the metamodel")
-                output("  retype      -- Change the type of an element")
-                output("  switch      -- Switch between conformance bottom and the linguistic metamodel")
-                output("  exit        -- Unload the model and go back to the loading prompt")
-            elif (cmd == "exit"):
-                return model!
-            elif (cmd == "instantiate"):
-                String mm_type_name
-                output("Type to instantiate?")
-                mm_type_name = input()
-                if (dict_in(model["metamodel"]["model"], mm_type_name)):
-                    String element_name
-                    output("Name of new element?")
-                    element_name = input()
-                    if (dict_in(model["model"], element_name)):
-                        output("Element already exists; aborting")
-                    else:
-                        if (is_edge(model["metamodel"]["model"][mm_type_name])):
-                            output("Source name?")
-                            String src_name
-                            src_name = input()
-                            if (dict_in(model["model"], src_name)):
-                                output("Destination name?")
-                                String dst_name
-                                dst_name = input()
-                                if (dict_in(model["model"], dst_name)):
-                                    instantiate_link(model, mm_type_name, element_name, src_name, dst_name)
-                                    output("Instantiation successful!")
-                                else:
-                                    output("Unknown destination; aborting")
-                            else:
-                                output("Unknown source; aborting")
-                        else:
-                            instantiate_node(model, mm_type_name, element_name)
-                            output("Instantiation successful!")
-                else:
-                    output("Unknown type specified; aborting")
-            elif (cmd == "set_inheritance"):
-                String inh_name
-
-                output("Which link in the metamodel is the inheritance link?")
-                inh_name = input()
-
-                if (dict_in(model["metamodel"]["model"], inh_name)):
-                    dict_add(model, "inheritance", model["metamodel"]["model"][inh_name])
-                    output("Set inheritance link!")
-                else:
-                    output("Element not found in metamodel; aborting")
-
-            elif (cmd == "constrain"):
-                output("Element to constrain (empty for global)?")
-                String model_name
-                model_name = input()
+The full code is shown in the :download:`MvC Core Algorithm <../core/core_algorithm.alc>`.
 
-                if (model_name == ""):
-                    // Global constraint
-                    output("Give input to function constructors for GLOBAL constraint!")
-                    set_model_constraints(model, construct_function())
-                elif (dict_in(model["model"], model_name)):
-                    // Local constraint for this model
-                    output("Give input to function constructors for LOCAL constraint!")
-                    add_constraint(model, model_name, construct_function())
-                    output("Added constraint to model!")
-                else:
-                    // Local constraint, but model not found
-                    output("Unknown model; aborting")
-            elif (cmd == "modify"):
-                String model_name
-                output("Element to modify?")
-                model_name = input()
-                if (dict_in(model["model"], model_name)):
-                    Element attrs
-                    attrs = getAttributeList(model, model_name)
-                    String attr_name
-                    output("Attribute to modify?")
-                    attr_name = input()
-                    if (set_in(dict_keys(attrs), attr_name)):
-                        output("New value?")
-                        unset_attribute(model, model_name, attr_name)
-                        instantiate_attribute(model, model_name, attr_name, input())
-                        output("Modified!")
-                    else:
-                        output("No such attribute!")
-                else:
-                    output("No such model!")
-            elif (cmd == "attr_add"):
-                String model_name
-                output("Which model do you want to assign an attribute to?")
-                model_name = input()
-                if (dict_in(model["model"], model_name)):
-                    Element attrs
-                    attrs = getAttributeList(model, model_name)
-                    String attr_name
-                    output("Which attribute do you wish to assign?")
-                    attr_name = input()
-                    if (set_in(dict_keys(attrs), attr_name)):
-                        output("Value of attribute?")
-                        instantiate_attribute(model, model_name, attr_name, input())
-                        output("Added attribute!")
-                    else:
-                        output("No such attribute!")
-                else:
-                    output("No such model!")
-            elif (cmd == "attr_del"):
-                String model_name
-                output("Which model do you want to remove an attribute of?")
-                model_name = input()
-                if (dict_in(model["model"], model_name)):
-                    Element attrs
-                    attrs = getAttributeList(model, model_name)
-                    String attr_name
-                    output("Which attribute do you want to delete?")
-                    attr_name = input()
-                    if (set_in(dict_keys(attrs), attr_name)):
-                        unset_attribute(model, model_name, attr_name)
-                        output("Attribute deleted!")
-                    else:
-                        output("No such attribute!")
-                else:
-                    output("No such model!")
-            elif (cmd == "delete"):
-                output("What is the name of the element you want to delete?")
-                cmd = input()
-                if (dict_in(model["model"], cmd)):
-                    model_delete_element(model, cmd)
-                    output("Deleted!")
-                else:
-                    output("No such element; aborting")
-            elif (cmd == "rename"):
-                output("Old name?")
-                String old_name_e
-                old_name_e = input()
-                if (dict_in(model["model"], old_name_e)):
-                    output("New name?")
-                    String new_name_e
-                    new_name_e = input()
-                    if (dict_in(model["model"], new_name_e)):
-                        output("New name already used; aborting")
-                    else:
-                        dict_add(model["model"], new_name_e, model["model"][old_name_e])
-                        dict_delete(model["model"], old_name_e)
-                        output("Rename complete!")
-                else:
-                    output("Unknown element; aborting")
-            elif (cmd == "list"):
-                Element keys_m
-                keys_m = dict_keys(model["model"])
-                output("List of all elements:")
-                String v_m
-                while (read_nr_out(keys_m) > 0):
-                    v_m = set_pop(keys_m)
-                    // Filter out anonymous objects
-                    if (bool_not(string_startswith(v_m, "__"))):
-                        typename = reverseKeyLookup(model["metamodel"]["model"], dict_read_node(model["type_mapping"], model["model"][v_m]))
-                        output((("  " + v_m) + " : ") + typename)
-            elif (cmd == "read"):
-                output("Element to read?")
-                cmd = input()
-                if (dict_in(model["model"], cmd)):
-                    Element read_elem
-                    read_elem = model["model"][cmd]
-                    metamodel_element_pn = dict_read_node(model["type_mapping"], read_elem)
-
-                    output("Name: " + cmd)
-                    output("Type: " + reverseKeyLookup(model["metamodel"]["model"], metamodel_element_pn))
-                    if (is_edge(read_elem)):
-                        output("Source: " + reverseKeyLookup(model["model"], read_edge_src(read_elem)))
-                        output("Destination: " + reverseKeyLookup(model["model"], read_edge_dst(read_elem)))
-                    if (cast_v2s(read_elem) != "None"):
-                        output("Value: " + cast_v2s(read_elem))
-                    output("Defines attributes:")
-                    attr_list_pn = getInstantiatableAttributes(model, read_elem)
-                    attr_keys_pn = dict_keys(attr_list_pn)
-                    while (0 < read_nr_out(attr_keys_pn)):
-                        attr_key_pn = set_pop(attr_keys_pn)
-                        output(((("  " + attr_key_pn) + " : ") + cast_v2s(attr_list_pn[attr_key_pn])))
-                    output("Attributes:")
-                    attr_list_pn = getAttributeList(model, cmd)
-                    attr_keys_pn = dict_keys(attr_list_pn)
-                    while (0 < read_nr_out(attr_keys_pn)):
-                        attr_key_pn = set_pop(attr_keys_pn)
-                        output((((("  " + cast_v2s(attr_key_pn)) + " : ") + cast_v2s(attr_list_pn[attr_key_pn])) + " = ") + cast_v2s(read_attribute(model, reverseKeyLookup(model["model"], read_elem), attr_key_pn)))
-                else:
-                    output("Unknown element; aborting")
-            elif (cmd == "verify"):
-                output(conformance_scd(model))
-            elif (cmd == "types"):
-                Element keys_t
-                keys_t = dict_keys(model["metamodel"]["model"])
-                output("List of types:")
-                String v_t
-                while (read_nr_out(keys_t) > 0):
-                    v_t = set_pop(keys_t)
-                    if (bool_not(string_startswith(v_t, "__"))):
-                        output(string_join(("  " + v_t) + " : ", reverseKeyLookup(model["metamodel"]["metamodel"]["model"], dict_read_node(model["metamodel"]["type_mapping"], model["metamodel"]["model"][v_t]))))
-            elif (cmd == "retype"):
-                output("Element to retype?")
-                String elementname
-                elementname = input()
-                if (dict_in(model["model"], elementname)):
-                    output("New type")
-                    typename = input()
-                    if (dict_in(model["metamodel"]["model"], typename)):
-                        // OK, do the retyping
-                        // First try removing the previous type if it exists
-                        dict_delete(model["type_mapping"], model["model"][elementname])
-                        // Now add the new type
-                        dict_add(model["type_mapping"], model["model"][elementname], model["metamodel"]["model"][typename])
-                        output("Retyped!")
-                    else:
-                        output("Unknown type; aborting")
-                else:
-                    output("Unknown element; aborting")
-            elif (cmd == "switch"):
-                bottom = bool_not(bottom)
-
-                Element tmp_model
-                tmp_model = model
-                model = other_metamodel
-                other_metamodel = tmp_model
-
-                if (bottom):
-                    // The type mapping we are using is probably not complete for our model
-                    // so we completely recreate it from the model we have.
-                    output("Switching to conformance bottom mode!")
-                    generate_bottom_type_mapping(model)
-                else:
-                    // We already switched the models and such, so we are already done!
-                    output("Switching to linguistic metamodel!")
-            else:
-                output("Unknown command: " + cast_v2s(cmd))
-                output("Use command 'help' to get a list of available commands")
-
-    Element function main():
-        output("Welcome to the Model Management Interface, running live on the Modelverse!")
-        output("Use 'help' command for a list of possible commands")
-        String command
-        Element root
-        Element metamodel
-        String name
-        Element my_model
-        String mm_name
-
-        root = create_metamodels()
-
-        while (True):
-            output("Please give your command.")
-            command = input()
-
-            if (command == "help"):
-                output("Currently no model is loaded, so your operations are limited to:")
-                output("  new    -- Create a new model and save it for future use")
-                output("  load   -- Load a previously made model")
-                output("  rename -- Rename a previously made model")
-                output("  delete -- Delete a previously made model")
-                output("  list   -- Show a list of all stored models")
-                output("  help   -- Show a list of possible commands")
-            elif (command == "new"):
-                output("Metamodel to instantiate?")
-                mm_name = input()
-                if (dict_in(root, mm_name)):
-                    output("Name of model?")
-                    name = input()
-                    if (dict_in(root, name)):
-                        output("Model exists; aborting")
-                    else:
-                        my_model = instantiate_model(root[mm_name])
-                        dict_add(root, name, my_model)
-                        model_loaded(my_model)
-                else:
-                    output("Unknown metamodel; aborting")
-            elif (command == "load"):
-                output("Model to load?")
-                name = input()
-                if (dict_in(root, name)):
-                    my_model = root[name]
-                    model_loaded(my_model)
-                else:
-                    output("Model not found; aborting")
-            elif (command == "list"):
-                Element keys
-                String m_menu_list
-                keys = dict_keys(root)
-                output("Found models:")
-                while (read_nr_out(keys) > 0):
-                    m_menu_list = set_pop(keys)
-                    output((("  " + m_menu_list) + " : ") + reverseKeyLookup(root, root[m_menu_list]["metamodel"]))
-            elif (command == "delete"):
-                output("Model to delete?")
-                name = input()
-                if (dict_in(root, name)):
-                    dict_delete(root, name)
-                    output("Deleted!")
-                else:
-                    output("Model not found; aborting")
-            elif (command == "rename"):
-                output("Old name?")
-                String old_name
-                old_name = input()
-                if (dict_in(root, old_name)):
-                    output("New name?")
-                    String new_name
-                    new_name = input()
-                    if (dict_in(root, new_name)):
-                        output("Model exists; aborting")
-                    else:
-                        dict_add(root, new_name, root[old_name])
-                        dict_delete(root, old_name)
-                        output("Rename complete!")
-                else:
-                    output("Model not found; aborting")
-            elif (command == "actions"):
-                output("Switching to compilation manager!")
-                compilation_manager()
-                output("Back in model manager!")
-            else:
-                output("Command not recognized, use 'help' for a list of possible commands")
-
-This code implements a very simple (meta-)modelling tool.
-Its use is documented with the provided *help* function.
-A simple example of its use is shown below.
-
-.. image:: img/prompt_pn_interface.png
-
-In this case, note that the value of tokens is the string 3 instead of the integer (or natural) 3.
-Therefore, the conformance check will flag this value as incorrectly typed.
-
-Upload model
-------------
-
-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 modelling server, but include a model in it.
-Doing that, your interface will see additional models with the *list* command.
-
-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
+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.

+ 2 - 1
doc/howto.rst

@@ -179,7 +179,8 @@ 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.
+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::
 

+ 8 - 0
doc/modellanguage.rst

@@ -7,6 +7,8 @@ With this language, models (*i.e.*, data) can be defined in addition to the algo
 This language is still mostly work in progress, but should be decent enough to construct simple metamodels and instantiate them.
 All models have the extension \*.mvc, indicating that they are models and should be compiled as such.
 
+If you want to create models interactively, such as with another tool, it is strongly recommended to use the interactive interface to do this, as the modelling language is completely static.
+
 Language description
 --------------------
 
@@ -172,3 +174,9 @@ The previous metamodel can then be instantiated::
     }
 
     export my_petrinet to models/my_petrinet
+
+Use in interactive interface
+----------------------------
+
+The interactive interface, such as the *prompt.py* script, can also invoke the model compiler.
+In this case, however, the import, export, and model type and model name parameters are ignored as they have to be defined and checked in the bigger context of the MvC.

+ 1 - 0
integration/code/reachability.alc

@@ -40,6 +40,7 @@ Element function reachability_graph(params : Element, output_mms : Element):
 	result = create_node()
 	out_model = instantiate_model(output_mms["ReachabilityGraph"])
 	in_model = params["pn"]
+	log("In model: " + cast_e2s(in_model))
 
 	// Create a dictionary representation for each transition
 	transition_vectors_produce = create_node()