| program ::= |
|
RML program. |
| stmt ...2 |
|
Executes the stmts in the given order. |
| stmt ::= |
|
Statement. |
| rel_var(term,...) := rel_expr; |
|
Assigns the result of rel_expr to rel_var. |
|
→3 |
The terms must be attributes or str_literals. |
|
→ |
The set of attributes among the terms on the left hand side |
|
|
must equal the set of free attributes in rel_expr. |
| rel_var(term,...); |
|
Shortcut for rel_var(term,...) := TRUE(term,...). |
| str_var := str_expr; |
|
Assigns the result of str_expr to str_var. |
| num_var := num_expr; |
|
Assigns the result of num_expr to num_var. |
| IF rel_expr {stmt ...} ELSE {stmt ...} |
|
Executes the stmts before ELSE if the result of rel_expr is TRUE(), |
| IF rel_expr {stmt ...} |
|
and the stmts after ELSE (if present) otherwise. |
|
→ |
rel_expr must not have free attributes. |
| WHILE rel_expr {stmt ...} |
|
Exec. the stmts repeatedly as long as rel_expr evaluates to TRUE(). |
|
→ |
rel_expr must not have free attributes. |
| FOR str_var IN rel_expr {stmt ...} |
|
Executes the stmts once for each element in the result of rel_expr. |
|
→ |
rel_expr must have exactly one free attribute. |
| PRINT print_expr,...; |
|
Writes the results of the print_exprs to stdout. |
| PRINT print_expr,... TO STDERR; |
|
Writes the results of the print_exprs to stderr. |
| PRINT print_expr,... TO str_expr; |
|
Appends the results of the print_exprs to the specified file. |
| EXEC str_expr; |
|
Executes the shell command given by str_expr. |
|
|
The exit status is available as numerical constant exitStatus. |
| EXIT num_expr; |
|
Exits CrocoPat with the given exit status. |
| { stmt ... } |
|
Executes the stmts in the given order. |
| rel_expr ::= |
|
Relational Expression. The result is a relation. |
| rel_var(term,...) |
|
Atomic relational expression. |
| term rel_var term |
|
Same as rel_var(term, term). |
| ! rel_expr |
|
Negation (not). |
| rel_expr & rel_expr |
|
Conjunction (and). |
| rel_expr | rel_expr |
|
Disjunction (or). |
| rel_expr -> rel_expr |
|
Implication (if). r1 -> r2 is equivalent to !(r1) | (r2). |
| rel_expr <-> rel_expr |
|
Equivalence (if and only if). |
|
|
r1 <-> r2 is equivalent to (r1 -> r2) & (r2 -> r1). |
| EX(attribute,..., rel_expr) |
|
Existential quantification of the attributes. |
| FA(attribute,..., rel_expr) |
|
Universal quantification of the attributes. |
| TC(rel_expr) |
|
Transitive closure. |
|
→ |
rel_expr must have exactly two free attributes. |
| TCFAST(rel_expr) |
|
Same as TC, but with an alternative algorithm (see Section 2.3). |
| FALSE(term,...) |
|
Empty relation. |
| TRUE(term,...) |
|
Relation containing all tuples of strings in the universe. |
| @str_expr(term) |
|
Strings in the universe that match the regular expression str_expr. |
| ~(term, term) |
|
Lexicographical order of all strings in the universe.4 |
| term ~ term |
|
Same as ~(term, term). |
| ~(num_expr, num_expr) |
|
Numerical comparison. The result is either TRUE() or FALSE().4 |
| num_expr ~ num_expr |
|
Same as ~(num_expr, num_expr). |
| rel_expr ~ rel_expr |
|
Relational comparison. The result is either TRUE() or FALSE().4 |
| (rel_expr)
|
| term ::= |
|
Term. |
| attribute |
|
Attribute. |
| _ |
|
Anonymous attribute. E.g. R(_) is equivalent to EX(x, R(x)). |
| str_expr |
|
String expression. |
| str_expr ::= |
|
String Expression. The result is a string. |
| str_literal |
|
String literal. |
| str_var |
|
String variable. |
| STRING(num_expr) |
|
Converts the result of num_expr into a string. |
| $ num_expr |
|
Command line argument. The first argument has the number 1. |
|
|
The constant argCount contains the number of arguments. |
| str_expr + str_expr |
|
Concatenation. |
| (str_expr) |
| num_expr ::= |
|
Numerical Expression. The result is a floating point number. |
| num_literal |
|
Numerical literal. |
| num_var |
|
Numerical variable. |
| NUMBER(str_expr) |
|
Converts the result of str_expr into a number. Yields 0.0 if |
|
|
the result of str_expr is not the string representation of a number. |
| #(rel_expr) |
|
Cardinality (number of elements) of the result of rel_expr. |
| MIN(rel_expr), MAX(rel_expr), SUM(rel_expr), AVG(rel_expr) |
|
|
Minimum, maximum, sum, and arithmetic mean of NUMBER(s) |
|
|
over all strings s in the result of rel_expr. |
|
→ |
rel_expr must have one free attribute, its result must be non-empty. |
| num_expr + num_expr |
|
Addition. |
| num_expr - num_expr |
|
Subtraction. |
| num_expr * num_expr |
|
Multiplication. |
| num_expr / num_expr |
|
Real division. |
| num_expr DIV num_expr |
|
Integer division (truncating). |
| num_expr MOD num_expr |
|
Modulo. |
| num_expr ^ num_expr |
|
The first num_expr raised to the power given by the second num_expr. |
| argCount |
|
Number of command line arguments. |
| exitStatus |
|
Exit status of the last executed EXEC statement. |
| (num_expr) |
| print_expr ::= |
|
Print Expression. |
| rel_expr |
|
Prints the tuples in the result of rel_expr, one tuple per line. |
| [str_expr] rel_expr |
|
Prints the result of str_expr before each tuple of rel_expr. |
| str_expr |
|
Prints the result of str_expr. |
| num_expr |
|
Prints the result of num_expr. |
| ENDL |
|
Prints a line break. |
| RELINFO(rel_expr) |
|
Prints information about the BDD representation of rel_expr.
|
| f( rel_var(term1, term2,...) ) |
|
:= |
|
{ termi | termi is an attribute } |
| f( !rel_expr ) |
|
:= |
|
f( rel_expr ) |
| f( rel_expr1 & rel_expr2 ) |
|
:= |
|
f( rel_expr1 ) ∪ f( rel_expr2 ) |
| f( rel_expr1 | rel_expr2 ) |
|
:= |
|
f( rel_expr1 ) ∪ f( rel_expr2 ) |
| f( rel_expr1 -> rel_expr2 ) |
|
:= |
|
f( rel_expr1 ) ∪ f( rel_expr2 ) |
| f( rel_expr1 <-> rel_expr2 ) |
|
:= |
|
f( rel_expr1 ) ∪ f( rel_expr2 ) |
| f( EX(attribute, rel_expr) ) |
|
:= |
|
f( rel_expr ) \ { attribute } |
| f( FA(attribute, rel_expr) ) |
|
:= |
|
f( rel_expr ) \ { attribute } |
| f( TC(rel_expr) ) |
|
:= |
|
f( rel_expr ) |
| f( TCFAST(rel_expr) ) |
|
:= |
|
f( rel_expr ) |
| f( (num_expr1 ~ num_expr2) ) |
|
:= |
|
∅ |
| f( (rel_expr1 ~ rel_expr2) ) |
|
:= |
|
∅ |
| f( (rel_expr) ) |
|
:= |
|
f( rel_expr ) |
| . |
Matches any single character. |
| [ ] |
Matches any single character contained within the brackets. |
| [^ ] |
Matches any single character not contained within the
brackets. |
| ^ |
Matches the start of the string. |
| $ |
Matches the end of the string. |
| {x,y} |
Matches the last character (or regular expression enclosed by
parentheses) |
| |
at least x and at most y times. |
| + |
Matches the last character (or regular expression enclosed by
parentheses) one or more times. |
| * |
Matches the last character (or regular expression enclosed by
parentheses) zero or more times. |
| ? |
Matches the last character (or regular expression enclosed by
parentheses) zero or one times. |
| | |
Matches either the expression before or the expression after the
operator. |