summaryrefslogtreecommitdiff
path: root/chapter17a/docs/17-grammar.md
blob: a8cd88183b6d01ba0317882b4aa5825b7eeb8988 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Chapter 17a grammar additions

English | [日本語](17-grammar.ja.md)

The expression and statement forms are those of Chapter 16. Declarations add
independent access and binding modifiers:

```text
declaration = type binding ("," binding)* ";"
binding     = ("!" | "~")? identifier ("=" expression)?
type        = ("!" | "~")? name suffix*
suffix      = "?" | "[]" | "[~]"
```

A prefix qualifier requires a struct reference. It qualifies the named base,
not enclosing arrays. Each bracket pair qualifies its own array layer. A binding
modifier applies only to the following name. See the README for defaults and
constructor initialization rules. `var`, `val`, increments, compound assignments,
conditional expressions, and `for` loops are introduced in Chapter 17b.