帶註釋的國王參考手冊/詞法元素
外觀
每個詞法元素都由一系列字元組成,可以是界定符、識別符號、保留字、數字文字、字元文字、字串文字或註釋。
編譯的文字被劃分為行。
分隔符程式碼點是:16#20#(空格,除非在註釋、字串文字或字元文字中),16#0A#(換行符),16#0D#(回車符)。
編譯是一系列行,概念上由行結束符終止。King 沒有指定編譯文字中是否有行結束符以及包含哪些字元。King 預期使用的系統上常見的文字檔案格式使用一個或兩個字元(CR、LF)作為行結束符,因此這在實踐中可能是正確的(如果 King 真的被實現了)。
-
& ' ( ) * + , - . / : ; < = > @ [ ] | { } ^ \
=> .. <- /= >= <= <>
-
-
Invalid
V_String
Is_Empty
Latin_1_String
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}
一旦按上述方式構建,就會強制執行特定規則(見 TBD)以定義有效的識別符號。
識別符號由下劃線分隔的單片語成。有一個初始單詞和零個或多個後續單詞。初始單詞必須以大寫字母開頭。後續單詞可以以大寫字母或數字開頭。
-
所有和
開始主體
情況常數
宣告增量數字
否則 elseif 結束退出
對於功能
隱藏
如果 在 是
迴圈
宏 對映 模組
新的 並非 空
的 或者 其他 輸出
過程
範圍 記錄 重新命名 返回 反轉
選擇 分開 序列 設定 一些 子型別
任務 然後 型別
使用
等待 當 與
異或
-
-
99
478E70
16#CAFE#
3.14
0.0
0.25
16#F.FF#E+2
36#THE_QUICK_BROWN_FOX_JUMPS.OVER_THE_LAZY_DOG#
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
-
-
'@'
'Δ'
' '
'''
character_literal ::= 'graphic_character'
-
-
"une soirée passée à étudier les mathématiques ℕ⊂𝕂..." -- Unicode characters
" " -- Space character
"" -- Null string
(參見表示式以獲取使用引號構建字串的示例)
string_literal ::= "{string_element}"
string_element ::= non_quotation_mark_graphic_character
-
-
-- Returns the number of Elements in List
comment ::= --{non_end_of_line_graphic_character}
-
-