Annotated King Reference Manual/Lexical Elements

Items
Each lexical element is formed from a sequence of characters, and is either a delimiter, an identifier, a reserved word, a numeric_literal, a character_literal, a string_literal, or a comment.

The text of a compilation is divided into lines.

Separators code points are: 16#20# (SPACE, except within a comment, a string_literal, or a character_literal), 16#0A# (LINE FEED), 16#0D# (CARRIAGE RETURN).

Rationale
A compilation is a sequence of lines, conceptually terminated by a line terminator. King does not specify what character(s), if any, make up a line terminator in a compilation text. Common text file formats on the kinds of systems that King is intended to be used on use one or two characters (CR, LF) as line terminators, so this is probably correct in practice (if King is ever implemented).

Discussion
-

Single
&    '    (    )    *    +   ,    -    .    /    :    ;    <    =    >    @    [    ]    |    {    }    ^   \

Rationale
-

Discussion
-

Syntax
identifier ::= identifier_start {underline identifier_extend} identifier_start ::= letter_uppercase {letter_uppercase | number_decimal} {letter_lowercase | number_decimal} identifier_extend ::= identifier_start | number_decimal {letter_uppercase | number_decimal} {letter_lowercase | number_decimal} Once built as above, specifics rules (see TBD) are enforced to define a valid identifier.

Rationale
An identifier is made up of words separated by underlines. There is an initial word and zero or more subsequent words. The initial word must begin with a capital letter. Subsequent words can begin with a capital letter or a digit.

Discussion
-

Rationale
-

Discussion
-

Syntax
numeric_literal ::= decimal_literal | based_literal decimal_literal ::= numeral [.numeral] [exponent] numeral ::= digit {[underline] digit} exponent ::= E [+] numeral | E - numeral digit ::= number_decimal based_literal ::= base # based_numeral [.based_numeral] # [exponent] base ::= numeral based_numeral ::= extended_digit {[underline] extended_digit} extended_digit ::= digit | letter_uppercase

Rationale
-

Discussion
-

Syntax
character_literal ::=  'graphic_character'

Rationale
-

Discussion
-

Examples
(See expressions for examples of building strings with quotation mark)

Syntax
string_literal ::= "{string_element}" string_element ::= non_quotation_mark_graphic_character

Rationale
-

Discussion
-

Syntax
comment ::= --{non_end_of_line_graphic_character}

Rationale
-

Discussion
-