CS75 Lab 0

Initial Set-up for Course Projects
Starting Code Walk-through
C debugging tools demo
Setup for Course Projects
Subversion
  1. Request a svn repository be created for your project that you and your partner can access (we will set these up in lab). The names of the repositories are of the form CS75_your_and_your_partners_initials, so mine with project partner Jeff Knerr is CS75_tnjk
  2. After your svn repository is created, create a private subdirectory in your home directory, and check out a working copy of the repository
  3. $ mkdir cs75
    $ chmod 700 cs75
    $ cd cs75
    $ svn co http://svn.cs.swarthmore.edu/svn/nameofrepository
    
  4. copy over the project starting point code into a subdirectory of cs75/nameofrepository
    % cd nameofrepository
    $ cp -r ~newhall/public/cs75/proj1_startingpt project
    
  5. add project to the svn repository
    $ svn add project
    
  6. commit your change to the repository
     
    $ svn commit
    

More information about using svn (and other revision control software) is available here: here

Code Walkthrough
The starting point code that you copied over into your cs75/nameofrepository/project directory from my ~newhall/public/cs75/proj1_startingpt directory is organized into several subdirectories, one for each part of the compiler you will write (lexer, parser, codegen), some for utilities that I will give you or you will write (ast, symtab), one for header files that are included in different modules (includes) and one for C-- test programs (test_suite).

Makefiles

There is a high-level Makefile in the top directory that you can use to build all modules, or you can cd into a subdirectory to build that particular module. For example, you can cd into lexer and type 'make' to build the lexical analyzer.

Before you do your first build of a module, or anytime you add a new header file, run 'make depend' to automatically generate dependincies to the Makefile.

If you add .c files to a module, you will need to modify the module's Makefile to compile the .c and link it into the target executable file. To do this add the .c file to the SRCS definition in the appropriate Makefile.

As I assign more parts of the project, I will give you Makefiles and some starting point code to copy into these subdirectories as a starting point.

Header files

in includes subdirectory

what goes into a header file

what extern means

C debugging tools

We are going to go through some examples of using gdb and valgrind to debug C (or C++) programs: gdb and valgrind info