# GSiril

## Expressions

### Place notation

The simplest example of an expression is a piece of place notation. The syntax for place notation is fairly flexible: a dot (`.`) is only required where it is needed to separate two non-cross changes, although it may be used to separate any changes; external places can be left implicit; the cross change may be specified `-`, `x` or `X`; and the symbols for bells above 10 may be specified in upper or lower case.

Place notation comes in two types: symmetrical and asymmetrical blocks. Symmetrical blocks must be prefixed `&` and asymmetric blocks must be prefixed `+`. Commas may be used to separate blocks of place notation (or indeed any sort of expression). Some examples are given below.

```PB = &-6-6-6, +2;     // A plain lead of Plain Bob Minor
Gr = +3.6-6-6-6-6-6;  // A plain lead of Grandsire Minor
```

### References

Expressions may also reference other symbols by name. For example,

```lead = &-6-6-6;
```

(Note that the of `p`, above, refers to the `lead` symbol by name. Therefore, if `lead` were to be redefined as a lead of Double Oxford, `p` would then refer to a plain lead of Double Oxford.)

### Repetition

Repetition can be handled by prefixing an expression with a number, optionally followed by a `*`. As names may never begin with a digit, it is safe to omit any whitespace between the number and a symbol to be repeated. For example, the expressions in the following four definitions are identical.

```course1 = b, 3*p, b;
course2 = b, 3 p, b;
course3 = b, 3p, b;
course4 = b, p, p, p, b;
```

Parentheses can be used to group blocks, for example, when they are to be repeated. For example, the standard 120 of Plain Bob Minor, could be written as follows.

```touch = 2(b, 3p, b);
```

### Formatted output

In addition to place notation, expressions may contain strings that are to be printed whilst proving the composition. String literals are put in double quotes, `"like this"`. Several characters, or sequences of characters have special meanings when included in string literals. These are listed below.

```@     Prints the current row
\$\$    Terminate the current proof immediately
\$     Prints the number of repeated rows
#     Prints the total number of rows
\n    Prints a new line character
\t    Prints a tab character
\'    Prints a literal " sign [sic]
\x    Prints a literal x character (for any other x).
```

Ordinarily, string literals will end with an implicit new line character; to suppress this put a backslash immediately before the closing double quote of the string.

A common use of string literals is for outputting information about the touch being proved. For example, these definitions of `p` and `b` will print out the lead heads, together with a dash to mark bobbed leads.

```p = lead, +2, "  @";
b = lead, +4, "- @";
```