Parse trees and syntax

Tanton Gibbs thgibbs@hotmail.com
Tue, 01 Dec 1998 17:48:55 PST


Since we will be using parse trees to transfer information, there will 
be no necessity for those nasty syntax discussions.  However, what will 
be necessary is a description and inheritance heirarchy for all parse 
trees.  I suggest we start with the follwing:

  ParseNode
    Expression
      Unary
        LeftAssoc
          PostIncrement
          PostDecrement
        RightAssoc
          PreIncrement
          PreDecrement
      Binary
        LeftAssoc
          Addition
          Subtraction
          ...
          LogicalAnd
          LogicalOr
          SelectMember
        RightAssoc
          Indirection
          AddressOf
          ...
          TypeCast
      Nary
        Subscript
        FunctionCall
    
    Statement
      Assignment
        Bare
        Addition
        Subtraction
        ...
        LogicalAnd
        LogicalOr
        BitwiseAnd
        BitwiseOr
      Conditional
        If
          IfThen
          IfThenElse
          Case
        Loop
          Pretest
          Posttest
          For

Each of these nodes would have different properties and different 
numbers of node pointers to point to information.  For example, an 
IfThen node would have a pointer to an expression corresponding to the X 
in if( X ) and also a pointer to a statement Y in if( X ){ Y; }
Statements would have pointers to the next statement to be executed 
after itself.  What does everyone think about this layout?


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com