A Guide to the S-Lang Language: Identifiers

Next Previous Contents

## 5. Identifiers

The names given to variables, functions, and data types are called identifiers. There are some restrictions upon the actual characters that make up an identifier. An identifier name must start with a letter (`[A-Za-z]`), an underscore character, or a dollar sign. The rest of the characters in the name can be any combination of letters, digits, dollar signs, or underscore characters. However, all identifiers whose name begins with two underscore characters are reserved for internal use by the interpreter and declarations of objects with such names should be avoided.

Examples of valid identifiers include:

> `

>           mary    _3    _this_is_ok
>           a7e1    $44   _44$_Three

> `

However, the following are not legal:

> `

>           7abc   2e0    #xx

> `

In fact, `2e0` actually specifies the real number `2.0`.

Although the maximum length of identifiers is unspecified by the language, the length should be kept below `64` characters.

The following identifiers are reserved by the language for use as keywords:

> `

>             !if            _for        do         mod       sign       xor
>             ERROR_BLOCK    abs         do_while   mul2      sqr        public
>             EXIT_BLOCK     and         else       not       static     private
>             USER_BLOCK0    andelse     exch       or        struct
>             USER_BLOCK1    break       for        orelse    switch
>             USER_BLOCK2    case        foreach    pop       typedef
>             USER_BLOCK3    chs         forever    return    using
>             USER_BLOCK4    continue    if         shl       variable
>             __tmp          define      loop       shr       while

> `

Next Previous Contents