SOAL :
1. Diketahui persamaan :
1. Diketahui persamaan :
Z:=(E+D)2-C/(B*A3)
Buatlah persamaan tersebut kedalam bentuk :
a. Triples Notation
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 g23p, sehingga kalimat tersebut terselesaikan.
Jawaban :
1.
Z:=(E+D)2-C/(B*A3)
a.
Triple Notation
|
b.
Indirect triple
|
||||||||||||
1.
|
+,
|
E,
|
D
|
List Instruksi
|
List
Eksekusi
|
||||||||
2.
|
*,
|
1,
|
1
|
1.
|
+,
|
E,
|
D
|
1.
|
1
|
||||
3.
|
*,
|
A,
|
A
|
2.
|
*,
|
1,
|
1
|
2.
|
2
|
||||
4.
|
*,
|
A,
|
3
|
3.
|
*,
|
A,
|
A
|
3.
|
3
|
||||
5.
|
*,
|
B,
|
4
|
4.
|
*,
|
A,
|
3
|
4.
|
4
|
||||
6.
|
/,
|
C,
|
5
|
5.
|
*,
|
B,
|
4
|
5.
|
5
|
||||
7.
|
-,
|
3,
|
6
|
6.
|
/,
|
C,
|
5
|
6.
|
6
|
||||
8.
|
:=,
|
Z,
|
7
|
7.
|
-,
|
3,
|
6
|
7.
|
7
|
||||
8.
|
:=,
|
Z,
|
7
|
8.
|
8
|
c.
Quadruple Notation
|
d.
Assembly Accumulator Tunggal
|
||||||||||
1.
|
+,
|
E,
|
D,
|
T1
|
1.
|
LDA
|
E
|
||||
2.
|
*,
|
T1,
|
T1,
|
T2
|
ADD
|
D
|
|||||
3.
|
*,
|
A,
|
A,
|
T3
|
STO
|
T1
|
|||||
4.
|
*,
|
T3,
|
A,
|
T4
|
|||||||
5.
|
*,
|
B,
|
T4,
|
T5
|
2.
|
LDA
|
T1
|
||||
6.
|
/,
|
C,
|
T5,
|
T6
|
MUL
|
T1
|
|||||
7.
|
-,
|
T2,
|
T6,
|
Z
|
STO
|
T2
|
|||||
3.
|
LDA
|
A
|
|||||||||
MUL
|
A
|
||||||||||
STO
|
T3
|
||||||||||
4.
|
LDA
|
T3
|
|||||||||
MUL
|
A
|
||||||||||
STO
|
T4
|
||||||||||
5.
|
LDA
|
B
|
|||||||||
MUL
|
T4
|
||||||||||
STO
|
T5
|
||||||||||
6.
|
LDA
|
C
|
|||||||||
DIV
|
T4
|
||||||||||
STO
|
T6
|
||||||||||
7.
|
LDA
|
T2
|
|||||||||
SUB
|
T6
|
||||||||||
STO
|
Z
|
Jawaban 2.
I èIA
èIAH
èIAAH
èHAAH
ègAAH
èg2AH
èg23H
èg23p
No comments:
Post a Comment