File Structure
An SPL file uses the .spl extension and contains a sequence of top-level declarations, in any order:
type ... // enumeration
datatype ... // algebraic datatype
transition ...
agent ...
schema ...
system ...
property ...
pattern ...
rules ...
canonizer ...
regset ... // named register set, used by havocThe parser collects every declaration first and resolves references (regsets, compact havoc lists) once the whole file is known, so a declaration may refer to one that appears later.
A complete file#
type Phase = { IDLE, BUSY } ;
transition start(id : Int) {
guard: phase == IDLE ;
effect: phase := BUSY ;
jobs += 1 ;
}
transition finish(id : Int) {
guard: phase == BUSY ;
effect: phase := IDLE ;
}
agent Worker(id : Int) {
attributes { }
process {
Loop = start(id) . finish(id) . Loop + done ;
}
}
schema Shop {
attributes {
phase : Phase = IDLE ;
jobs : Int = 0 ;
}
invariants {
jobs >= 0 ;
}
}
system OneWorker {
schema: Shop ;
agents {
Worker(0) ;
}
properties {
nonNegative : jobs >= 0 ;
}
}The schema invariant jobs >= 0 is parsed but not checked today; the system property nonNegative is (see Schemas).
include#
A line of the form include "relative/path.spl" is replaced by the contents of that file before parsing. The path is relative to the including file; includes nest. Each file can be included only once per run: a second include of the same file, anywhere, is reported as a circular include.
include "common/registers.spl"include is a line-based pre-pass that only saple analyze (for the model and for --pattern-file) and saple compose perform. saple parse does not expand includes, so it reports a parse error on a file that uses one.
regset#
A regset names a list of registers so that a havoc can refer to all of them at once. Items are attribute names, ranges such as X1..X18, the flag group NZCV and other regsets. See havoc.
regset caller_saved = { X1..X18, X30, NZCV } ;A regset name may only appear inside havoc(…) or another regset; it may not clash with an attribute or a transition, may not be declared twice and may not refer to itself.
Renamed keywords#
Older SPL keywords are rejected with a hint that names the replacement:
| Old | Current |
|---|---|
action | transition |
environment | schema |
pre / post | guard / effect |
Delta | done |