The COCOA project

Cocoa - how to run

You must define the environment variables to point to the location of the directory containing JDK, Cocoa, and Jasmin. Add the following to your .profile (or .cshrc) file:
COCOADIR=/home/coen175/cocoa
JASMINDIR=/home/coen175/jasmin
JAVADIR=/opt/java
CLASSPATH=.:$JAVADIR/lib/classes.zip:$COCOADIR/lib:$JASMINDIR/classes
PATH=.:$COCOADIR/bin:$JASMINDIR/bin:$PATH
export COCOADIR JASMINDIR JAVADIR CLASSPATH


Compile Cocoa programs (using the A+ compiler) into a similar collection of Jasmin files:
cocoa foo.java bar.java myexterns.cocoa $COCOADIR/extern/*.cocoa
Note that oridinary class files should be given the extension .java so that they can also be compiled with Java compilers. By convention we use .cocoa extensions for all classes containing external Cocoa class definitons. You may include your own (myexterns.cocoa) and/or all of the predefined ones (COCOADIR/extern/*.cocoa).
Convert the Jasmin file foo.j into the class file foo.class:
jasmin foo.j
Compile Cocoa/Java programs into a similar collection of class files using JDK:
javac foo.java bar.java
Note that all files must end with .java.
Verify the class file foo.class:
javap -verify foo
Note that you must NOT give an extension.
Execute the class file foo.class:
java foo
Disassemble the class file foo.class into the Jasmin file foo.j:
dejava foo
A script for the A+ compiler to automatically include the COCOA extern classes, assemble the Jasmin files, and verify the generated class files:
ccocoac foo.java bar.java

You should also set up a mirror directory structure for YOUR VERSION of cocoa. You might want to give your executable a different name (like mycocoa) so you can tell when you're running YOUR executable versus the one in the course account (the A+ binary). So you might need another environment variable, etc. You will be changing the code in the src directory, recompiling (using the makefile) and creating a new binary. Don't forget to copy the binary into the bin directory.

jasmin directory

This contains the jasmin assembler. You should peruse this directory in conjuntion with the jasmin online page to look at the assembler code. You will be invoking the jasmin assembler on the code your compiler produces (.j files)! This directory contains:
  • classes - jasmin .class files
  • doc - documentation
  • examples - example .j files (jasmin input files)
  • lib - jasmin libraries
  • src - source code to the jasmin assembler (yup, its a compiler).

COEN175 Home Page Linda Seiter
This page is located at http://www.cse.scu.edu/~lseiter/coen175/cocoa/howtorun.html