ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
ASTBinaryOp Struct Reference

Description:

Abstract syntax tree node representing binary operators.

Definition at line 233 of file ast.hpp.

#include <ast.hpp>

Inheritance diagram for ASTBinaryOp:
[legend]
Collaboration diagram for ASTBinaryOp:
[legend]

Public Field Index:

ASTLhs
 The left-hand-side expression node.
 
String Operator
 The operator symbol.
 
ASTRhs
 
- Public Field Index: inherited from AST
Types NodeType
 Type of derived this AST node.
 
integer Position
 Position in original expression string.
 

Public Method Index:

 ASTBinaryOp (const String &op, AST *lhs, AST *rhs, integer position)
 
virtual ~ASTBinaryOp () override
 Virtual destructor.
 
virtual void Assemble (Program &program, MonoAllocator &allocator, AString &normalized) override
 
virtual ASTOptimize (Normalization normalization) override
 
- Public Method Index: inherited from AST
 AST ()=delete
 Deleted default constructor.
 
 AST (Types type, integer position)
 
virtual ~AST ()
 Virtual destructor.
 

Additional Inherited Members

- Public Type Index: inherited from AST
enum class  Types {
  Literal , Identifier , Function , UnaryOp ,
  BinaryOp , TernaryOp
}
 The type of node. More...
 

Field Details:

◆ Lhs

AST* Lhs

The left-hand-side expression node.

Definition at line 236 of file ast.hpp.

◆ Operator

String Operator

The operator symbol.

Definition at line 235 of file ast.hpp.

◆ Rhs

AST* Rhs

The right-hand-side expression node.

Definition at line 237 of file ast.hpp.

Constructor(s) / Destructor Details:

◆ ASTBinaryOp()

ASTBinaryOp ( const String & op,
AST * lhs,
AST * rhs,
integer position )
inlineexplicit

Constructor providing all fields.

Parameters
lhsLeft-hand side node.
rhsRight-hand side node.
opThe operator symbol.
positionThe index of this AST in the expression string.

Definition at line 244 of file ast.hpp.

◆ ~ASTBinaryOp()

virtual ~ASTBinaryOp ( )
inlineoverridevirtual

Virtual destructor.

Definition at line 250 of file ast.hpp.

Method Details:

◆ Assemble()

void Assemble ( Program & program,
MonoAllocator & allocator,
AString & normalized )
overridevirtual

Implements abstract method.

Parameters
programThe program to be compiled.
allocatorAn allocator usable for temporary objects.
[out]normalizedThe normalized string, built during recursive compilation of the AST.

Implements AST.

Definition at line 395 of file ast.cpp.

Here is the call graph for this function:

◆ Optimize()

AST * Optimize ( Normalization normalization)
overridevirtual

Implements abstract method.

Parameters
normalizationThe compiler flags denoting the normalization settings.
Returns
A potentially replaced AST or itself.

Implements AST.

Definition at line 60 of file ast.cpp.

Here is the call graph for this function:

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