Start the REPL
The current front-end for metaDepth is a textual command-line interpreter. To start it, just open a command window, and in the directory where metaDepth is located, type:
java -jar metaDepth.jarthen, the system should greet you with something like:
MetaDepth v0.2
Top level command shell
Sun Sep 02 16:41:35 CEST 2012
>Commands & help
The ">" symbol is the prompt, where you can type commands. To obtain help on the available commands, type help, which should produce the following output:
:: command list:
gensrl :generates a serializer of the current context
dump :shows in screen the contents of the current context
save "name" :saves the current context into a file
verify :evaluates all the constraints in the context
set var_name value :sets the value for environment variables, or gets their value
rename <oldName> <newName> :renames a clabject
debug (on | off) :turns on or off debugging messages
quit :exits this shell
srl "name" :saves the current context into a file
help :presents this list
compile (comp) model :compiles a specific model (or all models) to PlantUML format
context "name" :enters a specific context
load (lang)? "name" :loads a model in language 'lang'Environment & model contexts
The system allows defining environment variables. To check which ones are defined, type set, which should produce an output similar to:
SRL = serializers/
OUT = bin/
PATH = c:\research\.
DIR = ./
URI = file:/c:/research/./
:: getting environment variablesOne important variable is DIR, which controls the path where models are loaded. To set this variable to C:/dir/, type SET DIR "c:/dir/".
To load a model from a file, e.g. ClassDiagram.mdepth (see the examples section), type load "ClassDiagram.mdepth".
To see the contents of the virtual machine type dump.
The command line allows to enter into contexts. For example, if there is a model M, one can enter in its context by context M, and then, e.g. verify that all defined constraints hold with verify. To get outside of any context, type context $root
In any context, one can execute metaDepth or EOL statements. The former is done by typing # (followed by enter) and then the statements, and then to finish. For example, in the outer-most context, one can type:#
Model M{
Node B{
att : String;
}
}
#:: dumping all
ext Model M@1{
ext Node B@1
{
att@1:String;
}
}#
M m0{
B b0{att="hello";}
B {att="world";}
}
#ext M m0{
ext B b0
{
att="hello";
}
ext B MD_c79739c12be8416bad99e610b14a8396
{
att="world";
}
}# EOL
for (i in Sequence{1..2000}) {
var b : new B;
b.att:=i.toString();
b.println();
}
#A good description of some of the metaDepth's features can be found in this paper, submitted to the TOOLS conference.