Cortex Syntax

Notation

In the grammar below, the following notation is used:

  • An arrow (→) marks grammar productions and can be read as “can consist of”
  • Syntactic categories are written in lowercase italic (newline) on both sides of a production rule.
  • Placeholders for recursive syntactic categories are indicated by ···.
  • Literal words and punctuation are indicated in bold (+) or as a Unicode codepoint (U+00A0) or as a Unicode codepoint range (U+2000-U+200A).
  • Alternatives are indicated by a vertical bar (|)
  • Optional elements are indicated in square brackets
  • Elements that can repeat 1 or more times are indicated by a trailing plus sign
  • Elements that can repeat 0 or more times are indicated by a trailing star sign
  • Elements that can repeat 0 or more times, separated by a another element are indicated with a trailing hash sign, followed by the separator. If no separator is provided, the comma (,) is implied.

Grammar

quoted-text-item → U+0000-U+0009 U+000B-U+000C U+000E-U+0021 U+0023-U+2027 U+202A-U+D7FF | U+E000-U+10FFFF

linebreak → (U+000A [U+000D]) | U+000D | U+2028 | U+2029

unicode-charquoted-text-item | linebreak | U+0022

pattern-syntax → U+0021-U+002F | U+003A-U+0040 | U+005b-U+005E | U+0060 | U+007b-U+007e | U+00A1-U+00A7 | U+00A9 | U+00AB-U+00AC | U+00AE | U+00B0-U+00B1 | U+00B6 | U+00BB | U+00BF | U+00D7 | U+00F7 | U+2010-U+203E | U+2041-U+2053 | U+2190-U+2775 | U+2794-U+27EF | U+3001-U+3003 | U+3008-U+3020 | U+3030 | U+FD3E | U+FD3F | U+FE45 | U+FE46

inline-space → U+0009 | U+0020

pattern-whitespaceinline-space | U+000A | U+000B | U+000C | U+000D | U+0085 | U+200E | U+200F | U+2028 | U+2029

whitespacepattern-whitespace | U+0000 | U+00A0 | U+1680 | U+180E | U+2000-U+200A | U+202f | U+205f | U+3000

line-comment// (unicode-char)* linebreak)

block-comment/* (((unicode-char)* linebreak)) | block-comment) */

digit → U+0030-U+0039 | U+FF10-U+FF19

hex-digitdigit | U+0041-U+0046 | U+0061-U+0066 | U+FF21-FF26 | U+FF41-U+FF46

binary-digit → U+0030 | U+0031 | U+FF10 | U+FF11

numerical-constantNaN | Infinity | +Infinity | -Infinity

base-10-exponent → (e | E) [sign](digit)+

base-2-exponent → (p | P) [sign](digit)+

binary-number0b (binary-digit)+ [. (binary-digit)+ ][exponent]

hexadecimal-number0x (hex-digit)+ [. (hex-digit)+ ][exponent]

decimal-number → (digit)+ [. (digit)+ ][exponent]

sign+ | -

signed-numbernumerical-constant | ([sign] (binary-number | hexadecimal-number | decimal-number)

symbolverbatim-symbol | inline-symbol

verbatim-symbol` (escape-sequence | symbol_start) (escape-sequence | symbol_continue)* `

inline-symbolsymbol-start (symbol_continue)*

escape-expression\( expression )

single-line-string" (escape-sequence | escape-expression | quoted-text-item)* "

multiline-string""" multiline-string-line """

extended-string

stringsingle-line-string | multiline-string | extended-string

primarysigned-number | symbol | string

expressionprimary

shebang#! (unicode-char)* (linebreak | _eof)

cortex → ([shebang] (expression)* eof)!