Program structure

A Sculptor program is written as a standard text file using a text editor or the program designer. The language is line orientated with one statement per line. Therefore the end of a line also marks the end of a statement. All white space at the beginning of a line is ignored; parsing begins at the first non-space character.

The following line types are recognised.

Declarations

All lines starting with an exclamation mark ! are declarations. Declarations are used to give instructions to the compiler and to define the initial states of objects. Valid declarations are listed under General declarations and Report declarations.

Labels

If the first word on a line is terminated by a colon (“:”) the word is a statement label, identifying the line for the purposes of commands such as gosub, goto, and prompt which can divert program control to labelled lines. The word is subject to normal naming rules; that is, it may contain the letters A-Z and a-z, the digits 0-9 and the underscore character only, and may not begin with a digit. A statement label may have the same name as an object in the program.

EXAMPLE

ERR_MSG:
   "Error detected"
   return

Menu items

If a line begins with an asterisk it is a menu item of the ring menu style. Menu items must be in the main program code. They cannot be inside a function. The line is followed by the program statements for that option. This style of menu is compatible with earlier versions of Sculptor but should be considered as obsolescent. The recommended method is to use the menu clause in a window declaration.

Comments

Any text between the two character groups /* and */ is treated as comment. The two characters in each group must be typed exactly as shown, with no spaces between them. The characters are used to mark the beginning and end of comment text, as follows: /* This is a block of text which is present for the purpose of comment only. Such comments can be very useful to future programmers. */

Statements

All other lines are program statements.

If a statement becomes too long to appear on one physical line, it may be extended by terminating each line that is to be continued with the backslash character (“\”). A line may be extended indefinitely in this way. This can greatly enhance readability by spreading a statement with multiple single-line assignment clauses (such as prompt) over several lines such that the clauses resemble blocks. Example:

prompt text = "Select a search index" \
     button = "Name", FIND_NAME \
     button = "Address", FIND_ADD \
     button = "Ref", FIND_REF

White space (created by SPACEBAR and TAB) is treated as a single space character for parsing purposes unless it occurs within quotes. (“”). White space is used to separate words. Where a specific separator such as a comma or semicolon is required, or around operators such as + or =, the use of additional white space greatly improves readability. White space at the beginning of a line is ignored.

Blank lines are ignored by the compiler.

Braces (“{}”) are used to mark the beginning and end of specific blocks of code which relate to the statement preceding the first brace. Typical uses of braces are to enclose the statements of a loop, and to group the clauses of a window, group or button declaration.

It is recommended that blocks of code are logically indented, with statements indented once, and lines within braces indented once more. This makes it much easier to follow the structure of the code. However, this is not a requirement of the compiler.