From stewart@rohan.sdsu.edu Wed Feb 13 13:18:09 2008 Date: Wed, 13 Feb 2008 13:16:49 -0800 (PST) From: kris stewart To: masc0830@rohan.sdsu.edu Subject: Phase1_Comments_Results These are the results from running instructor's sample source files (with expected out): test0 Loaded: /opt/spim/bin/trap.handler 2 2 228 test1 - has a comment at the end of the file Loaded: /opt/spim/bin/trap.handler 3-132 test2 [has an error - would be "nice" to generate meaningful message] syntax error in simple.c Parse ERROR: NO CODE GENERATED test3 - make sure all the comments passed along in listing Loaded: /opt/spim/bin/trap.handler 2-18 Spr 2008 ------------------------------------ Phase1 results ------ The beginning of the file identifies your account name and the time stamp of the file named simple which is your Phase1 Compiler processing Ada-like comments. The listing file produced by your compiler is then followed by the SPIM code that your compiler generates, followed by the execution by SPIM itself. The grading rubric gives 9/10 (an A) for completing the assignment correctly and on time. You loose points for being late or incompleteness. We reserve the 10/10 for doing "something special", which is not specific beforehand. :1 incompleteness. We reserve the 10/10 for doing "something special", which is not specific beforehand. Instructor Comments on your Results: kris as cs524 student -------------------------------------------------------------------- Login name: masc0830 In real life: Stewart as CS524 student Directory: /home/ma/524.01/masc0830 Shell: /bin/csh Last login Tue Feb 12 16:50 on pts/19 from rohan.sdsu.edu No unread mail No Plan. -rwxr-x--- 1 masc0830 110880 Feb 6 11:26 /home/ma/524.01/masc0830/simple* -rwxr-xr-x 1 stewart 110880 Feb 12 17:03 simple* test data used for all tests will be 2 typed at keyboard ************************************************************ masc0830 simple test number test0 CS 524 - Phase 1 Tests Tue Feb 12 17:03:04 PST 2008 -- testing comments a:=2; writeln(a); -- comments after a code segment readln(b); writeln(b); if a = b then c := -a + b * 5; writeln (a,b,c); end if; -- comment at the end of file ******** Test your compiler on the code above ******** in simple.c >From codegen.c - DisplayRegs() marks used registers Register: 0 1 2 3 4 5 6 7 8 9 - - - - - - - - - - Used = x: COMPILATION COMPLETE out simple.c ******** Your compiler produces a listing ****** -- testing comments a:=2; writeln(a); -- comments after a code segment writeln(a); -- comments after a code segment readln(b); writeln(b); if a = b then c := -a + b * 5; writeln (a,b,c); end if; -- comment at the end of file ******** And Source Code File *********** # Register Usage: # $s0 for global variables # .text .globl main main: la $s0, GVARS # # Start Code # # Generate Assignment Statement li $t0,2 sw $t0,0($s0) # # Generate Writeln statement li $v0, 1 lw $a0,0($s0) syscall la $a0, S0 li $v0, 4 syscall # # Generate Readln statement li $v0, 5 syscall sw $v0,4($s0) # # Generate Writeln statement li $v0, 1 lw $a0,4($s0) syscall la $a0, S0 li $v0, 4 syscall # # Generate If-Then statement lw $t0,0($s0) lw $t1,4($s0) seq $t0,$t0,$t1 beq $t0, 0,IF0 # beq $t0, 0,IF0 # # Generate Assignment Statement lw $t0,0($s0) neg $t0,$t0 lw $t1,4($s0) mul $t1,$t1,5 add $t0,$t0,$t1 sw $t0,8($s0) # # Generate Writeln statement li $v0, 1 lw $a0,0($s0) syscall li $v0, 1 lw $a0,4($s0) syscall li $v0, 1 lw $a0,8($s0) syscall la $a0, S0 li $v0, 4 syscall # # End If IF0: # # Halt execution li $v0 10 syscall # # Finish up by writing out constants .word 0 CONST: #Constant storage area .data S0: .asciiz "\n" # # Reserve space for global variables .word 0 GVARS: # space for Global Variables .data _a: .word 0 # Offset at 0 .data _b: .word 0 # Offset at 4 .data _c: .word 0 # Offset at 8 .data Temp_Wr: .word 0 #just for alignment of write(exprtree) ******** Run through spim ********* SPIM Version 6.2 of January 11, 1999 Copyright 1990-1998 by James R. Larus (larus@cs.wisc.edu). All Rights Reserved. Copyright 1990-1998 by James R. Larus (larus@cs.wisc.edu). All Rights Reserved. See the file README for a full copyright notice. Loaded: /opt/spim/bin/trap.handler 2 2 228 ************************************************************ masc0830 simple test number test1 CS 524 - Phase 1 Tests Tue Feb 12 17:03:05 PST 2008 x := 3; y := x - 45 * x; -- comment writeln (x,y); ******** Test your compiler on the code above ******** in simple.c >From codegen.c - DisplayRegs() marks used registers Register: 0 1 2 3 4 5 6 7 8 9 - - - - - - - - - - Used = x: COMPILATION COMPLETE out simple.c ******** Your compiler produces a listing ****** x := 3; y := x - 45 * x; -- comment writeln (x,y); ******** And Source Code File *********** # Register Usage: # $s0 for global variables # .text .globl main main: la $s0, GVARS # # Start Code # # Generate Assignment Statement li $t0,3 sw $t0,0($s0) # # Generate Assignment Statement lw $t0,0($s0) mul $t0,$t0,45 lw $t1,0($s0) mul $t0,$t0,45 lw $t1,0($s0) sub $t1,$t1,$t0 sw $t1,4($s0) # # Generate Writeln statement li $v0, 1 lw $a0,0($s0) syscall li $v0, 1 lw $a0,4($s0) syscall la $a0, S0 li $v0, 4 syscall # # Halt execution li $v0 10 syscall # # Finish up by writing out constants .word 0 CONST: #Constant storage area .data S0: .asciiz "\n" # # Reserve space for global variables .word 0 GVARS: # space for Global Variables .data _x: .word 0 # Offset at 0 .data _y: .word 0 # Offset at 4 .data Temp_Wr: .word 0 #just for alignment of write(exprtree) ******** Run through spim ********* SPIM Version 6.2 of January 11, 1999 Copyright 1990-1998 by James R. Larus (larus@cs.wisc.edu). All Rights Reserved. See the file README for a full copyright notice. Loaded: /opt/spim/bin/trap.handler 3-132 ************************************************************ masc0830 simple test number test2 CS 524 - Phase 1 Tests Tue Feb 12 17:03:05 PST 2008 x:=4; y:= - 4 - 96 / (x - x * x) / 4 + x; write(x); write(y); -- how does your compiler handle an error? write(y); -- how does your compiler handle an error? - howdy writeln; ******** Test your compiler on the code above ******** syntax error in simple.c Parse ERROR: NO CODE GENERATED out simple.c **** Problems ***** Only a partial compilation was produced ************************************************************ masc0830 simple test number test3 CS 524 - Phase 1 Tests Tue Feb 12 17:03:05 PST 2008 x:=2; -- just having lots of tests -- howdy write (x); -- what sort of odd things might occur y:= x / x + 4 * (1/x - x - x) - 3; -- all comments passed on? writeln (y); -- ******** Test your compiler on the code above ******** in simple.c >From codegen.c - DisplayRegs() marks used registers Register: 0 1 2 3 4 5 6 7 8 9 - - - - - - - - - - Used = x: COMPILATION COMPLETE out simple.c ******** Your compiler produces a listing ****** x:=2; -- just having lots of tests -- howdy write (x); -- what sort of odd things might occur y:= x / x + 4 * (1/x - x - x) - 3; -- all comments passed on? writeln (y); -- ******** And Source Code File *********** # Register Usage: # $s0 for global variables # .text .globl main main: la $s0, GVARS # :$ # # Finish up by writing out constants .word 0 CONST: #Constant storage area .data S0: .asciiz "\n" # # Reserve space for global variables .word 0 GVARS: # space for Global Variables .data _x: .word 0 # Offset at 0 .data _y: .word 0 # Offset at 4 .data Temp_Wr: .word 0 #just for alignment of write(exprtree) ******** Run through spim ********* SPIM Version 6.2 of January 11, 1999 Copyright 1990-1998 by James R. Larus (larus@cs.wisc.edu). All Rights Reserved. See the file README for a full copyright notice. Loaded: /opt/spim/bin/trap.handler 2-18