Difference: CS255Spring09ProjectRubyTrack (1 vs. 2)

Revision 22009-02-12 - ChenDing

Line: 1 to 1
 
META TOPICPARENT name="CS255Spring09"

Project for CSC 255/455, Ruby Track (using URCC), Spring 2009

Introduction

Deleted:
<
<
Finally, we are glad to announce that our URCC code is ready for Project Part 2. As Chen said in the class, you have a week for this assignment from our release, which means the deadline for Part 2 is Feb.18. You can argue for more time by sending both Instructor and TA an email.
URCC is an experimental C compiler written in Ruby. It takes a C file as input, calls GCC to generate a gimple raw format file, parse the gimple file into rawEntries, construct from rawEntries to Ast intermediate language, transform back into C file format, and then call GCC to compile the new C file into executable. Optimizations can be done on the Ast intermediate representation level.
 
Added:
>
>
We are glad to announce that our URCC code is ready for Project Part 2 as of Feb. 11. As Chen said in the class, you have a week for this assignment. Counting from Feb. 12, the deadline for Part 2 is set for Feb. 18. You may request further extensions by sending both Instructor and TA an email with reasons for the request.

URCC is an experimental C compiler written in Ruby. It provides the font-end and back-end for the compiler project. The front-end takes a C file as input, calls GCC (version 4.2.x) to generate a gimple raw format file, parses the gimple file into rawEntries, and converts rawEntries to the intermediate language. (Ast/Decl modules). The back-end transforms the URCC intermediate form back into a C program and calls GCC to compile the new C file into executable. Optimization is done on the URCC intermediate representation, between the front-end and the back-end.

See RochesterCCompiler for the class hierarchy of the URCC intermediate form, i.e. the Ast/Decl modules, and instructions for generating class/method documentation in html using rdoc.

 

Check out, Installation and Run

  • Check out the code from file:///p/compiler/repos/urcc by using subversion. Undergrads can get a copy from /home/hoover/u1/cs255/urcc.tar.bz2, which is from version 26. Our URCC is still under development, more bug fixings and improvements are expected in the future. We will send out notices when we have major updates. Then svn update can always get the latest version, and also we will update the corresponding copy in cs255 account.
Changed:
<
<
  • Our top directory has a How_To_Install file to provide instructions for installation. Basically, in order to use urcc from anywhere, just as how you use gcc, you need to add the bin directory into your environment variable PATH, and add the ast directory into your RUBYLIB. For instance, you have the top directory, urcc, under your home directory, and you are using C Shell. Then you need to add the following lines into your .cshrc file
>
>
  • Our top directory has a How_To_Install file to provide instructions for installation. Basically, in order to use urcc from directories other than urcc, you need to add the bin directory into your environment variable PATH, and add the ast directory into your RUBYLIB, which the Ruby interpreter uses to search for needed modules. For instance, you have the top directory, urcc, under your home directory, and you are using C Shell. Add the following lines into your .cshrc file
 
       setenv PATH "$PATH":"$HOME/urcc/bin"
       setenv RUBYLIB "$HOME/urcc/ast"
Changed:
<
<
  • If you are working on undergrad network, you need to change ast/driver.rb file to specify your own GCC 4.2.2 directory (what you built in Project Part 1), since the default GCC 4.1.2 does not well. Somehow, the default GCC on grad network works fine. Search ast/driver.rb for gcc and replace them (of course not the one in the comment) with the position of your own GCC. For those who have a different system, we suggest to use the GCC you built in last assignment.
>
>
  • If you are working on the undergrad network, you need to change ast/driver.rb file to specify your own GCC 4.2.2 directory (what you built in Project Part 1), since the default GCC 4.1.2 does not well. (The default GCC on grad network works fine.) In ast/driver.rb, replace the gcc invocation to use a copy of GCC 4.2.x. We suggest you use the GCC you built in the last assignment.
 
  • To Run URCC, just type urcc following with your file name, e.g. urcc ab.c. By default, it will generate a ab.c.*.gimple file, the c file generated by urcc ab_urcc.c, and the binary file ab.

Where to Start

  • Take some time to read the documentation for Ast.
  • Your optimizations need to be called after we generate the Ast IR for the whole program. Invoke your optimizations in driver.rb after prog = raw2ast.Construct_Ast(parser.funcList), and before we generate the C file.
