Reference manual (german)
Introduction
GPAL (GM Petri net Abstraction Layer) provides an abstract view on
SCPNs. It provides facilities to load a given net from its XML file or
to generate a new net from scratch.
Various model checks make sure that the C++ code that a code generator
will produce from the net, is most likely to be correct. All
expressions that a user may enter (like inscriptions, firing delays,
guard functions etc.) can be checked for syntactical and type
correctness.
Another important feature of GPAL is a process named
inlining of a model. Models can contain instances of modules
that may be kept in external libraries. To ease code generation such a
net must be inlined which means that all instances of such
modules will be 'instantiated' (in the original sence of the word),
i.e. a copy of the implementation of the module will be created for
each instance and replace it.
An inlined SCPN can be stored to an XML file.
Grammars
As mentioned above GPAL can perform syntactical checks on expressions
entered by the user. An {@link gpal.parsers.SCPNParser ANTLR-generated
parser} is used to build up an {@link gpal.parsers.ast AST} (Abstract Syntax Tree) for each
expression. The grammar is based on Java's grammar concerning logical
and arithmetical expressions.
Type system
Understanding how it works
There a three major operations done by GPAL:
- Loading and preparing the model
- Checking the model
- Inlining the model
- Generating the C++ code
Loading and preparing the model
Starting with a new {@link gpal.SCPNet SCPNet object} the underlying
XML document is analyzed recursively. During this process each XML
element becomes represented by an object implementing the {@link
gpal.Entity Entity interface}. Examples: {@link gpal.Place Place},
{@link gpal.TimedTransition Timed Transition}, {@link
gpal.SubstitutionTransition Substitution Transition} or {@link
gpal.modules.Module Module}.
After loading an XML file like this, the model must be
prepared before doing anything else with it. (I.e. the {@link
gpal.Entity#prepare prepare() method} must be called.} During
preparation phase the following actions are taken:
- imported libraries are loaded
- expressions are parsed
- referenced tokentypes are looked up
- instantiated modules are looked up
Checking the model
A prepared model can be checked. (I.e. the {@link
gpal.Entity#check check method} can be called.) There are various
checks that will be performed recursively on the whole model; some
examples are:
- existence of referenced place names
- existence of referenced module names
- uniqueness of names in a namespace
- syntax checks on all expressions according to their respective grammars
- type correctness of all expressions
Inlining the model
After checking a model it can be inlined. All parameters are
replaced by their respective values. All module instances are replaced
by substitution transitions containing the selected implementation as
one replication.
An inlined model can be stored to an XML file.
Generating C++ code
The code generation requires an inlined net.