Or if you prefer inheritance, you can extend the inheritance tree:
    
    
    type
      Node = ref object of RootObj
      
      LitOrOp = ref object of Node
      
      Number = object of LitOrOp
        value: int
      
      BinOp = object of LitOrOp
        left: LitOrOp
        op: string
        right: LitOrOp
    
    
    Run

Reply via email to