kent logo

CO538 Anonymous Questions and Answers Keyword Index

This page provides a keyword index to questions and answers. Clicking on a keyword will take you to a page containing all questions and answers for that keyword, grouped by year.

To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.

Keyword reference for main


Question 65 (2007):

Submission reference: IN1451

hi, I am using Transterpreter for Windows Jva based IDE version 1.4.

I am trying to compile simple code taken from Peter Welch Slides one example is:

  PROC numbers (CHAN INT out!)
    INT n:
      n := 0
	  out ! n
	  n := n + 1

after compilation it gives warning:

  Compiling: Test5.occ
  Not enough parameters in top level.
	  Expected 3 parameters, ("CHAN BYTE" "CHAN BYTE" "CHAN BYTE")
	  Given: 1, ("CHAN INT")

  skroc: Couldn't slink one or more files.
  skroc exited with error code: 1

Why it is asking for three parameters. Please help.

Do the occam programs have some starting and ending methods like in Java and C:

  public static void main(){}
  void main (void){}

Answer 65:

We did not tell you about separate compilation of individual processes in this module. We only told you how to compile main occam-pi programs.

In the first terminal class of the module, we showed you lots of main occam-pi programs (from your examples folder, also on raptor, in \courses\co631\examples\). The structure of main programs is explained in the README.txt file in that folder.

An occam-pi main program consists of a sequence of declarations (e.g. VAL constants, PROTOCOLs, TYPEs, PROCs etc.). The last declaration must be a PROC with the header:

  PROC foo (CHAN BYTE keyboard?, screen!, error!)

It is this last PROC, known as the top level process, that the system runs from the compiled code (and corresponds to the Java and C main). The PROC and channel parameter names are the programmer's choice – but the header structure must be as above.

It looks like you were trying to compile a file containing only the PROC numbers quoted in your question. That is not a main program and will not compile, with the compiler complaining about the lack of a top level PROC with the three mandated channel parameters.

Every exercise, example and assessment program in the module had this structure.

Keywords: main

Valid CSS!

Valid XHTML 1.0!

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Last modified Mon May 20 13:50:28 2013
This document is maintained by Fred Barnes, to whom any comments and corrections should be addressed.