Syntax Tree In Automata
When constructing a parse tree in Automata, it may contain unnecessary details. So, it is very difficult for a compiler to execute unnecessary information. That’s why a syntax tree, which holds just the necessary information, is used.
Example of Syntax Tree
Consider the following Parse tree.
The above parse tree provides the string “id + id * id.” Let us eliminate the extra information from the given parse tree to get the same string.
Hence, A String “id + id * id” is derived by eliminating unnecessary information. It is called a syntax tree.
Abstract Syntax Tree
Abstract syntax tree can be represented as follows
In compiler, the Abstract syntax trees are important because the abstract syntax tree contains the least unnecessary information.