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
2003 |
The compiler doesn't seem to like the following code:
[modified code] PROC layout.max.chans (...) WHILE TRUE [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
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
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
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
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. |