Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 1.5 KB

ii.5.1-general-syntax-notation.md

File metadata and controls

31 lines (21 loc) · 1.5 KB

II.5.1 General syntax notation

This partition uses a modified form of the BNF syntax notation. The following is a brief summary of this notation.

Terminals are written in a constant-width font (e.g., .assembly, extern, and float64); however, terminals consisting solely of punctuation characters are enclosed in single quotes (e.g., ':', '[', and '('). The names of syntax categories are capitalized and italicized (e.g. ClassDecl) and shall be replaced by actual instances of the category. Items placed in [ ] brackets (e.g., [ Filename ] and [ Float ]), are optional, and any item followed by * (e.g., HexByte* and [ '.' Id ]*) can appear zero or more times. The character "|" means that the items on either side of it are acceptable (e.g., true | false). The options are sorted in alphabetical order (to be more specific: in ASCII order, and case-insensitive). If a rule starts with an optional term, the optional term is not considered for sorting purposes.

ILAsm is a case-sensitive language. All terminals shall be used with the same case as specified in this clause.

[Example: A grammar such as

Top ::= Int32 | float Float | floats [ Float [ ',' Float ]* ] | else QSTRING

would consider all of the following to be valid:

12
float 3
float –4.3e7
floats
floats 2.4
floats 2.4, 3.7
else "Something \t weird"

but all of the following to be invalid:

else 3
3, 4
float 4.3, 2.4
float else
stuff

end example]