正在加载图片...
One parse tree only The role of the grammar a distinguish between syntactically legal and illegal programs a But that' s not enough it must also define a parse tree a the parse tree conveys the meaning of the program What if a string can be parsed with multiple parse trees? a we say the grammar is ambiguous a must fix the grammar ( the problem is not in the parser a Note: often a string can be derived in more than one way D ie, with more than one derivation sequence a this does not mean the grammar is ambiguousOne parse tree only! ◼ The role of the grammar  distinguish between syntactically legal and illegal programs ◼ But that’s not enough: it must also define a parse tree  the parse tree conveys the meaning of the program ◼ What if a string can be parsed with multiple parse trees?  we say the grammar is ambiguous  must fix the grammar (the problem is not in the parser) ◼ Note: often a string can be derived in more than one way  ie, with more than one derivation sequence  this does not mean the grammar is ambiguous 2
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有