GSiril

Formal grammar

This section is just technical appendix and is unlikely to be of interest to most readers.

This section defines a formal grammar for the GSiril language. It is described using the Backus-Naur-like syntax used to describe the grammar of C and C++ in their respective standards.

Statements

statement
definition-statement
exit-statement
bells-statement
extents-statement
rounds-statement
import-statement
prove-statement
definition-statement
identifier = expressionopt
identifier ?= expressionopt
exit-statement
end
quit
exit
bells-statement
integer-literal bells
extents-statement
integer-literal extents
rounds-statement
rounds transposition-literal
import-statement
import identifier
import string-literal
prove-statement
prove expression

Expressions

expression
assignment-expression
assignment-expression
sequence-expression
identifier = assignment-expression
sequence-expression
repetition-expression
repetition-expression , sequence-expression
repetition-expression
integer-literal *opt repetition-expression
repeat *opt repetition-expression
primary-expression
( expression )
( alternatives ;opt )
break
identifier
string-literal
place-notation-literal
transposition-literal
alternatives
alternative
alternative ; alternatives
alternative
expression
test : expression
test
logical-sequence-expression
logical-sequence-expression
logical-primary-expression
repetition-expression , logical-sequence-expression
logical-or-expression
logical-and-expression
logical-or-expression || logical-and-expression
logical-and-expression
logical-primary-expression
logical-and-expression && logical-primary-expression
boolean-primary-expression
( logical-sequence-expression )
pattern-literal

Lexical structure

identifier
alpha
alpha id-char-seq
id-char-seq
alnum
alnum id-char-seq
alnum
alpha
digit
integer-literal
digit
digit integer-literal
string-literal
" s-char-seqopt \opt "
s-char-seq
s-char
s-char s-char-seq
s-char
any character except ", \, @, $ and #
escape-seq
control-seq
control-seq
one of @, $$, $ or #
escape-seq
one of \', \\, \n, \t, \@, \$ or \#
place-notation-literal
+ pn-char-seq
& pn-char-seq
transposition-literal
' bell-char-seq '
pattern-literal
/ pat-char-seq /
pn-char-seq
pn-char
pn-char pn-char-seq
pn-char-seq
pn-char
pn-char pn-char-seq
pn-char-seq
pn-char
pn-char pn-char-seq
bell-char-seq
bell-char
bell-char bell-char-seq
pat-char-seq
pat-char
pat-char pat-char-seq
pn-char
one of ., -, x or X
bell-char
pat-char
one of ?, *
[ bell-char-seq ]
bell-char
bell-char
any digit or alpha (except i, o, x, I, O or X) on the currently-defined number of bells
alpha
any letter az, AZ or _
digit
the digits 09