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.jar
then, the system should greet you with something like:
MetaDepth v0.2
Top level command shell
Sun Sep 02 16:41:35 CEST 2012
>
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 :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'
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 variables
One 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 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;
}
}
#
which creates a new model M containing a node B, both with potency one. If you type dump, you should be presented with
something like:
:: dumping all
ext Model M@1{
ext Node B@1
{
att@1:String;
}
}
Please note that metaDepth outputs models in a canonical way, which may differ from the way you typed them in. In particular, it
makes explicit some modifiers, like strictness (strict) or extensible (ext), the potency (the number after @), and field modifiers.
You can instantiate model M by just typing:
#
M m0{
B b0{att="hello";}
B {att="world";}
}
#
which creates an instance m0 of M, and two instances of B, one of them anonymous. Anonymous instances are given an identifier by metaDepth,
so that if in the context of m0 (type context m0) you type dump, you should get something like:
ext M m0{
ext B b0
{
att="hello";
}
ext B MD_c79739c12be8416bad99e610b14a8396
{
att="world";
}
}
To execute EOL commands simply type # EOL (enter) and then the EOL program. For example, in the context of M,
you can type:
# EOL
for (i in Sequence{1..2000}) {
var b : new B;
b.att:=i.toString();
b.println();
}
#
to create 2000 (anonymous) B objects, set its att attribute and then print the object. When executing this code, you should
get a long listing. You can check what is in the model by typing again dump.
A good description of some of the metaDepth's features can be found in this paper,
submitted to the TOOLS conference.