7.2. Character
A character
is a signed 8-bit value. A character
can be
represented by an i8
in MLIR.
7.2.1. Declaration
A character
value is declared with the keyword character
.
7.2.2. Literals and Escape Sequences
A character
literal is written in the same manner as C99: a single
character enclosed in single quotes. You may not use literal newlines.
For example:
'a'
'b'
'A'
'1'
'.'
'*'
As in C99, Gazprea supports character escape sequences for common characters. For example:
'\0'
'\n'
The following escape sequences are supported by Gazprea:
Description |
Escape Sequence |
Value (Hex) |
---|---|---|
Null |
|
|
Bell |
|
|
Backspace |
|
|
Tab |
|
|
Line Feed |
|
|
Carriage Return |
|
|
Quotation Mark |
|
|
Apostrophe |
|
|
Backslash |
|
|
7.2.3. Operations
The following operations are defined between character
values.
Class |
Operation |
Symbol |
Usage |
Associativity |
---|---|---|---|---|
Grouping |
parentheses |
|
|
N/A |
Comparison |
equals |
|
|
left |
not equals |
|
|
left |
Scalar values with type character
may be concatenated onto
values with type string
or vectors with type character
.
7.2.4. Type Casting and Type Promotion
To see the types that character
may be cast and/or promoted to, see
the sections on Type Casting and Type Promotion
respectively.