The program structure. Preprocessor
A program in the Gentee language can consist of one or several files. The main element of the program is a command. The command starts on a new line, most commands contain blocks enclosed in curly braces { }. It is possible to divide all commands into four groups by their purpose.
Preprocessor commands
The preprocessor is responsible for the substitution of macro values, the replacement of service characters and conditional compilation. The preprocessor performs its operations right during the compilation of the current fragment of the source code.
The define command | The definition of macros. |
The ifdef command | Conditional compilation. |
Executable code commands
These commands contain statements and are responsible for the executable part of the program.
The extern command | Predefined functions, methods and operations. |
func | Function. |
Method declaration: method | Method declaration. |
Redefining operator operations | Operator redefinition. |
Properties | Function-property. |
text | Text function declaration. |
Definitions of types and global variables
The type command | Declaring type. |
The global command | Global variable declaration. |
Other commands
The include command | Including Gentee files. |
The import command | Importing functions from DLL. |
The public and private commands | Name protection commands. |
This is an example of the simplest program.
/* Example */
define
{
NAME = "John"
}
func main<main>
{
print("Hello, \$NAME!")
getch()
}