This is the whole syntax of Mica: every rule the compiler reads a program by, written in EBNF, with a syntax diagram for each. The pages are written from the grammar the compiler itself is checked against, so what they state is what the compiler reads.

The chapters run from the characters a source is made of to the expressions inside its statements.

The notation

The rules are written in Wirth’s EBNF, the notation of the Pascal and Oberon reports, with five additions: names joined by hyphens, the exception, the lookahead, character classes, and ranges of characters.

WrittenMeans
name = ... .a rule: its name, an equals sign, what it admits, and a period
"begin"a terminal, written as it stands in a program
a ba, then b
a | ba or b
[ a ]a once or not at all
{ a }a any number of times, none included
( a )a group
a - bwhat a admits except b: identifier - "when" is a name other than when
(?! a )not followed by a: a condition on the next tokens that reads nothing
(?= a )followed by a
? Unicode letter ?one character of a class, or one character by its code point, as ? U+000A ?
"0" .. "9"one character from 0 to 9

The names of rules are written in lower case joined by hyphens, as the Pascal standard writes them, so a rule’s name can never be taken for a Mica name. Three kinds of word stand in quotes: a reserved word, which cannot name anything; a contextual word, which carries its meaning only where a rule uses it and is an ordinary name everywhere else, such as next, when or vector; and an operator. Where the compiler decides by what surrounds a word, the rule carries a note that says so.

Reading a diagram

A diagram is read from left to right along its line, from the bar at its start to the bar at its end. At a fork either branch may be taken, and a branch that bends back may be taken again.

The chapters

ChapterCovers
Characters and tokensA Mica source is UTF-8 text, read into tokens: words, numbers, characters, strings, regular expressions and operators, with white space and comments between them.
Units and declarationsA Mica source is one unit, a program, a library or an object file, made of declarations, routines and a body.
TypesA type is named in a type section, or written in place where a value’s type stands.
StatementsA statement acts: it assigns, calls, chooses, repeats, leaves, fails, emits, or runs tasks and waits for them.
ExpressionsOperators bind from or and xor, the weakest, through and, the comparisons, as, and the adding operators, to the multiplying operators, the strongest.

Every rule

access-mode · action · actual-parameters · aggregate-element · allocation · array-type · assignment-statement · assignment-target · binary-digit · binary-literal · bitrecord-field-group · bitrecord-type · bitset-type · block · block-comment · braced-unicode-escape · byte-order-mark · call-statement · callback-heading · case-element · case-label · case-pattern · case-statement · cast-expression · character · comment · comparison-operator · compilation-unit · compound-statement · concurrent-block · conformant-schema · conjunction · constant-entry · constant-group · constant-section · decimal-digit · decimal-literal · declaration-section · defer-statement · device-scalar-type · digit · dimension · dimension-group · dispose-statement · dynamic-tensor-type · emit-statement · enumeration-literal · enumeration-type · error-domain-type · escape-sequence · exponent · expression · factor · fail-statement · fails-clause · field-group · file-type · floating-point-literal · for-statement · foreign-digit · formal-parameters · function-call · function-heading · generator-heading · generic-parameter · generic-section · handler-section · hex-digit · hex-escape · hexadecimal-literal · identifier · if-statement · import-group · import-member · import-section · index-list · inline-variable-section · integer-literal · interpreter-line · intrinsic-declaration · labeled-loop · leave-statement · letter · line-comment · literal · long-unicode-escape · loop-target · lost-section · masked-integer-literal · multiplying-operator · newline · next-statement · number-head · operator · parameter-group · parameter-name · parameter-type · parenthesized-value · pointer-tensor-type · primary · procedure-heading · process-placement · qualified-type-reference · raw-character · record-type · refused-number · refused-operator · refused-regex · regex-atom · regex-branch · regex-class · regex-class-bracket · regex-class-character · regex-class-member · regex-class-range · regex-escape · regex-literal · regex-pattern · regex-piece · regex-property · regex-property-name · relation · repeat-statement · reserved-word · result-type · routine-declaration · routine-heading · routine-name · schedule-statement · scheduled-stream · select-arm · select-statement · selector · set-constructor · set-element · set-type · shape-form · simple-expression · source · span-type · statement · statement-consumption · statement-sequence · stream-type · string-literal · subrange-type · subscript-digit · sum-field · synchronized-statement · tape-window · task-heading · tensor-type · term · token · type-argument · type-arguments · type-declaration · type-denoter · type-name · type-parameters · type-reference · type-section · typed-constant-value · unicode-literal · unit-kind · until-owner · value-consumption · value-type · variable-group · variable-section · when-guard · while-statement · white-space · wide-integer-type · word