For specifying the Claret grammar, we used the Extended Backus-Naur Form (EBNF), a family of metasyntax notation which is often used for formal description of programming languages.
1sud ::= 'systemName' StrLiteral '{' usecase* '}'`
2usecase ::= 'usecase' StrLiteral '{' versions? actor+ pre basic ( exception | alternative )* post '}'
3versions ::= 'version' StrLiteral typeSpec user date
4typeSpec ::= 'type' StrLiteral
5user ::= 'user' StrLiteral
6date ::= 'date' StrLiteral
7actor ::= 'actor' ident StrLiteral
8pre ::= 'preCondition' condition
9post ::= 'postCondition' condition
10steps ::= '{' ( action | response )+ '}'
11action ::= 'step' numeric variable StrLiteral skipAlternative
12response ::= 'step' numeric 'system' StrLiteral skipException
13skipAlternative ::= af | as | bs
14skipException ::= ef | as | bs
15condition ::= StrLiteral ( ',' StrLiteral )*
16basic ::= 'basic' steps
17exception ::= 'exception' numeric StrLiteral steps
18alternative ::= 'alternative' numeric StrLiteral steps
19af ::= 'af' '[' numeric ( ',' numeric )* ']'
20ef ::= 'ef' '[' numeric ( ',' numeric )* ']'
21as ::= 'as' numeric ':' numeric
22bs ::= 'bs' numeric
23numeric ::= [0-9]+
24variable ::= ident