码迷,mamicode.com
首页 > 其他好文 > 详细

Coursera compiler Set up environment and Run first program

时间:2014-05-29 15:09:43      阅读:578      评论:0      收藏:0      [点我收藏+]

标签:c   class   code   tar   http   a   

Environment, Ubuntu 14.04

set up guide

 

Set up cool compiler

1. sudo apt-get install flex bison build-essential csh openjdk-6-jdk libxaw7-dev libc6-i386

2. Make the /usr/class directory

sudo mkdir /usr/class

3. Make the directory owned by you

sudo chown $USER /usr/class

4. Go to /usr/class and download the tarball

cd /usr/class

wget http://spark-university.s3.amazonaws.com/stanford-compilers/vm/student-dist.tar.gz

5. Untar

tar -xf student-dist.tar.gz

6. If you want things exactly like the VMs:

  Add a symlink to your home directory

  ln -s /usr/class/cs143/cool ~/cool

7. Add the bin directory to your $PATH environment variable. If you are using bash, add to your .profile (or .bash_profile, .bashrc etc. depending on your configuration; note that in Ubuntu have to log out and back in for this to take effect):

vim ~/.bashrc and append

PATH=/usr/class/cs143/cool/bin:$PATH

8. you may also need to do this

sudo apt-get install xfonts-75dpi xfonts-100dpi
xset +fp /usr/share/fonts/X11/75dpi

 

Run first program

$ mkdir examples
$ cd examples
$ cp /usr/class/cs143/examples/hello_world.cl .
$ coolc hello_world.cl
$ spim hello_world.s
SPIM Version 6.5 of January 4, 2003
Copyright 1990-2003 by James R. Larus (larus@cs.wisc.edu).
All Rights Reserved.
See the file README for a full copyright notice.
Loaded: /usr/class/cs143/cool/lib/trap.handler
Hello, World.
COOL program successfully executed
Stats -- #instructions : 152
         #reads : 27  #writes 22  #branches 28  #other 75

Coursera compiler Set up environment and Run first program,布布扣,bubuko.com

Coursera compiler Set up environment and Run first program

标签:c   class   code   tar   http   a   

原文地址:http://www.cnblogs.com/zhouzhuo/p/3758519.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!