Are you new to the occam-pi programming language? This page is for you: it collects resources that are likely to be of use to people who're learning occam-pi.

General resources

Learning the language

Writing programs

The most important bit of advice: before writing any code, draw a process diagram of your program.

Compiling and running programs

Assuming you've installed KRoC on your machine already, you can use the occbuild program to compile occam programs. This works the same way for both the Transterpreter and the native-code version of KRoC.

A very brief summary: assuming you've written myprogram.occ, you can compile it by saying:

occbuild --program myprogram.occ

and then run it by saying:

occbuild --run myprogram

If you want to do something more complicated (e.g. building a program from multiple source files, or building a module), then have a look at the occbuild web page for more details.

Text editors

occam-pi is an indentation-structured language (whitespace is important, like in Python or Haskell). You will need a decent text editor to work with it; here are some suggestions:

Tips for configuring your editor

You will find working with occam much more pleasant if you tell your editor a bit about the language first.

Educational occam-pi programs

The KRoC distribution includes lots of example occam-pi programs -- have a look in the demos directory, or in the various modules/whatever/examples directories. However, the programs in KRoC have been written by many people over a period of about 25 years, so the style and conventions tend to vary quite a bit...

For examples of "modern" occam-pi code, we'd suggest that you look at these directories:

Common problems

Need some information on how to use Subversion to check out and work with code? Have a look at the svnbook.

Downloaded an occam program from somewhere, unpacked it, and now you're staring at a configure.ac file wondering how to use it to compile the program? See Using Automake.

If you're trying to run a program that uses the pony or trap networking systems, you will probably need to start the corresponding nameserver program (ponyanstcpip or trapns) first, so your cluster nodes can find each other. You may also need to create a config file to help your program find the nameserver.

Compiled your program, and now it's complaining that it can't find libfoo.so when that file is clearly in the current directory? The quick fix is to tell the OS to look in the current directory for shared libraries: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.. (If you're on MacOS X, use DYLD_LIBRARY_PATH instead.)