XML

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 compiling

2012

Question 45 (2012):

Submission reference: IN2225

I got the occam compiler (Windows, Transterpreter\bin\occ21.exe) to crash, without any error output. The code, after relentlessly pruning out lines that didn't cause it to crash, is:

    DATA TYPE STRUCT
      RECORD
        BYTE x:
    :

    PROC yum (VAL BYTE a)
      SKIP
    :

    PROC black.magic (STRUCT record)
      VAL INT k IS 0:
      yum (record[x] + k)
    :

    PROC pure.evil ()
      [1]STRUCT records:
      SEQ i=0 FOR 1
        records[0] := 0
    :

Switching the order of the last two procs, changing the replicated SEQ into a normal SEQ, changing the records array into a single record, or using a literal 0 instead of k will avoid the crash. Of course, fixing the syntax error will also prevent the crash.

Not a question, perhaps a better one would be 'where do I submit this?'

Answer 45:

Although the compiler dies horribly, it does output an error. A feature of the Transterpreter is that you don't always get to see the error output before the crash happens — effect of buffered outputs. The specific error is a type error though; in this case there are two, the second of which was blowing up the compiler (basically it was deferencing a null-pointer when trying to find the name of the parameter involved, which of course didn't exist in this context).

This now produces some more sensible errors:

    Warning-occ21-bug1.occ(7)- parameter a is not used

        ::
        :
        :PROC black.magic (STRUCT record)
        :  VAL INT k IS 0:
      13:  yum (record[x] + k)
        ::
        :
        :PROC pure.evil ()
        :  [1]STRUCT records:
    Error-occ21-bug1.occ(13)- operands have different types for operator "+"

        :
        :PROC pure.evil ()
        :  [1]STRUCT records:
        :  SEQ i=0 FOR 1
      19:    records[0] := 0
        ::
        :
        :
    Error-occ21-bug1.occ(19)- type mismatch

