In this document we descrive the XTA format of Uppaal 4.x and the Uppaal Timed Automata Parser library (libutap).
UPPAAL 3.4 and 4.x support three different file formats.
All of the file formats exist in a 3.x and a 4.x version: The 4.x version introduces a non-trivial subset of C and as a consequence we have updated the syntax to look more like C. The parser library supports both 3.x and 4.x files.
Notice that the XML file format might change before UPPAAL 4.x is released.
The 4.x version of the syntax has been enriched with a number of C constructs. Infact, it is easier to state which parts of C will not be allowed in UPPAAL. Pointers and recursive functions will not be allowed. Data types are limited to UPPAAL style bounded integers, booleans, arrays and structs (besides the usual clock, chan and constant types). The feature to specify the bit-width of fields in a struct will not be supported. Enumeration and union types are not supported. The goto statement is not allowed. The use of the comma expression is limited to certain special cases. The bitwise negation operator is not allowed (it is incompatible with UPPAAL's bounded integers). For booleans, the C++ bool data type is supported. Also, C++ style reference types will be supported in function parameters. All other features of C are allowed.
The new syntax is not compatible with the syntax of UPPAAL 3.x. Requiring backwards compatibility made the language ambiguous and was dropped. Instead, UPPAAL 4.x will support the old syntax via an option.
The following modifications to existing language elements where made:
The BNF is split into an BNF for the old syntax and one for the new syntax (although some productions in the new syntax are also used in the old syntax).
The lexical analyser used depends on the syntax parsed. The keywords 'true', 'false', 'for', 'while', 'do', 'break', 'continue', 'switch', 'if', 'else', 'case', 'default', 'return', 'typedef', and 'struct' are not recognised by the lexical analyser for the old syntax. Also 'const' is not recognised as a prefix. Finally, the ASSIGNMENT token in the old syntax is ':=' whereas it is '=' in the new syntax.
OldXTA ::= <OldDeclaration> * <Instantiation>* <System> OldDeclaration ::= <VariableDecl> | <OldConstDecl> | <OldProcDecl> OldConstDecl ::= 'const' <OldConstDeclId> (',' <OldConstDeclId>)* ';' OldConstDeclId ::= ID <ArrayDecl>* [<Initialiser>] OldProcDecl ::= 'process' ID [ <OldProcParams> ] '{' <OldProcBody> '}' OldProcParams ::= '(' [ <OldProcParam> (';' <OldProcParam>)* ] ')' OldProcParam ::= <Type> ID <ArrayDecl>* (',' ID <ArrayDecl>*)* | 'const' ID <ArrayDecl>* (',' ID <ArrayDecl>*)* OldProcBody ::= (<VarDecl> | <OldConstDecl>)* <OldStates> [<Commit>] [<Urgent>] <Init> [<OldTransitions>] OldStates ::= 'state' <OldStateDecl> (',' <OldStateDecl>)* ';' OldStateDecl ::= ID [ '{' <OldInvariant> '}' ] OldInvariant ::= <Expression> (',' <Expression>)* OldTransitions ::= 'trans' <OldTransition> (',' <OldTransitionOpt>)* ';' OldTransition ::= ID '->' ID <OldTransBody> OldTransitionOpt ::= OldTransition | '->' ID <OldTransBody> OldTransBody ::= '{' [<OldGuard>] [<Sync>] [<Assign>] '}' OldGuard ::= 'guard' <Expression> (',' <Expression>)* ';'
XTA ::= <Declaration>* <Instantiation>* <System> Declaration ::= <FunctionDecl> | <VariableDecl> | <TypeDecl> | <ProcDecl> Instantiation ::= ID ASSIGNMENT ID '(' <ArgList> ')' ';' System ::= 'system' ID (',' ID)* ';' ParameterList ::= '(' [ <Parameter> ( ',' <Parameter> )* ] ')' Parameter ::= <Type> [ '&' ] ID <ArrayDecl>* FunctionDecl ::= <Type> ID <ParameterList> <Block> ProcDecl ::= 'process' ID <ParameterList> '{' <ProcBody> '}' ProcBody ::= (<FunctionDecl> | <VariableDecl> | <TypeDecl>)* <States> [<Commit>] [<Urgent>] <Init> [<Transitions>] States ::= 'state' <StateDecl> (',' <StateDecl>)* ';' StateDecl ::= ID [ '{' <Expression> '}' ] Commit ::= 'commit' StateList ';' Urgent ::= 'urgent' StateList ';' StateList ::= ID (',' ID)* Init ::= 'init' ID ';' Transitions ::= 'trans' <Transition> (',' <TransitionOpt>)* ';' Transition ::= ID '->' ID <TransitionBody> TransitionOpt ::= Transition | '->' ID <TransitionBody> TransitionBody ::= '{' [<Guard>] [<Sync>] [<Assign>] '}' Guard ::= 'guard' <Expression> ';' Sync ::= 'sync' <Expression> ('!' | '?') ';' Assign ::= 'assign' <ExprList> ';' TypeDecl ::= 'typedef' <Type> <TypeIdList> (',' <TypeIdList>)* ';' TypeIdList ::= ID <ArrayDecl>*
VariableDecl ::= <Type> <DeclId> (',' <DeclId>)* ';' DeclId ::= ID <ArrayDecl>* [ ASSIGNMENT <Initialiser> ] Initialiser ::= <Expression> | '{' <FieldInit> ( ',' <FieldInit> )* '}' FieldInit ::= [ ID ':' ] <Initialiser> ArrayDecl ::= '[' <Expression> ']' Type ::= <Prefix> ID [ <Range> ] | <Prefix> 'struct' '{' <FieldDecl>+ '}' FieldDecl ::= <Type> <FieldDeclId> (',' <FieldDeclId>)* ';' FieldDeclId ::= ID <ArrayDecl>* Prefix ::= ( [ 'urgent' ] [ 'broadcast' ] | ['const'] ) Range ::= '[' <Expression> ',' <Expression> ']'
Block ::= '{' ( <VariableDecl> | <TypeDecl> )* <Statement>* '}' Statement ::= <Block> | ';' | <Expression> ';' | 'for' '(' <ExprList> ';' <ExprList> ';' <ExprList> ')' <Statement> | 'while' '(' <ExprList> ')' <Statement> | 'do' <Statement> 'while' '(' <ExprList> ')' ';' | 'if' '(' <ExprList> ')' <Statement> [ 'else' <Statement> ] | 'break' ';' | 'continue' ';' | 'switch' '(' <ExprList> ')' '{' <Case>+ '}' | 'return' ';' | 'return' <Expression> ';' Case ::= 'case' <Expression> ':' <Statement>* | 'default' ':' <Statement>*
Last updated .ExprList ::= <Expression> ( ',' <Expression> )* Expression ::= ID | NAT | 'true' | 'false' | ID '(' <ArgList> ')' | <Expression> '[' <Expression> ']' | '(' <Expression> ')' | <Expression> '++' | '++' <Expression> | <Expression> '--' | '--' <Expression> | <Expression> <AssignOp> <Expression> | <UnaryOp> <Expression> | <Expression> <Rel> <Expression> | <Expression> <BinIntOp> <Expression> | <Expression> <BinBoolOp> <Expression> | <Expression> '?' <Expression> ':' <Expression> | <Expression> '.' ID> AssignOp ::= ASSIGNMENT | '+=' | '-=' | '*=' | '/=' | '%=' | '|=' | '&=' | '^=' | '<<=' | '>>=' UnaryOp ::= '-' | '!' Rel ::= '<' | '<=' | '==' | '!=' | '>=' | '>' BinIntOp ::= '+' | '-' | '*' | '/' | '%' | '&' | '|' | '^' | '<<' | '>>' BinBoolOp ::= '&&' | '||' ArgList ::= [ <Expression> ( ',' <Expression> )* ]