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 undeclared


Question 28 (2003):

The compiler doesn't seem to like the following code:

    [modified code]

    PROC layout.max.chans (...)
        [max.chans]INT n:
        ...  SEQ process that reads values in PAR then writes them out
        PRI ALT
          int x:
            ...  guard and process

With an error of the form:

    layout.max.chans(...) -- layout.max.chans is not declared

Answer 28:

This isn't the real error. `layout.max.chans' isn't considered declared because the compiler couldn't parse/compile it. I see what you're trying to do, but this isn't necessarily the best place to do it.

If you really want to modify `layout.max.chans', the errors are incorrect indentation at the `PRI ALT' and `int x:' isn't a valid declaration. The first error is likely a missing `SEQ', or mis-placement of the `PRI ALT'. See Question 1 (2000) for more details on this. The second is easy -- `int' should be `INT', and the guard should be indented at the same level as the declaration, with the guarded process indented under that.

Keywords: undeclared , incorrect-indentation


Question 24 (2002):

Is there a specific way in which the PROC's of a .occ file are compiled? I moved a PROC from the bottom of my file to a place that looked neater to me and the compiler had a small barny at me! Does the compiler follow a set pattern? Thanks

Answer 24:

The order in which things are declared in occam does matter. Only once something has been declared can you use it. So, unlike Java, you can only invoke/instantiate/call (whatever you like to call it) PROC's that are in scope - i.e. after their declaration.

Also, the kroc compiler assumes that the last outermost level PROC is the one from which execution starts ... and that that PROC has just the three standard channels for keyboard input, screen and error output. Again, this differs from Java - which looks for a public method called main, with a special parameter signature, but which can occur anywhere in the listing of the class code.

Keywords: compiling , undeclared

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:34 2013
This document is maintained by Fred Barnes, to whom any comments and corrections should be addressed.