Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is a parse tree ?

parse tree
0
10 Posted

What is a parse tree ?

0

A parse-tree is an internal structure, created by the compiler or interpreter while parsing some language construction. Parsing is also known as ‘syntax analysis’. An example (slightly adapted version of the example found at page 6 of the famous ‘Dragon Book’, Compilers: principles, techniques and tools, by Alfred V. Aho, Ravi Sethi and Jeffrey D. Ullman, Published by Addison Wesley. My copy is from 1986) will illustrate a parse tree. Rather than dealing with the complexities of a SQL statement, let’s take a rather simple language construction: The assignment of the result of an expression to a variable: result := salary + bonus * 1.10 When the compiler analyzes this statement the resulting parse-tree will look like this : assignment ________ statement ____ / | \ / := \ identifier ___ expression _______ | / | \ result / + \ expression __ expression ___ | / | \ identifier / * \ | expression expression salary | | identifier number | | bonus 1.10 The picture is an upside-down representati

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.