A quickstart into occam-pi

So you've downloaded some software

The first thing to realize is that you've just downloaded a programming language. This isn't like diving into a new text editor, or a game, or something else. You're about to experiment with programming in a language that is probably different from any that you are familiar with.

The first thing to do is open up the JEdit environment. It should look something like the picture below.

You'll want to go up to the "Plugins" menu, select occPlug, and then "Start occPlug". This is the key to everything. It will give you a set of controls that look like this:

These buttons have specific purposes made obscure by iconic representation:

  1. This recompiles your program.

  2. This Runs your program.

  3. This chooses your target. It can either be TVM or RCX; for now, please leave it as "TVM".

  4. This chooses what libraries you wish to include. Please leave it as "none" for now.

Does it work?

Now, to test if things are working on your system, copy-paste this code into the IDE:

PROC main (CHAN BYTE kyb?, scr!, err!)
  SEQ
    scr ! 'x'
    scr ! '*c'
    scr ! '*n'
:

Note that indentation matters a great deal. The SEQ should be indented two spaces, and everything else should be indented four spaces.

Save this program somewhere. Call it something remarkable, like "strawberycream.occ", or "mintchocolatechip.occ". Or, if you're boring, "foo.occ" or "test.occ". Please, though, use the ".occ" extension, as our compiler is rather particular, and it will only consume .occ files.

Now, you should be able to push the swooshy symbol (to compile your program) and the little running dude (to execute your program). If all goes well, a single 'x' should be printed in the display area under the controls.

That's it!

Check our the documentation section for links to books and other resources on the programming languages occam and occam-pi. Soon, we will have all of our LEGO documentation up as well... which will be very, very exciting.

Share and enjoy!