Added:
>
>
 

Debugging

Changed:
<
<
  • Most time, I explicitly insert p or print to print the values I care (Bin Bao). If you have better idea or reference to any Ruby debugger, please let me know.
  • If you find any bug in our code, please shoot us with email attaching your test case. If you can also provide a fixing, that will be great.
>
>
  • You can use "ruby -rdebug" to run the interpreter in debugging mode. See this section of the Thomas-Hunt book. There are gdb like commands to set breakpoints.
  • Most convenient is to use the interactive Ruby shell, irb, and insert p or print to print the values you care. If you have more systematic solutions to debugging, please share.

Reporting problems

  • If you find any bug in our code, please post to the class discussion page CS255Spring09Discussions with a description and your test case. Even better if you can post fixes.
 
  • Known Problems
    • Insert Ast::Const nodes with the same numeric value will cause problem. Thus we have slightly changed the loop.c for Project Part 2. We will provide a solution soon.
    • If the end of the string is "\n", sometimes we will lose it during the transformation. This might cause problem for scanf. E.g. run ab we generated from ab.c will require any extra input after providing two numbers. Under fixing.

Revision 12009-02-12 - BinBao

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="CS255Spring09"

Project for CSC 255/455, Ruby Track (using URCC), Spring 2009

Introduction

Finally, we are glad to announce that our URCC code is ready for Project Part 2. As Chen said in the class, you have a week for this assignment from our release, which means the deadline for Part 2 is Feb.18. You can argue for more time by sending both Instructor and TA an email.
URCC is an experimental C compiler written in Ruby. It takes a C file as input, calls GCC to generate a gimple raw format file, parse the gimple file into rawEntries, construct from rawEntries to Ast intermediate language, transform back into C file format, and then call GCC to compile the new C file into executable. Optimizations can be done on the Ast intermediate representation level.

Check out, Installation and Run

  • Check out the code from file:///p/compiler/repos/urcc by using subversion. Undergrads can get a copy from /home/hoover/u1/cs255/urcc.tar.bz2, which is from version 26. Our URCC is still under development, more bug fixings and improvements are expected in the future. We will send out notices when we have major updates. Then svn update can always get the latest version, and also we will update the corresponding copy in cs255 account.
  • Our top directory has a How_To_Install file to provide instructions for installation. Basically, in order to use urcc from anywhere, just as how you use gcc, you need to add the bin directory into your environment variable PATH, and add the ast directory into your RUBYLIB. For instance, you have the top directory, urcc, under your home directory, and you are using C Shell. Then you need to add the following lines into your .cshrc file
       setenv PATH "$PATH":"$HOME/urcc/bin"
       setenv RUBYLIB "$HOME/urcc/ast"
  • If you are working on undergrad network, you need to change ast/driver.rb file to specify your own GCC 4.2.2 directory (what you built in Project Part 1), since the default GCC 4.1.2 does not well. Somehow, the default GCC on grad network works fine. Search ast/driver.rb for gcc and replace them (of course not the one in the comment) with the position of your own GCC. For those who have a different system, we suggest to use the GCC you built in last assignment.
  • To Run URCC, just type urcc following with your file name, e.g. urcc ab.c. By default, it will generate a ab.c.*.gimple file, the c file generated by urcc ab_urcc.c, and the binary file ab.

Where to Start

  • Take some time to read the documentation for Ast.
  • Your optimizations need to be called after we generate the Ast IR for the whole program. Invoke your optimizations in driver.rb after prog = raw2ast.Construct_Ast(parser.funcList), and before we generate the C file.

Debugging

  • Most time, I explicitly insert p or print to print the values I care (Bin Bao). If you have better idea or reference to any Ruby debugger, please let me know.
  • If you find any bug in our code, please shoot us with email attaching your test case. If you can also provide a fixing, that will be great.
  • Known Problems
    • Insert Ast::Const nodes with the same numeric value will cause problem. Thus we have slightly changed the loop.c for Project Part 2. We will provide a solution soon.
    • If the end of the string is "\n", sometimes we will lose it during the transformation. This might cause problem for scanf. E.g. run ab we generated from ab.c will require any extra input after providing two numbers. Under fixing.
    • Array supporting will come soon.

* Set ALLOWTOPICCHANGE = ChenDing, BinBao

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding URCS? Send feedback