7.2. Character

A characters 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. Null

null is ASCII NUL ('\0', 0x00) for character.

7.2.3. Identity

identity is ASCII SOH (0x01) for characters. This choice allows the casting of a character to an integer to yield the integer identity.

7.2.4. 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

\0

0x00

Bell

\a

0x07

Backspace

\b

0x08

Tab

\t

0x09

Line Feed

\n

0x0A

Carriage Return

\r

0x0D

Quotation Mark

\"

0x22

Apostrophe

\'

0x27

Backslash

\\

0x5C

7.2.5. Operations

The following operations are defined between character values.

Class

Operation

Symbol

Usage

Associativity

Grouping

parentheses

()

(character)

N/A

Comparison

equals

==

character == character

left

not equals

!=

character != character

left

Scalar values with type character may be concatenated onto values with type string or vectors with type character.

7.2.6. 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.