For future reference, the place to send error reports (and general compiler bugs) is kroc-bugs@kent.ac.uk; this is fairly well documented in the KRoC release, but less so in the Transterpreter (at least as you see it — googling for "occam compiler bug reporting" produces the relevant address!). Thanks for spotting this bug in any case (which I've now fixed).

Keywords: compiling

2009

Question 54 (2009):

Submission reference: IN1852

What is this error meant to mean (or is it a buggy error)?

  Error-occ21-q7.occ(232)- expected "?", "??", "!" or ":=", found ":="

Answer 54:

Please send me (phw) the code that produces this!   Thanks.

Keywords: compiling

2004

Question 77 (2004):

Is it not possible to run q6.occ before making any changes to it ? I've just tried and it says permission denied.

Answer 77:

That's because you need to compile "q6.occ" first. Occam sources, like sources for most other programming languages, are not directly executable.

Keywords: compiling

2003

Question 51 (2003):

referring to Question 49 (2003)

I have checked this and they all seem to be their for all the procs.

Answer 51:

In that case, I'd suggest mailing your seminar leader with the code.

One other, remote, possibility is that you're (accidently) trying to compile a non-occam source file.

Keywords: compiling


Question 49 (2003):

For q6 i have just tried compiling my code and the compiler says

    no PROC or FUNCTION declared in sc module
    Incomplete program - no entry point

Whats all this about?

I have checked that their is a main function (i.e. q6 PROC has not been touched) i have only added a PROC and not done anything else.

Answer 49:

The most likely reason for this error is a missing colon `:' at the end of a PROC definition. PROC definitions should have the form:

    PROC name (formal parameters)
      ...  body
    :

Keywords: q6 , compiling

Referrers: Question 51 (2003)


Question 14 (2003):

I've just followed the instructions for setting up Vim (v6.2) at home. As far as I know, I have done everything properly yet when I try compiling an occam file I get this error message:

    'kroc' is not recognized as an internal or external command, operable program or batch file

Do you know what the problem could be??

Thanks

(ps... I'm using MS Windoze XP if that helps)

Answer 14:

The KRoC occam system isn't available for windows. The kroc command (which you're seeing an error about), is the bit that compiles and links occam programs. We've tried a couple of times to make a version of KRoC for win32 (cygwin in particular), but there are still some outstanding problems. Added to which, UNIX is a much more suitable environment for programming.

You'll either have to use the KRoC installed on raptor, or find a Linux machine at home and install KRoC/Linux. To compile occam programs from a command-line on raptor, simply type:

    kroc file.occ

(replacing `file.occ' with the occam source file you want to compile). On KRoC/Linux, you need to explicitly add ``-lcourse'' if your occam program `#USE's' course.lib.:

    kroc file.occ -lcourse

It should even be possible (in theory) to create a setup where vim uploads the file to raptor, compiles it, then sends back the results. This would probably be tricky, however -- you'd need to get friendly with vim scripting and ssh/scp.

Keywords: vim , compiling , windows

2002

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


Question 13 (2002):

This is the error i keep getting and I don't understand why, max.chans is still set at 3, can you help, I can't seem to get passed this to get on with the rest!?

  raptor$ kroc q4.occ

      :    delta(a,b,e)
      :    integrate(b,c)
      :    delta(c,d,f)
      :    pairs(d,g)
   315:    layout.max.chans(e,f,g,screen)
      :
      ::
      :
      :
  Error-oc-q4.occ(315)- Too many actual parameters in call of layout.max.chans

Answer 13:

You have too many parameters! layout.max.chans takes just two parameters - an array of input channels and an output channel. You are supplying four parameters, :-(.

Your channels e, f and g should be elements of an array - e.g. c[0], c[1] and c[2]. Then, your instantiation would be:

           layout.max.chans (c, screen)

An alternative solution is to keep your channels, e, f and g, as they were and construct the array required by layout.max.chans on-the-fly:

           layout.max.chans ([e, f, g], screen)

Keywords: q4 , compiling

2001

Question 5 (2001):

I get the following error when I am trying to compile q2.occ:

  raptor$ kroc q2.occ
  Warning-oc-q2.occ(97)- Parameter error is not used
  Warning-oc-q2.occ(97)- Parameter keyboard is not used
  KROC octran Version 1.0 for sparc-sun-solaris2.5.1
  /usr/local/bin/kroc: as: not found
  kroc: as failed to assemble q2.s to q2.o

I don't understand where the mistake is. Any ideas?

Answer 5:

First, forget about the two Warning messages. These are not compiler Error messages - just warnings. You get them because your PROC q2 declares two parameters (keyboard and error) which it then doesn't use. However, declaration of the three parameters (the keyboard, screen and error channels) is compulsory for the top-level process (i.e. the process you run from the Unix command prompt).

Serious, though, are the messages:

  /usr/local/bin/kroc: as: not found
  kroc: as failed to assemble q2.s to q2.o

This means that Unix couldn't find the as program (which is the standard assembler that generates object code). This is either because of a temorary glitch on raptor or you have changed your path environment variable! By default, the latter is set up automatically for you by /etc/profile and, so, should always be there. If you have redefined path, it must include:

  `/usr/local/bin/localpath -sh`

which pulls in all the standard programs. To get as otherwise, you must include (for raptor) /usr/ccs/bin in your path.

If you have changed your path environment variable, you will understand the above and how to make it right again. If not and your problem persists, mail me directly!

Keywords: compiling

2000

Question 43 (2000):

What's the problem here?

  PROC invert (CHAN OF INT a, c, CHAN OF BYTE b)
    INT factor:
    SEQ
      ...  stuff
      c ! (a * factor)      -- compiler gives error here
      ...  more stuff
  :

The error message is:

  Operands have different types for operator "*".

As far as I can see they are not different types. Any ideas?

Answer 43:

But they are different types. Your a is a channel (that happens to carry integers) and your factor is a variable (that happens to hold integers). Multiplication operates over numeric data (such as may be held in variables). Multiplication is not defined on channels - you can only input/output from/to them! You probably need to input an integer from channel a into another variable first.

Keywords: compiling , type-mismatch


Question 9 (2000):

When I compile some occam and the compiler generates loads of error messages, they flash past too fast for me to read?

Answer 9:

The simplest solution is to get a scroll bar on your window. For a normal eXceed window, make sure you have focus (i.e. when you type, you type into the window) and just do [CTL & LEFT-MOUSE-CLICK]. A scroll bar should appear. To operate it, point and drag with the MIDDLE mouse button.

Now, when all those error messages flash by, you can scroll them back and have a chance to look at them!

Tip: only bother with the first one or two messages. Fix them and re-compile. Often, the later ones were not reporting real errors - it's just that the compiler was thrown too badly by your initial mistake(s).

Keywords: compiling

Referrers: Question 13 (2000)

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