Examples

"Hello World"


One useful way to get started with a language is to build and run a simple program, before attempting to learn all the details. It often provides an introduction to the flavor of the language and its syntax and can provide a template for developing useful applications. Here is the SPP version of the common "hello world" program. It prints the text "hello world" on the user's terminal.

The text of this program would be placed in a file with the extension ".x" and compiled with the command xc (X Compiler) in the host system or in the IRAF cl as follows:

xc hello.x 
The xc compiler will translate the program into Fortran, call the Fortran compiler to generate the object file (hello.o), and call the loader to link the object file with modules from the IRAF system libraries to produce the executable program. xc may be used to compile C and Fortran programs as well as SPP programs, and in general behaves very much like cc or f77 (note that the -o flag is not required; by default the name of the output module is the base name of the first file name on the command line). The -f flag may be used to inspect the Fortran created by the preprocessor; this is sometimes necessary to interpret error messages from the F77 compiler. Finally, to run the program, you may define it as a task in the cl by using the task statement:

task $hello = hello.e 
Then run it by typing hello.


Generated with CERN WebMaker