Lexical Structure

Programs

A program in the Fore.NET language consists of one or more source files known formally as compilation units. A source file is an ordered sequence of Unicode characters. A program is compiled using three steps:

  1. Transformation of source texts into a sequence of Unicode characters.

  2. Lexical analysis, which translates a stream of Unicode input characters into a stream of lexemes.

  3. Syntactic analysis, which translates the stream of lexemes into executable code.

Language Grammar

This specification describes language syntax using two grammars. The lexical grammar determines how Unicode characters are combined to form line terminators, spaces, comments and lexemes. The syntactic grammar determines how the lexemes resulting from the lexical grammar are combined to form Fore.NET programs.

Lexical Analysis

Four basic elements make up the lexical structure of a Fore.NET program: line terminators, spaces, comments and lexemes. Of these basic elements, only lexemes are significant in the syntactic grammar of a program.

The lexical processing of a program consists in reducing source texts into a sequence of lexemes, which becomes the input to the syntactic analysis.