. .. .
第二章
P36-6
(1)
L(G1)是0~9组成的数字串
(2)
最左推导:
N?ND?NDD?NDDD?DDDD?0DDD?01DD?012D?0127N?ND?DD?3D?34N?ND?NDD?DDD?5DD?56D?568
最右推导:
N?ND?N7?ND7?N27?ND27?N127?D127?0127N?ND?N4?D4?34N?ND?N8?ND8?N68?D68?568
P36-7
G(S)
O?1|3|5|7|9N?2|4|6|8|OD?0|NS?O|AOA?AD|N
P36-8
文法:
E?T|E?T|E?TT?F|T*F|T/F F?(E)|i最左推导:
E?E?T?T?T?F?T?i?T?i?T*F?i?F*F?i?i*F?i?i*iE?T?T*F?F*F?i*F?i*(E)?i*(E?T)?i*(T?T)?i*(F?T)?i*(i?T)?i*(i?F)?i*(i?i)最右推导:
E?E?T?E?T*F?E?T*i?E?F*i?E?i*i?T?i*i?F?i*i?i?i*iE?T?F*T?F*F?F*(E)?F*(E?T)?F*(E?F)?F*(E?i)?F*(T?i)?F*(F?i)?F*(i?i)?i*(i?i)语法树:/********************************
. .资料. ..
. .. .
EETEEE+E+TE-TE+TFTT*F-TFTFiFFiTFiFiii+i+i*****************/
P36-9
句子iiiei有两个语法树:
SS??iSeSiS??iiSeSiSei??iiSeiiiSei??iiieiiiiei
P36-10
/**************
S?TS|TT?(S)|( )
***************/
P36-11
/*************** L1:
S?ACA?aAb|ab C?cC|?L2:
S?ABA?aA|?
B?bBc|bcL3:
. .iii-i-i资料. ..
Fiii+i*i
. .. .
S?ABA?aAb|? B?aBb|?L4:
S?A|BA?0A1|? B?1B0|A***************/
第三章习题参考答案
P64–7
(1)
* 1(01|)101 X Y
0
1 ? ? 1 0 1 X 1 2 3 4 5
Y
1 确定化:
{X} φ {1,2,3} {2,3} {2,3,4} {2,3,5} {2,3,4,Y} 0 φ φ {2,3} {2,3} {2,3,5} {2,3} {2,3,5} 1 {1,2,3} φ {2,3,4} {2,3,4} {2,3,4} {2,3,4,Y} {2,3,4,} 0
1 0 0 2 3
0 0 1 1 0 1 0 1 4 5 0 1 1 1 最小化:
6 . .资料. ..