跳转到内容

Compiler 2013: Mid-term specification

来自ACM Class Wiki

Testing Process

  1. Boot an up-to-date Ubuntu Server 12.04 system in VirtualBox
  2. svn checkout everyone's repository
  3. For each repository (e.g. xjia/compiler2013/)
    1. Kill all irrelevant processes
    2. Setup a new bash process
    3. Reset environment variables
    4. cd xjia/compiler2013/
    5. make # compile your code
    6. source midtermvars.sh # setup environment variables for mid-term testing
    7. For each test case (e.g. input.c)
      1. $CCHK input.c
      2. Check $? (the exit status); 0 for OK, 1 for error

Limits

For each test case, your compiler is required to exit within 5 seconds, consuming less than 64MB memory. Write operations to the file system are prohibited. But you are allowed to write to the standard output (stdout or System.out) and the standard error (stderr or System.err) stream.

Notes

You can setup environment variables like this:

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.

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.

Standard-library Functions

scanf
printf
malloc