Output of syntax anlayzer is not like parse tree that chapter 11 expected?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Output of syntax anlayzer is not like parse tree that chapter 11 expected?

Henoktes722
I completed project 10 successfully.
I tried a let statement with expression "x + g(2, y, -z) - 5", and outputs like this one. But When I read chapter 11 It says the syntax analyzer output is like this one,



But my compiler output is not like the parse tree, I think I miss a concept.

<expression>
  <term>
   <identifier> x </identifier>
  </term>
  <symbol> + </symbol>
  <term>
   <identifier> g </identifier>
   <symbol> ( </symbol>
   <expressionList>
   <expression>
   <term>
   <integerConstant> 2 </integerConstant>
   </term>
   </expression>
   <symbol> , </symbol>
   <expression>
    <term>
     <identifier> y </identifier>
    </term>
   </expression>
   <symbol> , </symbol>
   <expression>
    <term>
     <symbol> - </symbol>
    <term>
     <identifier> z </identifier>
    </term>
   </term>
   </expression>
  </expressionList>
  <symbol> ) </symbol>
  </term>
  <symbol> - </symbol>
  <term>
  <integerConstant> 5 </integerConstant>
  </term>
 </expression>