正在加载图片...
Derivation Example E→-E→-(E)→-(E+E)→-(id+E)→-(id+id) OR E→-E→-(E)→-(E+E)→-(E+id)→-(id+id) At each derivation step,we can choose any of the non-terminal in the sentential form of G for the replacement. If we always choose the left-most non-terminal in each derivation step,this derivation is called as left-most derivation. If we always choose the right-most non-terminal in each derivation step,this derivation is called as right-most derivation. CS308 Compiler TheoryDerivation Example E ⇒ -E ⇒ -(E) ⇒ -(E+E) ⇒ -(id+E) ⇒ -(id+id) O R E ⇒ -E ⇒ -(E) ⇒ -(E+E) ⇒ -(E+id) ⇒ -(id+id) • At each derivation step, we can choose any of the non-terminal in the sentential form of G for the re placement. • If we always choose the left-most non-terminal in each derivation step, this derivation i ll d s call e d as l f e ft-most di i er ivat ion. • If we always choose the right If we always choose the right -most non most non -terminal in each derivation step this terminal in each derivation step, this derivation is called as right-most derivation. CS308 Compiler Theory 8
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有