Tensorium
Loading...
Searching...
No Matches
tensorium::Parser Class Reference

#include <AST.hpp>

Collaboration diagram for tensorium::Parser:

Public Member Functions

 Parser (const std::vector< Token > &tokens)
 
std::shared_ptr< ASTNodeparse_expression ()
 
std::shared_ptr< ASTNodeparse_expression (int precedence=0)
 

Private Member Functions

std::shared_ptr< ASTNodeparse_primary ()
 
std::shared_ptr< ASTNodeparse_binary_rhs (int prec, std::shared_ptr< ASTNode > lhs)
 
Token peek () const
 
Token get ()
 
bool eof () const
 
int get_precedence (TokenType t) const
 

Private Attributes

std::vector< Tokentokens
 
size_t pos
 

Constructor & Destructor Documentation

◆ Parser()

tensorium::Parser::Parser ( const std::vector< Token > & tokens)
inlineexplicit

Member Function Documentation

◆ eof()

bool tensorium::Parser::eof ( ) const
inlineprivate

References pos, and tokens.

◆ get()

Token tensorium::Parser::get ( )
inlineprivate

References pos, and tokens.

◆ get_precedence()

int tensorium::Parser::get_precedence ( TokenType t) const
inlineprivate

References div, minus, mult, plus, and pow.

◆ parse_binary_rhs()

std::shared_ptr< ASTNode > tensorium::Parser::parse_binary_rhs ( int prec,
std::shared_ptr< ASTNode > lhs )
private

Referenced by parse_expression().

Here is the caller graph for this function:

◆ parse_expression() [1/2]

std::shared_ptr< ASTNode > tensorium::Parser::parse_expression ( )

◆ parse_expression() [2/2]

std::shared_ptr< ASTNode > tensorium::Parser::parse_expression ( int precedence = 0)
inline

References parse_binary_rhs(), and parse_primary().

Here is the call graph for this function:

◆ parse_primary()

std::shared_ptr< ASTNode > tensorium::Parser::parse_primary ( )
private

Referenced by parse_expression().

Here is the caller graph for this function:

◆ peek()

Token tensorium::Parser::peek ( ) const
inlineprivate

References pos, and tokens.

Member Data Documentation

◆ pos

size_t tensorium::Parser::pos
private

Referenced by eof(), get(), and peek().

◆ tokens

std::vector<Token> tensorium::Parser::tokens
private

Referenced by eof(), get(), and peek().


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