Friday, March 9, 2012

Getting Started: Hello World

This tutorial will discuss how to write a simple program.

First of all we have to create a new project - File - New - Project.

The project setting dialog will be displayed. Let's fill the form:

  • Type - win32console (it is a console application)
  • Target file name - helloworld (it is a name of the executable file)
  • Debug mode - Enabled (if we would like to have a possibility to debug the code)

The rest can be leaved blank.

Now let's create a program file - File - New -Source File.

And finally let's save all changes - File - Save All.

IDE will ask to include the file into the project.

Our program will be simple:

Program =>
[
 'program'output << "Hello word!!%n".
].

But we still have to tell the compiler which symbol should be used as a program body. To do so we have to provide the forward reference - Project - Forwards.

In open forward dialog we have to type the entry mapping:

'program'action = helloworld'program

And press Add and Save.

Now let's compile the project - Project - Compile.

We could run the program - Debug - Run.

After the program is finished the console window is closed so we do not see actually the program output. So let's add the code to wait until any key is pressed:

Program =>
[
 'program'output << "Hello word!!%n".
 'program'input get.
].

Now let's take a look at our code. 'program'output symbol is a console text writer supporting basic standard types: literal and numeric values. Leading apostrophe indicates that this a forward declaration. The forward symbol should be resolved during the program linkage. This reference is resolved in win32_console project template and is mapped to sys'io'consoleoutput. 'program'input is a console text reader.

No comments:

Post a Comment