Soal Teknik Kompilasi Untuk Kelas C
1.
Diketahui persamaan :
C:= (A*2+B)2-C/(D*E3)
Buatlah persamaan tersebut kedalam bentuk :
a. Triples Notation
b. Indirect Triples
c. Quaduples Notation
d. Kode Antara Assembly Accumulator Tunggal
b. Indirect Triples
c. Quaduples Notation
d. Kode Antara Assembly Accumulator Tunggal
2. Diketahui grammar G = {I ® H½I
H½IA, H ®
a½b½c½...½z, A ®
0½1½2½...½9} dengan I adalah simbol
awal
Lakukan analisa sintaks dengan cara derivasi
dan parsing
untuk kalimat d67s, sehingga kalimat tersebut terselesaikan.
Jawaban :
1.
C:= (A*2+B)2-C/(D*E3)
a.
Triple Notation
|
b.
Indirect triple
|
||||||||||||
1.
|
*,
|
A,
|
2
|
List Instruksi
|
List
Eksekusi
|
||||||||
2.
|
+,
|
1,
|
B
|
1.
|
*,
|
A,
|
2
|
1.
|
1
|
||||
3.
|
*,
|
2,
|
2
|
2.
|
+,
|
1,
|
B
|
2.
|
2
|
||||
4.
|
*,
|
E,
|
E
|
3.
|
*,
|
2,
|
2
|
3.
|
3
|
||||
5.
|
*,
|
4,
|
E
|
4.
|
*,
|
E,
|
E
|
4.
|
4
|
||||
6.
|
*,
|
D,
|
5
|
5.
|
*,
|
4,
|
E
|
5.
|
5
|
||||
7.
|
/,
|
C,
|
6
|
6.
|
*,
|
D,
|
5
|
6.
|
6
|
||||
8.
|
-,
|
3,
|
7
|
7.
|
/,
|
C,
|
6
|
7.
|
7
|
||||
9.
|
:=,
|
Z,
|
8
|
8.
|
-,
|
3,
|
7
|
8.
|
8
|
||||
9.
|
:=,
|
Z,
|
8
|
9.
|
9
|
c.
Quadruple Notation
|
d.
Assembly Accumulator Tunggal
|
||||||||||
1.
|
*,
|
A,
|
2,
|
T1
|
1.
|
LDA
|
A
|
||||
2.
|
+,
|
T1,
|
B,
|
T2
|
MUL
|
2
|
|||||
3.
|
*,
|
T2,
|
T2,
|
T3
|
STO
|
T1
|
|||||
4.
|
*,
|
E,
|
E,
|
T4
|
|||||||
5.
|
*,
|
T4,
|
E,
|
T5
|
2.
|
LDA
|
T1
|
||||
6.
|
*,
|
D,
|
T5,
|
T6
|
ADD
|
B
|
|||||
7.
|
/,
|
C,
|
T6,
|
T7
|
STO
|
T2
|
|||||
8.
|
-,
|
T3,
|
T7,
|
C
|
|||||||
3.
|
LDA
|
T2
|
|||||||||
MUL
|
T2
|
||||||||||
STO
|
T3
|
||||||||||
4.
|
LDA
|
E
|
|||||||||
MUL
|
E
|
||||||||||
STO
|
T4
|
||||||||||
5.
|
LDA
|
T4
|
|||||||||
MUL
|
E
|
||||||||||
STO
|
T5
|
||||||||||
6.
|
LDA
|
D
|
|||||||||
MUL
|
T5
|
||||||||||
STO
|
T6
|
||||||||||
7.
|
LDA
|
C
|
|||||||||
DIV
|
T6
|
||||||||||
STO
|
T7
|
||||||||||
8.
|
LDA
|
T3
|
|||||||||
SUB
|
T7 | ||||||||||
STO
|
C
|
||||||||||
I èIA
èIAH
èIAAH
èHAAH
èdAAH
èd6AH
èd67H
èd67s
Everything is very open with a very clear description of the
ReplyDeletechallenges. It was really informative. Your site is very useful.
Thank you for sharing!