正在加载图片...
A Stack Implementation of A Shift-Reduce Parser There are four possible actions of a shift-parser action: 1.Shift:The next input symbol is shifted onto the top of the stack. 2.Reduce:Replace the handle on the top of the stack by the non- terminal. 3.Accept:Successful completion of parsing. 4.Error:Parser discovers a syntax error,and calls an error recovery routine. Initial stack just contains only the end-marker $ The end of the input string is marked by the end-marker $ CS308 Compiler TheoryA Stack Implementation of A Shift-Reduce Parser • There are four possible actions of a shift-parser action: 1. Shift : The next input symbol is shifted onto the top of the stack. 2. Reduce: Replace the handle on the top of the stack by the non￾terminal. 3. Accept: Successful completion of parsing. 4. Error: Parser discovers a syntax error, and calls an error recovery rout ine. • Initial stack just contains only the end-marker $. • The end of the in put strin g is marked b y the en d-marker $. CS308 Compiler Theory 8 pg y
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有