Nearly CC
An educational compiler skeleton
Public Member Functions | List of all members
NodeBase Class Reference

The Node class will inherit from this type, so you can use it to define any attributes and methods that Node objects should have (constant value, results of semantic analysis, code generation info, etc.) More...

#include "node_base.h"

Inheritance diagram for NodeBase:
Inheritance graph
[legend]
Collaboration diagram for NodeBase:
Collaboration graph
[legend]

Public Member Functions

void set_operand (const Operand &op)
 Set the Node's Operand. More...
 
bool has_operand () const
 Check whether this Node has a valid Operand. More...
 
const Operand get_operand () const
 Get this Node's Operand. More...
 

Detailed Description

The Node class will inherit from this type, so you can use it to define any attributes and methods that Node objects should have (constant value, results of semantic analysis, code generation info, etc.)

Because NodeBase inherits from HasOperand, each Node automatically stores an Operand. This is useful for code generation: when generating code to evaluate an expression, HighLevelCodegen can set the Node's Operation to indicate the location where the result of the evaluation is stored.

Member Function Documentation

◆ get_operand()

const Operand HasOperand::get_operand ( ) const
inlineinherited

Get this Node's Operand.

Returns
this Node's Operand

◆ has_operand()

bool HasOperand::has_operand ( ) const
inlineinherited

Check whether this Node has a valid Operand.

Returns
true if the Node has a valid Operand, false otherwise

◆ set_operand()

void HasOperand::set_operand ( const Operand op)
inlineinherited

Set the Node's Operand.

Parameters
opthe Operand to set

The documentation for this class was generated from the following files: