

























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Schmidt; Class: Programming Language Concepts; Subject: Computer Science; University: Drexel University; Term: Unknown 1989;
Typology: Assignments
1 / 33
This page cannot be seen from the preview
Don't miss anything!


























Construct code for expressions, assignments, if, and while.
Concatenate statements in stmt-list
Allocate temporaries as needed
Keep track of variables, constants, and temporaries in Symbol Table
Use symbolic instructions and fill in absolute addresses (linking)when complete code has been constructed
LDA X; Load the AC with the contents of memory address X
X; Load the AC indirectly with the contents of address X
STA X; Store the contents of the AC at memory address X
X; Store the contents of the AC indirectly at address X
ADD X; Add the contents of address X to the contents of the AC
SUB X; Subtract the contents of address X from the AC
MUL X; Multiply the contents of address X to the contents of the AC
JMP X; Jump to the instruction labeled X
JMZ X; Jump to the instruction labeled X if the AC contains 0
JMN X; Jump to the instruction labeled X if the contents of the AC isnegative
; Halt execution
8
1
2
1
1
2
2
1
1
2
2
3
1
2
n
LD ZERO ST T1 LD FIVE ST T2 LD T1 SUB T2 ST T3 LD T3 ST n LD n ST T4 LD T4 JMN L1 JMZ L1 LD n ST T5 LD T5 ST i JMP L
L3: LD i
ST T10JMN L4JMZ L4LD factST T11LD iST T12LD T11MUL T12ST T LD T13ST fact
LD iST T14LD ONEST T15LD T14SUB T15ST T16LD T16ST iJMP L
ST T6LD nST T7LD T6SUB T7ST T8LD T8ST i
ST fact