Keywords

GitHub   Edit on GitHub

Languages typically classify keywords in three categories—strict, soft, and reserved.


Strict keywords

Strict keywords can only be used where specified by the language and can never be used as identifiers. In Grain, these keywords are:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
keyword =
| "assert"
| "break"
| "continue"
| "else"
| "enum"
| "except"
| "exception"
| "export"
| "fail"
| "false"
| "for"
| "foreign"
| "from"
| "if"
| "import"
| "let"
| "match"
| "mut"
| "primitive"
| "rec"
| "record"
| "throw"
| "true"
| "type"
| "void"
| "wasm"
| "when"
| "while"
;

Soft keywords

Soft keywords are sometimes allowed be used as an identifier, depending on the context.

Grain currently has no soft keywords.


Reserved keywords

Reserved keywords are keywords that are not yet used by the language, but are disallowed as identifiers to allow programs to continue to be compatible with future versions of grainc.

The reserved keywords are as follows:

1
2
3
4
reserved_keyword =
| "try"
| "catch"
;
This is a notification!