Syntax analyzers
. Testing for membership whether w belongs to L(G) is just a "yes" or "no" answer
. However the syntax analyzer
- Must generate the parse tree
- Handle errors gracefully if string is not in the language
. Form of the grammar is important
- Many grammars generate the same language
- Tools are sensitive to the grammar
A parse tree may be viewed as a graphical representation for a derivation that filters out the choice regarding replacement order. Each interior node of a parse tree is labeled by some non-terminal A , and that the children of the node are labeled, from left to right, by the symbols in the right side of the production by which this A was replaced in the derivation. A syntax analyzer not only tests whether a construct is syntactically correct i.e. belongs to the language represented by the specified grammar but also generates the parse tree. It also reports appropriate error messages in case the string is not in the language represented by the grammar specified.
It is possible that many grammars represent the same language. However, the tools such as yacc or other parser generators are sensitive to the grammar form. For example, if the grammar has shift-shift or shift-reduce conflicts, the parser tool will give appropriate warning message. We will study about these in details in the subsequent sections.
|