Syntax Tree In Automata
When you construct a parse tree then it may contains more details than actually required. So, it is very difficult to compiler to execute unnecessary information’s. That’s why a syntax tree is used which holds just necessary information’s.
Example of Syntax Tree
Consider the following Parse tree
As above parse tree is providing the string is “id + id * id ”. Now let us eliminate the extra information from given parse tree to get the same string.
Hence, A String “id + id * id” is derived by elimination of unnecessary information’s. It is called syntax tree.
Abstract Syntax Tree
Abstract syntax tree can be represented as follows
In compiler the Abstract syntax trees are important because abstract syntax tree contains the least unnecessary information.