Introduction
Although it is designed to be extended, Glich is perfectly usable in its base form. A particular feature is its ability to perform integer set operations and to handle infinite integer ranges.
Hello World
A script consists of one or more statements. As is usual in these circumstances, we present a hello world script.
Hello Script |
---|
// Hello world script. write "Hello world!" nl; |

Using a text editor, copy the script and save as "hello.glcs". '.glcs' is the standard extension for Glich scripts. Run the Glich Script by starting the Glich interactive program glcs.exe and run the script with the command 'run hello.glcs' This should then result in the output shown.
Scripts always use the UTF-8 character set.
Comments and White Space
// A single line comment /* This is a multi-line comment. */ |
The first line is a single line comment. Every thing from the "//" token to the end of the line taken to be a comment.
Multi-line comments are included by placing them between the "/*" and "*/" tokens. Multi-line comments cannot be nested.
Tabs, spaces, newlines and comments can appear anywhere within a script without its meaning being affecting. They are required only when necessary to separate tokens.
Tokens
The tokens that make up the script can be categorised into three groups, operators, literals and names.
Operators are used to construct expressions. Mostly they are non-alphanumeric characters but they also include some text words. A complete list is given in the Operator List table. Where words are used, they are reserved and cannot be used as names.
Literals can be numbers, text strings or collections of these values as objects. Numbers consist of the numeric characters '0-9' and optionally a type character. At this time, two types of integer numbers and a floating point number can be used, Numbers, Fields and Floats. Text strings are placed between '"' double quote characters. If you need to include a double quote in the text, use two together, as in "Say ""Hello""".
Names are constructed from alphanumeric, '_' underline and ':' colon characters. They can not start with a numeric character. The meaning of a name is dependant on the context and the same name can be used for different purposes in a script. Names are used as statements, sub-statements, statements arguments and variables.
Entities and Codes
A code name is the term used to describe the name given to created entities such as files, functions, commands and objects. It is always a text string but it need not be in quotes if it conforms with the name standard.
A code name can use any character except white space and the '#' hash character. The ':' colon character may be restricted for some objects as well, as these may be used to combine codes into signatures. (More characters may be added to the excluded list in the future.) If the code conforms to the script name token definition it can be written directly, otherwise it must be written as a literal (i.e. in double quotes). If an expression is used to form a code, it must be placed in parenthesis.