The Freya Programming Language

Lexical structure

See also

The lexical syntax of Freya has no big surprises. Freya is a Unicode, case insensitive, but accent insensitive, language. Whitespace is ignored except in its role of separating significative lexemes. Line feeds are considered as whitespace, and there are no nasty tricks involving the indentation.

Identifiers

Freya identifiers always begin with a letter character or an underscore, followed by a sequence of arbitrary length containing letters, decimal digits and underscores. Identifiers are case insensitive, but not accent insensitive. For instance, bitSet and BitSET represents the same identifier, but deja and déjà are different identifiers.

NoteNote
In any case, it's not a good idea declaring identifiers with an extended character set, at least, if you're not writing a small monolithic application. Otherwise, you should consider your code may be used by programmers with a keyboard unable to generate those special characters.

Keywords

The following identifiers have special meanings, and they are considered as reserved words:

abstractandasbegincase
classconstconstructordestructordiv
dodowntoelseendensures
eventexceptexternfalsefault
finallyforgotoifimplementation
ininterfaceinternalinvariantis
iteratorlockloopmethodmod
namespacenewnilnotof
oldonoperatororout
overridepartialprivatepropertyprotected
publicraisereadonlyrecordrepeat
requiredsealedshlshrstatic
thentotruetryuntil
usingvarvirtualwhilexor
yield 

However, you still use these keywords as regular identifiers by adding an at character (@) as a prefix:

// Partial is a keyword, but is used here
// as a regular identifier.
method ProcessClass(@partial: Boolean);
begin
    if @partial then
        // ...
end;

Keywords are case insensitive: BEGIN and begin represents the same keyword.

Comments

Freya allows two kinds of comments:

  1. Line comments: they start with two consecutive slashes (//) and they end with the end of the line.
  2. Multiline comments: they are enclosed between curly braces, and they can extend across several lines.

Multiline comments cannot be nested.

See also

The Freya Programming Language
Program and file structure
Projects and source files
Namespaces
Implementation sections
using clauses
The entry point
Type declarations
Type members
Statements