-
Notifications
You must be signed in to change notification settings - Fork 2
CMLGrammar
Contents
values
, { value definition }private
| protected
| public
| logical
channels
, { channel name declarations }chansets
, { chanset definition }namesets
, { nameset definition }state
, { instance variable definition }inv
, expression
Note: the only parametrisation qualifier allowed in a process
declaration is val
. (Omitting a parametrisation qualifier defaults
to val
, and is permitted as well.)
val
| res
| vres
actions
, { action definition }[[``, |renaming pair|_, { ``,``, |renaming pair|_ }, ``]]
[[``, |renaming pair|_, ``|`` |bind list|_, [ ``@``, |expression|_ ], ``]]
Note that the current parser only supports a single expression after an identifier in a renaming pair; this will be corrected in a future release.
[
, nameset expression, |
, chanset expression, ||
, chanset expression, |
, nameset expression, ]
, action
return
, [ expression ]bool
| nat
| nat1
| int
| rat
| real
| char
| token
()
Operations do not include reactive constructs; while the parser will
accept any action in an operation body, the typechecker will only allow
statements, the ;
sequential composition operator, and the constant
action Skip
. In essence, operation bodies in CML allow only what is
allowed in VDM operation bodies.
operations
, { operation definition }:
, operation type, identifier, parameters, ==
, operation body, [ pre
, expression ], [ post
, expression ]pre
, expression ], post
, expression
functions
, { function definition }:
, function type, identifier, parameters list, ==
, function body, [ pre
, expression ], [ post
, expression ], [ measure
, name ]pre
, expression ], post
, expression
~
+
| -
| abs
| floor
| not
| card
| power
| dunion
| dinter
| hd
| tl
| len
| elems
| inds
| reverse
| conc
| dom
| rng
| merge
| inverse
+
| -
| *
| /
| div
| rem
| mod
| <
| <=
| >
| >=
| =
| <>
| or
| and
| =>
| <=>
| in
set
| not
in
set
| subset
| psubset
| union
| \
| inter
| ^
| ++
| munion
| <:
| <-:
| :>
| :->
| comp
| **
[ Please note: the parser's implementation of this is still incomplete. For now it's probably best to stick within the ASCII character set. ]
Unlike the rest of this specification, the rules in this section are sensitive to whitespace; as such, whitespace may not implicity separate any pair of components in a rule here.
Note that the unicode character categories can be found online at http://www.fileformat.info/info/unicode/category/index.htm. The present release of the tool only supports characters below U+0100; support for characters outside of the extended ASCII subset of unicode is planned for a future release.
- initial letter →
- if
codepoint < U+0100
then Any character in categories Ll, Lm, Lo, Lt, Lu, or the characterU+0024
(\$
) else Any character, excluding categories Cc, Zl, Zp, Zs, Cs, Cn, Nd, Pc. ;
- following letter →
- if
codepoint < U+0100
then Any character in categories Ll, Lm, Lo, Lt, Lu, Nd, or the charactersU+0024
(\$
),U+0027
('
), andU+005F
(_
) else Any character, excluding categories Cc, Zl, Zp, Zs, Cs, Cn. ;
- ascii letter →
- Any character in the ranges [
U+0041
,U+005A
] and [U+0061
,U+007A
] --- A-Z and a-z, respectively. ;
- character →
- Is left underdefined, except to note that it may be any unicode
character except those that conflict with the lexical rule that uses
the character class. For example, character does not include
\
in the character literal rule. ;
0
| 1
| 2
| 3
| 4
| 5
| 6
| 7
| 8
| 9
true
| false
nil