MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
Loading...
Searching...
No Matches
types Namespace Reference

Enumerations

enum class  TokenType {
  TT_ID , TT_ARG , TT_SYM , TT_STR ,
  TT_NUM , TT_HEX , TT_NULL
}
 Classification of scanned tokens. More...
enum class  CharType {
  TT_CHAR , TT_DIGIT , TT_SYMBOL , TT_STRING ,
  TT_SINGLE , TT_SPACE , TT_NULL
}
 Classification of individual characters during lexing. More...
enum class  OperatorType {
  OP_INC , OP_DEC , OP_LSHIFT_ASSIGN , OP_RSHIFT_ASSIGN ,
  OP_PLUS_ASSIGN , OP_MINUS_ASSIGN , OP_MUL_ASSIGN , OP_DIV_ASSIGN ,
  OP_MOD_ASSIGN , OP_AND_ASSIGN , OP_OR_ASSIGN , OP_XOR_ASSIGN ,
  OP_LSHIFT , OP_RSHIFT , OP_EQ , OP_NEQ ,
  OP_LE , OP_GE , OP_AND_AND , OP_OR_OR ,
  OP_ARROW , OP_PLUS , OP_MINUS , OP_MUL ,
  OP_DIV , OP_MOD , OP_ASSIGN , OP_AND ,
  OP_OR , OP_XOR , OP_NOT , OP_LT ,
  OP_GT , OP_LPAREN , OP_RPAREN , OP_LBRACKET ,
  OP_RBRACKET , OP_LBRACE , OP_RBRACE , OP_COMMA ,
  OP_SEMICOLON , OP_COLON , OP_DOT , OP_QUESTION ,
  OP_HASH , OP_SCOPE , OP_TILDE , OP_DOLLAR ,
  OP_AT
}
 Enumeration of all recognised operator symbols. More...
enum class  KeywordType {
  KW_LET , KW_PROC , KW_DEFINE , KW_IF ,
  KW_ELSE , KW_SWITCH , KW_WHILE , KW_FOR ,
  KW_RETURN , KW_BREAK , KW_CONTINUE
}
 Keyword type enumeration. More...

Functions

void print_type_TokenType (std::ostream &out, const TokenType &tt)
 Print a TokenType name to a stream.
void print_type_CharType (std::ostream &out, const CharType &c)
 Print a CharType name to a stream.
std::optional< OperatorType > lookUp (const std::string &op)
 Look up an operator string and return its OperatorType.
std::optional< KeywordType > lookUp_Keyword (const std::string &op)
 Look up a keyword string and return its KeywordType.

Variables

std::vector< std::string > opName
 Human-readable display names indexed by OperatorType.
std::vector< std::string > opStrings
 Operator string representations indexed by OperatorType.
std::vector< std::string > kwStr {"let", "proc", "define", "if", "else", "switch", "while", "for", "return", "break", "continue"}
 Keyword string representations indexed by KeywordType.
std::vector< std::string > strTokenType {"Identifier", "Argument", "Symbols", "String", "Numeric", "Hex", "NULL"}
 string names of TokenType values
std::vector< std::string > sstrCharType
 string names of CharType values
std::vector< std::string > strCharType {"Characters", "Digits", "Symbols", "String", "Quote", "Space", "NULL"}

Enumeration Type Documentation

◆ CharType

enum class types::CharType
strong

Classification of individual characters during lexing.

Enumerator
TT_CHAR 

alphabetic character

TT_DIGIT 

digit character

TT_SYMBOL 

multi-char symbol start

TT_STRING 

string delimiter (quote)

TT_SINGLE 

single-char operator

TT_SPACE 

whitespace

TT_NULL 

unmapped / null

Definition at line 26 of file types.hpp.

◆ KeywordType

enum class types::KeywordType
strong

Keyword type enumeration.

Enumerator
KW_LET 

variable declaration

KW_PROC 

procedure/function

KW_DEFINE 

constant definition

KW_IF 

conditional

KW_ELSE 

else branch

KW_SWITCH 

switch/case

KW_WHILE 

while loop

KW_FOR 

for loop

KW_RETURN 

return statement

KW_BREAK 

break statement

KW_CONTINUE 

continue statement

Definition at line 196 of file types.hpp.

◆ OperatorType

