跳转到内容

Compiler 2015: Phase 2: Testing environment specification - midterm

来自ACM Class Wiki

How a submission is judged in this phase

  1. Boot a virtual machine in vbox of Ubuntu 14.04 with openjdk 1.8.0_45
  2. git clone one's compiler2015
  3. (IMPORTANT)git checkout midterm, the version with the 'midterm' tag is literally the most important one. Do push tags!
  4. To judge this submission (e.g. abc/compiler2015/)
    1. Kill all irrelevant processes
    2. Setup a new bash process
    3. Reset environment variables
    4. cd abc/compiler2015/
    5. make clean # delete the bin dir
    6. make all # compile your code, please put your executables in a bin directory. A makefile is required!
    7. source midtermvars.sh # setup environment variables for mid-term testing. Define $CCHK in this script.
    8. cd bin
    9. For each test case, copy the test case to abc/compiler2015/bin/data.c
      1. $CCHK < data.c
      2. Check $? (the exit status); 0 for OK, 1 for error
      3. Don't output too much debug information to standard output in your submission. Please only return 0 or 1.

Notes

You need a Makefile for this mid-term testing. If you don't know how to write a Makefile, read http://mrbook.org/tutorials/make/

Note that you also need a Makefile even if you want to compile Java using ant or maven.

For each test case, your compiler is required to exit normally. Write operations to the file system are prohibited.

You can setup environment variables as follows, according to your Makefile:

export CCHK=java -cp .:classes/ cc.midterm.Main

or

export CCHK=java -jar midterm.jar

or

export CCHK=./c_compiler

In Java, use System.exit(...) to specify the exit status. In C, use exit(...) to specify the exit status.


Standard-library Functions

printf
malloc
getchar