Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Compiler_Token.H File Reference

Token model and parser-facing metadata for compiler front-ends. More...

#include <sstream>
#include <string>
#include <string_view>
#include <ah-source.H>
Include dependency graph for Compiler_Token.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::Compiler_Token
 Lexical token representation with its value and location. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 
namespace  Aleph::Compiler_Token_Detail
 

Enumerations

enum class  Aleph::Compiler_Associativity { Aleph::None , Aleph::Left , Aleph::Right }
 Associativity metadata for binary operators. More...
 
enum class  Aleph::Compiler_Token_Kind {
  Aleph::Invalid , Aleph::End_Of_File , Aleph::Identifier , Aleph::Integer_Literal ,
  Aleph::String_Literal , Aleph::Char_Literal , Aleph::Line_Comment , Aleph::Block_Comment ,
  Aleph::Kw_If , Aleph::Kw_Else , Aleph::Kw_While , Aleph::Kw_For ,
  Aleph::Kw_Return , Aleph::Kw_Break , Aleph::Kw_Continue , Aleph::Kw_Func ,
  Aleph::Kw_Fn = Kw_Func , Aleph::Kw_Var , Aleph::Kw_Let , Aleph::Kw_Const ,
  Aleph::Kw_Type , Aleph::Kw_Struct , Aleph::Kw_Enum , Aleph::Kw_Class ,
  Aleph::Kw_Import , Aleph::Kw_Export , Aleph::Kw_Namespace , Aleph::Kw_Try ,
  Aleph::Kw_Catch , Aleph::Kw_Throw , Aleph::Kw_True , Aleph::Kw_False ,
  Aleph::LParen , Aleph::RParen , Aleph::LBrace , Aleph::RBrace ,
  Aleph::LBracket , Aleph::RBracket , Aleph::Comma , Aleph::Semicolon ,
  Aleph::Colon , Aleph::Dot , Aleph::Arrow , Aleph::Double_Colon ,
  Aleph::Question , Aleph::Assign , Aleph::Plus , Aleph::Minus ,
  Aleph::Star , Aleph::Slash , Aleph::Percent , Aleph::EqEq ,
  Aleph::NotEq , Aleph::Less , Aleph::LessEq , Aleph::Greater ,
  Aleph::GreaterEq , Aleph::AndAnd , Aleph::OrOr , Aleph::Bang ,
  Aleph::Amp , Aleph::Pipe , Aleph::Caret , Aleph::Tilde ,
  Aleph::PlusEq , Aleph::MinusEq , Aleph::StarEq , Aleph::SlashEq ,
  Aleph::PercentEq , Aleph::PlusPlus , Aleph::MinusMinus
}
 Token kinds supported by the compiler MVP. More...
 

Functions

const char * Aleph::compiler_token_kind_name (Compiler_Token_Kind kind)
 Returns a human-readable name for a token kind.
 
Compiler_Token_Kind Aleph::classify_compiler_keyword (std::string_view lexeme) noexcept
 Classifies a lexeme as a keyword or Identifier.
 
bool Aleph::compiler_token_is_keyword (Compiler_Token_Kind kind) noexcept
 Predicate: Is the kind a reserved keyword?
 
bool Aleph::compiler_token_is_literal (Compiler_Token_Kind kind) noexcept
 Predicate: Is the kind a literal (number, string, bool, etc.)?
 
bool Aleph::compiler_token_is_comment (Compiler_Token_Kind kind) noexcept
 Predicate: Is the kind a comment?
 
bool Aleph::compiler_token_is_operator (Compiler_Token_Kind kind) noexcept
 Predicate: Is the kind an operator (arithmetic, logical, etc.)?
 
int Aleph::compiler_binary_precedence (Compiler_Token_Kind kind) noexcept
 Returns binary precedence for an operator.
 
Compiler_Associativity Aleph::compiler_binary_associativity (Compiler_Token_Kind kind) noexcept
 Returns binary associativity for an operator.
 
std::string Aleph::Compiler_Token_Detail::escape_token_lexeme (std::string_view text)
 

Detailed Description

Token model and parser-facing metadata for compiler front-ends.

This header provides a token kind enumeration, a token value object carrying raw lexeme and source span, keyword classification, and basic binary operator precedence metadata suitable for future Pratt or precedence-climbing parsers.

Definition in file Compiler_Token.H.