正在加载图片...
Shift-Reduce Parsing A shift-reduce parser tries to reduce the given input string into the starting symbol. a string>the starting symbol reduced to 。 At each reduction step,a substring of the input matching to the right side of a production rule is replaced by the non-terminal at the left side of that production rule. If the substring is chosen correctly,the right most derivation of that string is created in the reverse order. Rightmost Derivation: Shift-Reduce Parser finds: CS308 Compiler Theory 3Shift-Reduce Parsing • A shift-reduce parser tries to reduce the given input string into the starting symbol. a string Î the starting symbol reduced to • At each reduction step, a substring of the input matching to the right side of a production rule is replaced by the non production rule is replaced by the non -terminal at the left side of that production rule. terminal at the left side of that production rule. • If the substring is chosen correctly, the right most derivation of that string is created in the reverse order. Rightmost Derivation: S ⇒ ω *rm Shift-Reduce Parser finds: ω ⇐ ... ⇐ S rm rm CS308 Compiler Theory 3
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有