Section 2: Lexical Structure

This chapter will describe the lexical structure of Keli. Most of the information on this page can be ignored during the first reading of this report.

2.1 Notational Conventions

The following notations are used to described the grammar of Keli (for more info, lookup EBNF):

2.2 Abbreviations

The following abbreviations will be used to describe the lexical structure of Keli.

2.3 Lexical Program Structure

2.4 Comments

Comments are actually whitespaces. Comments starts with 2 slahses and extends until before the following newline. For example:

// this is a comment

2.5 Constant Identifiers

A constant identifier is any sequences of characters that satisfy the following grammar:

( $ | _ | alphabet ) { alphabet | digit | - | _}

For example:

Constant identifiers are used for identifying:

  1. Function parameter

  2. Type

  3. Object property

  4. Type variable

2.6 Function identifiers

Function identifiers are used for identifying functions, they can be any sequences of characters that satisfy the following grammar:

constId | ({operator }) <reservedOp>

In layman term, a function identifier can be a constant identifiers OR a sequences of symbols that are not reserved operator.

Examples of function identifiers:

Last updated