


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



CS 5300 - SJAllan Simple Statements 2
exit 10 print_character 11 $a0=integer read_character 12 character in $v
$a0=buffer $a1=length
read_string 8
read_int 5 integer in $v
print_string 4 $a0=address of string
print_int 1 $a0=integer
Call Arguments Results Code
Service
The call code is placed in register $v
CS 5300 - SJAllan Simple Statements 3
WriteStatement : WRITESY LEFTPARENSY Expression RIGHTPARENSY {writestatement($3);} | | WRITELNSY {writelnstatement();} ;
Notice that WriteStatement has no semantic value
CS 5300 - SJAllan Simple Statements 4
li $v0, 1 # System call code for print_int li $a0, 5 # Integer to print syscall # Print it
CS 5300 - SJAllan Simple Statements 7
NullStatement : /* empty */ ;
This is a tough one to implement Can you figure it out?