1.03 Language Overview


The core of the LynPlex Language is a set of commands that control the program flow and data. This core makes up the minimum that is needed to create and run simple scripts.

Extensions to the basic language are provided by components in the form of built-in procedures and built-in functions. They are included as part of the interpreter but logically they are separate and may be replaced by user provided code. These are normally used to support components that are external to the language rather than the language structure.

The essential difference between the basic commands and components is that built-in procedures and functions in components may be overidden by user-defined or external procedures.

New components may be added by means of user defined or external procedures and functions. These may be defined within a script or they may be defined outside and included or imported as necessary.

Procedures and Functions

The basic language is extended by the use of procedures and functions. They are part of an additional component.

Procedures are effectively additional commands, whereas functions always return a value.

Functions may be built-in or user defined. It is also possible to define your own version of a built-in procedure or function. For more information see 1.07 Procedures, Functions and Subroutines.


All words other than numeric values are referred to as symbols. The naming rules are the same whether the symbol is a command, a function or a variable.

Although there are built-in commands and functions, there are no reserved words. Any name, even a LynPlex keyword may be used for a user defined command, function or variable, although there may be places where a particular name may cause problems. Using THEN as a variable name in an IF statement is a good example.

The interpreter will make an attempt to determine if a name is a variable or function. There is not normally a problem where the syntax makes it clear what is required.

Problems usually occur within expressions where variables and functions can be mixed and a variable and function have the same name. In this case the interpreter will make a best guess depending on the syntax using the following rules:

  • If the symbol is prefixed with the escape character (`) or the reference indicator {@) it is a variable.
  • If the symbol is suffixed with parentheses it is a function.

Symbol names

Symbol names in the English Language version of LynPlex can use any alphanumeric characters (ASCII codes 32-127) and the symbol '_'. Other language implementations may extend the range of acceptable characters.

valid name:    abc, a_c, _bc, ab2c, abc
invalid names: 1cd, a$b, $abc

Case is ignored when evaluating symbols. For example, the command IF can be specified as if, IF, If or even iF. All these variations are treated exactly the same. Internally the uppercase representation of the symbol is used.


Labels are used by various commands. A label must be the first entry on a line. It must be a valid symbol followed by a colon (:).


Constants and Variables

All user variables (including arrays) have an undefined data type. Not only can they be numeric or string, but the type can change during processing depending on the way that the variable is used. The data type is effectively invisible to the program.

There is no support for user defined data types (although this may change in a later version).

Arrays are dynamic and have only one dimension. Any element of an array, however, can itself be an array. This can be repeated for as many levels are wanted, although obviously there are physical and practical limits to the size.

It is possible to define the size of an array using the RANGE statement. In this case an array can be used as a matrix. It is also possible to convert a simple variable into an array. See 5.02 Arrays for more information

Conceptually there are five data types used internally. They are:

  • Integer (32bit)
  • Real (64bit)
  • String (<32KB on 16bit / 2GB on 32bit)
  • Array (~2970 elements on 16bit / ~50M elements on 32bit)
  • Pointer
  • A file information block.

Conversions between those types are performed internally. If the user requires the data to be in a particular form there are functions available to perform the conversion.

User defined constants

Constant 'values' can be declared by using the keyword CONST

CONST my_pi = 3.142

The system defined constants can also be changed using this command.


Comments can be identified in one of two ways.

Any line or part of a line that starts with '//' is regarded as a comment. All text up to the end of the line is ignored. The program continues with the next line.

Stream comments may be inserted anywhere in the program. They start with the characters '/*' and end with the characters '*/'. They may continue over multiple lines. All text between the beginning and end markers is ignored.

Comments may be nested. Comment markers may therefore be wrapped around text that already contains comments. The comment will only finish when a matching end marker is found.


Within expressions, strings and variables may be concatenated or joined to produce a single string.

If the items are separated by one or more spaces they will be joined by a single space.

To join items without an intervening space use the colon (:) between the values.

The plus sign (+) may also be used to join strings, but if this is between two numeric values it may well be taken as an arithmetic operator instead. It is always safer to use the colon.

If the minus sign (-) appears between two values, and one is non-numeric, they will also be concatenated. In this case the sign is kept and inserted between the values.


Statements may be continued by breaking a line immediately after some special characters.

  • A line may be broken following a comma. The comma is included as part of the statement.
  • An expression containing a formula may be broken following an arithmetic symbol. The symbols that may be used are plus, minus, multiply and the three divide symbols (+-*/\%).
  • An expression will continue after the shift left and right symbols (>>, <<).
  • An expression will continue after the logical and binary 'or' and 'and' symbols (|&). This applies to both both single and double uses.
  • An expression will continue after the concatenation symbol (:).
  • An assignment will continue after the equals sign (=).

All the above characters will be included in the evaluation of the statement.

If all else fails and you still need to continue a line you can use two or more dots (..). This will force continuation. This mark will be ignored in the evaluation of the statement.

lynplex/lp0103.txt · Last modified: 2013/02/22 16:35 (external edit)