CSC362.01, Lab 1: Exploring Compilation * Sam has an odd attitude towards labs: Primarily a chance for you to play with software (and, hopefully, learn something from doing so). * But ATTENDANCE IS EXPECTED! * I will usually start with a quick intro. * How to get the eBoard: Follow the links from the home page. * How to get the lab: Go to the labs page, click on "Lab 1", follow the instructions. * Today: Work on documentation reading skills and sample assembly code. (The "Paul Heider" method of learning compilers.) Reflection: What did you learn? Some helpful info: * To read a "man" (short for "manual") page, type man SUBJECT E.g. man gcc * To read an "info" (short for "information"), type info SUBJECT E.g. info gcc * To search in a man page, type /SEARCHTERM EXERCISE 1 Some other "interesting" tidbits * gcc has an insanely long manual and more than 100 options * Finding information in long manual is a skill that takes lots of practice * There are three standard intermediate forms easily generatable by gcc from C programs * .o files; "object" files: unlinked machine code (almost executable) gcc -c foo.c * .s ; assembly language files gcc -S foo.c * .i ; "preprocessed C files" gcc -E foo.c -o foo.i * How to get all three at once gcc -save-temps foo.c EXERCISE 2 * The "kompare" program (menu, Programming, More Programming Tools, Kompare) may be useful to compare the .c and .i versions EXERCISE 3 * To compile in Pascal, you need to ssh to lovelace pc -S hellop.p * The "kompare" program may be useful to compare the two .s files