This manual describes the CCL language and associated tools. To get started with CCL, make sure that you have CCL built and installed and that the CCL_ROOT and LD_LIBRARY_PATH environment variables are set correctly (see the CCL web page for details).
Here is how to say ``hello world'' in CCL. First make your own directory for your examples:
mkdir code cd codeIn your new directory, create a file called hello.ccl with the following text in it:
include standard.ccl program main() := { str := "Hello world!"; true : { print ( str, "\n" ), exit() }; };Run this program by executing
ccli hello.cclon the command line. Note that ccli is the name of the CCL interpreter. The result of executing the above should be that ``Hello world!'' is printed and then the program exits. If you get this to work, you have CCL properly installed on your system.
Here's how hello.ccl works. The first line includes some standard function definitions. In particular, we need the print function and the exit function. The rest of the file declares a program, called main. The CCL interpreter expects that a program called main will be defined. If it finds one, it will execute it. If it does not, it will just quit. Within this particular main program, there is one variable initializer (for the variable str) and one guarded command. The initializer just sets the variable str to the string ``Hello world!''. The guarded command has a guard (true in this case) and a set of commands. The commands print the value of str and then exit. The CCL interpreter starts executes programs by first initializing variables and then executing the guarded commands over and over again. This guarded command exits the first time it is executed. Otherwise, it would print ``Hello world!'' repeatedly until the interpreter is killed (with Cntl-C) (try removing the exit line to see this behavior).
Note: Another way to evaulate expressions with ccli is to put them on a line by themselves outside of a program definition. Thus, the above could have been written:
include standard.ccl str := "Hello world!"; print ( str, "\n" ),and essentially the same output would be produced.