enum class types::OperatorType
strong

Enumeration of all recognised operator symbols.

Enumerator
OP_INC 
OP_DEC 
OP_LSHIFT_ASSIGN 
OP_RSHIFT_ASSIGN 
OP_PLUS_ASSIGN 
OP_MINUS_ASSIGN 
OP_MUL_ASSIGN 
OP_DIV_ASSIGN 
OP_MOD_ASSIGN 
OP_AND_ASSIGN 
OP_OR_ASSIGN 
OP_XOR_ASSIGN 
OP_LSHIFT 
OP_RSHIFT 
OP_EQ 
OP_NEQ 
OP_LE 
OP_GE 
OP_AND_AND 
OP_OR_OR 
OP_ARROW 
OP_PLUS 
OP_MINUS 
OP_MUL 
OP_DIV 
OP_MOD 
OP_ASSIGN 
OP_AND 
OP_OR 
OP_XOR 
OP_NOT 
OP_LT 
OP_GT 
OP_LPAREN 
OP_RPAREN 
OP_LBRACKET 
OP_RBRACKET 
OP_LBRACE 
OP_RBRACE 
OP_COMMA 
OP_SEMICOLON 
OP_COLON 
OP_DOT 
OP_QUESTION 
OP_HASH 
OP_SCOPE 
OP_TILDE 
OP_DOLLAR 
OP_AT 

Definition at line 36 of file types.hpp.

◆ TokenType

enum class types::TokenType
strong

Classification of scanned tokens.

Enumerator
TT_ID 

identifier or keyword

TT_ARG 

argument token (e.g. $1)

TT_SYM 

symbol / operator token

TT_STR 

string literal

TT_NUM 

decimal numeric literal

TT_HEX 

hexadecimal numeric literal

TT_NULL 

sentinel / invalid token

Definition at line 16 of file types.hpp.

Function Documentation

◆ lookUp()

std::optional< OperatorType > types::lookUp ( const std::string & op)

Look up an operator string and return its OperatorType.

Parameters
opOperator string (e.g. "++", "<=")
Returns
The matching OperatorType, or nullopt if not found

Definition at line 25 of file types.cpp.

References opStrings.

◆ lookUp_Keyword()

std::optional< KeywordType > types::lookUp_Keyword ( const std::string & op)

Look up a keyword string and return its KeywordType.

Parameters
opKeyword string (e.g. "if", "while")
Returns
The matching KeywordType, or nullopt if not found

Definition at line 33 of file types.cpp.

References kwStr.

◆ print_type_CharType()

void types::print_type_CharType ( std::ostream & out,
const CharType & c )

Print a CharType name to a stream.

Parameters
outOutput stream
cCharacter type to print

Definition at line 19 of file types.cpp.

References strCharType.

◆ print_type_TokenType()

void types::print_type_TokenType ( std::ostream & out,
const TokenType & tt )

Print a TokenType name to a stream.

Parameters
outOutput stream
ttToken type to print

Definition at line 13 of file types.cpp.

References strTokenType.

Referenced by scan::token::Token< Ch, String >::print().

Variable Documentation

◆ kwStr

std::vector<std::string> types::kwStr {"let", "proc", "define", "if", "else", "switch", "while", "for", "return", "break", "continue"}
inline

Keyword string representations indexed by KeywordType.

Definition at line 210 of file types.hpp.

Referenced by lookUp_Keyword().

◆ opName

std::vector<std::string> types::opName
inline

Human-readable display names indexed by OperatorType.

Definition at line 89 of file types.hpp.

◆ opStrings

std::vector<std::string> types::opStrings
inline

Operator string representations indexed by OperatorType.

Definition at line 142 of file types.hpp.

Referenced by lookUp().

◆ sstrCharType

std::vector<std::string> types::sstrCharType
extern

string names of CharType values

◆ strCharType

std::vector<std::string> types::strCharType {"Characters", "Digits", "Symbols", "String", "Quote", "Space", "NULL"}

Definition at line 11 of file types.cpp.

Referenced by print_type_CharType().

◆ strTokenType

std::vector< std::string > types::strTokenType {"Identifier", "Argument", "Symbols", "String", "Numeric", "Hex", "NULL"}

string names of TokenType values

Definition at line 10 of file types.cpp.

Referenced by print_type_TokenType().