Download Master`s Thesis
Transcript
3.2 TA System Tester Implementation
3.2.1 UPPAAL system parsing
The first necessary step for any system simulation is to actually open and parse the file in
which the system was defined. We've described the file format in chapter 2.2.1.
.NET offers robust XML parsing functions in the System.Xml namespace. The
XmlDocument class offers all the necessary functionality to read the system file. We provide the
TASystem.ParseSystemFromXML() function to do all the necessary loading.
Once loaded, the system is represented in a fashion closely following the UPPAAL XML,
with only some terminology changes. For run-time performance reasons, nodes also cache all the
outgoing edges that originate in it.
3.2.2 UPPAAL language parsing
On top of providing means to describe automata, UPPAAL implements a flexible scripting
language with C-like syntax. Since at least some parts of it are necessary to properly create a
working test environment, we have provided a parser and interpreter for said language. However,
UPPAAL's language is the result of many years of work, so we can't really provide a complete,
rigorous implementation. Instead, we'll only concern ourselves with a strict subset of this
language, based on our own needs and requirements. More details on this are further down this
chapter.
–
–
–
–
Given the system file structure, we need to support these constructs:
variable declarations
global / local variable scoping
template instantiations
expression evaluator
Variable declarations are imported in a straightforward way. We simply look if the source
code line begins with one of the known identifiers and then we consider the rest of the line (up
until the semicolon) to be the identifier:
<type> <ident>;
When instantiating templates, we must use this format:
<instance name> = <template name>({parameters});
Apart from handling parameters when instantiating templates, this is all that is required to
write rudimentary declaration scripts.
Also of note, the system keyword is actually ignored, instantiating is done just by the
scripts for individual instances. But to be compatible with UPPAAL, you still need to use the
keyword.
18