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.
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.
Note |
---|
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. |
The following identifiers have special meanings, and they are considered as reserved words:
abstract | and | as | begin | case |
class | const | constructor | destructor | div |
do | downto | else | end | ensures |
event | except | extern | false | fault |
finally | for | goto | if | implementation |
in | interface | internal | invariant | is |
iterator | lock | loop | method | mod |
namespace | new | nil | not | of |
old | on | operator | or | out |
override | partial | private | property | protected |
public | raise | readonly | record | repeat |
required | sealed | shl | shr | static |
then | to | true | try | until |
using | var | virtual | while | xor |
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.
Freya allows two kinds of comments:
Multiline comments cannot be nested.
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