85 if (
not lhs.is_valid())
87 if (
not rhs.is_valid())
89 if (lhs.file_id != rhs.file_id)
92 lhs.begin < rhs.begin ? lhs.begin : rhs.begin,
93 lhs.end > rhs.end ? lhs.end : rhs.end};
201 return "Integer_Literal";
203 return "String_Literal";
205 return "Char_Literal";
207 return "Bool_Literal";
334 void (*destroy)(
void *)
noexcept =
nullptr;
379 template <
typename T,
typename...
Args>
386 [](
void *raw)
noexcept
388 static_cast<T *
>(raw)->~
T();
403 for (
size_t i = owned_.
size(); i > 0; --i)
405 auto &[ptr, destroy] = owned_.
access(i - 1);
406 if (destroy !=
nullptr and ptr !=
nullptr)
549 res != nullptr ?
res->span
552 keyword_span(
kw), parameters(), lparen_span(
lparen), rparen_span(
rparen),
569 std::string imported =
"",
592 std::string imported =
"",
634 std::string
value =
"",
659 std::string
value =
"",
670 : (target != nullptr ? target->span
672 equal_span(
eq_sp), aliased_type(target), semicolon_span(
semi_sp)
685 std::string
value =
"",
709 std::string
value =
"",
759 bool bool_value =
false;
763 std::string
value =
"",
765 const bool bool_val =
false)
noexcept
833 op(
op_kind), operator_span(
op_sp), left(lhs), right(rhs)
881 expr(
value), semicolon_span(semi)
901 std::string
value =
"",
910 semi.is_valid() ? semi
936 kw, semi.is_valid() ? semi : (expr != nullptr ? expr->span :
Source_Span()))),
937 keyword_span(
kw),
value(expr), semicolon_span(semi)
982 : (cond != nullptr ? cond->span :
else_kw)))),
1006 : (cond != nullptr ? cond->span :
Source_Span()))),
1007 keyword_span(
kw), condition(cond), body(stmt)
1023 semicolon_span(semi)
1039 semicolon_span(semi)
1068 std::string
value =
"",
1100namespace Compiler_Ast_Detail {
1107 for (
const char ch : text)
1135 if (type ==
nullptr)
1137 out <<
"<null-type>";
1143 case Compiler_Type_Expr_Kind::Invalid:
1144 out <<
"InvalidType";
1147 case Compiler_Type_Expr_Kind::Named:
1151 case Compiler_Type_Expr_Kind::Tuple:
1155 for (
size_t i = 0; i < node->members.size(); ++i)
1165 case Compiler_Type_Expr_Kind::Function:
1169 for (
size_t i = 0; i < node->parameters.size(); ++i)
1181 out <<
"<unknown-type>";
1187 out << std::string(indent,
' ');
1194inline void dump_expr(
const Compiler_Expr *expr, std::ostream &
out,
const size_t indent);
1197inline void dump_stmt(
const Compiler_Stmt *stmt, std::ostream &
out,
const size_t indent);
1202 if (expr ==
nullptr)
1204 out <<
"<null-expr>\n";
1210 case Compiler_Expr_Kind::Invalid:
1211 out <<
"InvalidExpr\n";
1213 case Compiler_Expr_Kind::Identifier:
1216 out <<
"Identifier(" << node->
name <<
")\n";
1219 case Compiler_Expr_Kind::Integer_Literal:
1222 out <<
"Integer(" << node->
lexeme <<
")\n";
1225 case Compiler_Expr_Kind::String_Literal:
1231 case Compiler_Expr_Kind::Char_Literal:
1237 case Compiler_Expr_Kind::Bool_Literal:
1240 out <<
"Bool(" << (node->bool_value ?
"true" :
"false") <<
")\n";
1243 case Compiler_Expr_Kind::Grouping:
1246 out <<
"Grouping\n";
1250 case Compiler_Expr_Kind::Unary:
1257 case Compiler_Expr_Kind::Binary:
1265 case Compiler_Expr_Kind::Call:
1274 for (
size_t i = 0; i < node->arguments.size(); ++i)
1284 if (stmt ==
nullptr)
1286 out <<
"<null-stmt>\n";
1292 case Compiler_Stmt_Kind::Invalid:
1293 out <<
"InvalidStmt\n";
1295 case Compiler_Stmt_Kind::Expr:
1298 out <<
"ExprStmt\n";
1302 case Compiler_Stmt_Kind::Let:
1305 out <<
"Let(" << node->
name <<
")";
1306 if (node->annotation !=
nullptr)
1312 if (node->initializer !=
nullptr)
1316 case Compiler_Stmt_Kind::Return:
1320 if (node->value !=
nullptr)
1324 case Compiler_Stmt_Kind::Block:
1328 for (
size_t i = 0; i < node->statements.size(); ++i)
1329 dump_stmt(node->statements.access(i),
out, indent + 2);
1332 case Compiler_Stmt_Kind::If:
1337 out <<
"Condition:\n";
1342 if (node->else_branch !=
nullptr)
1350 case Compiler_Stmt_Kind::While:
1355 out <<
"Condition:\n";
1362 case Compiler_Stmt_Kind::Break:
1365 case Compiler_Stmt_Kind::Continue:
1366 out <<
"Continue\n";
1373 const size_t indent)
1376 if (
decl ==
nullptr)
1378 out <<
"<null-import-decl>\n";
1384 case Compiler_Import_Decl_Kind::Invalid:
1385 out <<
"InvalidImportDecl\n";
1388 case Compiler_Import_Decl_Kind::Import:
1400 if (
decl ==
nullptr)
1402 out <<
"<null-type-decl>\n";
1408 case Compiler_Type_Decl_Kind::Invalid:
1409 out <<
"InvalidTypeDecl\n";
1412 case Compiler_Type_Decl_Kind::Alias:
1415 out <<
"TypeAlias(" << node->
name <<
") = ";
1421 case Compiler_Type_Decl_Kind::Struct:
1424 out <<
"Struct(" << node->
name <<
")\n";
1425 for (
size_t i = 0; i < node->fields.size(); ++i)
1428 out <<
"Field(" << node->fields.access(i).name <<
"): ";
1435 case Compiler_Type_Decl_Kind::Enum:
1438 out <<
"Enum(" << node->
name <<
")\n";
1439 for (
size_t i = 0; i < node->variants.size(); ++i)
1442 out <<
"Variant(" << node->variants.access(i).name <<
")\n";
1459 std::ostringstream
out;
1473 std::ostringstream
out;
1487 std::ostringstream
out;
1501 std::ostringstream
out;
1515 std::ostringstream
out;
1517 return "<null-function>\n";
1519 out <<
"Function(" <<
fn->name <<
")\n";
1520 if (
fn->parameters.size() > 0)
1523 for (
size_t i = 0; i <
fn->parameters.size(); ++i)
1527 out <<
" " <<
fn->parameters.access(i).name;
1528 if (
fn->parameters.access(i).annotation !=
nullptr)
1537 out <<
" Params:\n";
1539 if (
fn->return_annotation !=
nullptr)
1560 std::ostringstream
out;
1561 if (module ==
nullptr)
1562 return "<null-module>\n";
1565 for (
size_t i = 0; i <
module->imports.size(); ++i)
1568 for (
size_t i = 0; i <
module->type_declarations.size(); ++i)
1571 for (
size_t i = 0; i <
module->functions.size(); ++i)
1573 const auto *
fn =
module->functions.access(i);
1577 out <<
"Function(null)\n";
1580 out <<
"Function(" <<
fn->name <<
")\n";
1581 if (
fn->parameters.size() > 0)
1585 for (
size_t j = 0; j <
fn->parameters.size(); ++j)
1589 out <<
" " <<
fn->parameters.access(j).name;
1590 if (
fn->parameters.access(j).annotation !=
nullptr)
1604 if (
fn->return_annotation !=
nullptr)
1617 for (
size_t i = 0; i <
module->statements.size(); ++i)
Token model and parser-facing metadata for compiler front-ends.
Memory arena for fast bulk allocations.
Exception handling system with formatted messages for Aleph-w.
#define ah_runtime_error_unless(C)
Throws std::runtime_error if condition does NOT hold.
size_t size_t int32_t value
size_t size_t int32_t * out
Arena allocator for fast bump-pointer allocation.
void reset() noexcept
Reset arena, making all memory available again.
size_t capacity() const noexcept
Get total arena capacity.
size_t allocated_size() const noexcept
Get total bytes currently allocated.
static constexpr size_t DEFAULT_SIZE
Default arena size (1 MB).
Arena-backed ownership context for AST nodes.
size_t capacity() const noexcept
Returns the total capacity of the arena.
size_t allocated_size() const noexcept
Returns the total bytes currently used in the arena.
Compiler_Ast_Context(const size_t arena_size=AhArenaAllocator::DEFAULT_SIZE)
Constructs a context with the specified arena capacity.
Compiler_Ast_Context & operator=(const Compiler_Ast_Context &)=delete
T * make(Args &&...args)
Allocates and constructs an AST node of type T.
void reset() noexcept
Reclaims all memory and destroys managed nodes.
DynArray< Owned_Object > owned_
Tracked objects for destruction.
~Compiler_Ast_Context() noexcept
Destroys the context and all managed nodes.
AhArenaAllocator arena_
Underlying memory arena.
Compiler_Ast_Context(const Compiler_Ast_Context &)=delete
void clear() noexcept
Empties the container.
size_t size() const noexcept
Return the current dimension of array.
T & access(const size_t i) const noexcept
Fast access without checking allocation and bound_min_clock checking.
T & append()
Allocate a new entry to the end of array.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
void append_indent(std::ostream &out, const size_t indent)
Utility to append spaces to a stream for indentation.
void dump_type_decl(const Compiler_Type_Decl *decl, std::ostream &out, const size_t indent)
Recursive type-declaration printer for internal use.
void dump_type_expr(const Compiler_Type_Expr *type, std::ostream &out)
Dumps one parsed type-expression in a compact stable form.
void dump_expr(const Compiler_Expr *expr, std::ostream &out, const size_t indent)
Recursive expression printer for internal use.
std::string escape_text(std::string_view text)
Escapes control characters in a string for safe text output.
void dump_stmt(const Compiler_Stmt *stmt, std::ostream &out, const size_t indent)
Recursive statement printer for internal use.
void dump_import_decl(const Compiler_Import_Decl *decl, std::ostream &out, const size_t indent)
Compiler_SSA_Block & block(Compiler_SSA_Function &function, const Compiler_SSA_Block_Id id)
Main namespace for Aleph-w library functions.
std::string compiler_dump_module(const Compiler_Module *module)
Dumps a parsed module in a deterministic text format.
Compiler_Expr_Kind
Enumeration of expression node kinds.
@ Grouping
Parenthesized expression.
@ Unary
Prefix unary operation (e.g., -x, !p).
@ Identifier
Variable or function name reference.
@ Integer_Literal
Numeric integer constant.
@ Invalid
Placeholder for malformed expressions.
@ Char_Literal
Character constant.
@ Binary
Infix binary operation (e.g., x + y).
@ Call
Function or method call.
@ String_Literal
String constant.
@ Bool_Literal
Boolean constant (true/false).
const char * compiler_token_kind_name(Compiler_Token_Kind kind)
Returns a human-readable name for a token kind.
@ Binary
dst <- op(lhs, rhs)
@ Return
Return one register value.
@ Call
dst <- callee(args...)
Source_Span compiler_merge_spans(const Source_Span &lhs, const Source_Span &rhs) noexcept
Merges two spans from the same source file.
std::string compiler_dump_type_decl(const Compiler_Type_Decl *decl)
Dumps a type declaration subtree in a deterministic text format.
@ Invalid
Uninitialized register/slot or explicit invalid placeholder.
Compiler_Import_Decl_Kind
Enumeration of top-level import declaration node kinds.
@ Import
One concrete import "name"; declaration.
std::string compiler_dump_expr(const Compiler_Expr *expr)
Dumps an expression subtree in a deterministic text format.
Compiler_Stmt_Kind
Enumeration of statement node kinds.
@ While
Loop while a condition is true.
@ Invalid
Placeholder for malformed statements.
@ Expr
Expression evaluated for side effects (e.g., assignment, call).
@ If
Conditional execution.
@ Return
Exit current function with an optional value.
@ Continue
Skip to the next iteration of the innermost loop.
@ Let
Variable declaration and optional initialization.
@ Block
Scoped sequence of statements.
@ Break
Immediate exit from the innermost loop.
Compiler_Type_Decl_Kind
Enumeration of top-level type declaration node kinds.
@ Invalid
Placeholder for malformed type declarations.
@ Struct
Nominal struct declaration.
@ Enum
Nominal enum declaration.
@ Alias
Transparent type alias declaration.
std::string compiler_dump_function(const Compiler_Function_Decl *fn)
Dumps a function declaration in a deterministic text format.
const char * compiler_type_decl_kind_name(const Compiler_Type_Decl_Kind kind) noexcept
Returns a stable debug name for a type-declaration kind.
and
Check uniqueness with explicit hash + equality functors.
std::decay_t< typename HeadC::Item_Type > T
const char * compiler_stmt_kind_name(const Compiler_Stmt_Kind kind) noexcept
Returns a stable debug name for a statement kind.
const char * compiler_expr_kind_name(const Compiler_Expr_Kind kind) noexcept
Returns a stable debug name for an expression kind.
Compiler_Token_Kind
Token kinds supported by the compiler MVP.
std::string compiler_dump_stmt(const Compiler_Stmt *stmt)
Dumps a statement subtree in a deterministic text format.
static std::atomic< bool > init
Compiler_Type_Expr_Kind
Enumeration of parsed type-expression node kinds.
@ Named
Named type such as Int or T.
@ Invalid
Placeholder for malformed type syntax.
@ Function
Function type such as fn(Int) -> Bool.
@ Tuple
Tuple type such as (Int, Bool).
std::string compiler_dump_import_decl(const Compiler_Import_Decl *decl)
Dumps an import declaration subtree in a deterministic text format.
const char * compiler_type_expr_kind_name(const Compiler_Type_Expr_Kind kind) noexcept
Returns a stable debug name for a type-expression kind.
Internal tracking for objects with destructors.
Abstract base class for all AST nodes.
Compiler_Ast_Node(const Source_Span &sp={}) noexcept
Constructs a node with an optional span.
Source_Span span
Source region covered by this node.
virtual ~Compiler_Ast_Node() noexcept=default
Virtual destructor to ensure proper cleanup of derived nodes.
Node representing an infix binary operation.
Source_Span operator_span
Location of the operator token.
Compiler_Binary_Expr(Compiler_Expr *lhs=nullptr, const Compiler_Token_Kind op_kind=Compiler_Token_Kind::Invalid, const Source_Span &op_sp={}, Compiler_Expr *rhs=nullptr) noexcept
Constructs a binary expression.
Node representing a braced sequence of statements.
Source_Span rbrace_span
Location of the closing ‘’}'`.
Source_Span lbrace_span
Location of the opening ‘’{'`.
Compiler_Block_Stmt(const Source_Span &lbrace={}, const Source_Span &rbrace={}) noexcept
Constructs a block statement.
DynArray< Compiler_Stmt * > statements
Sequential statements in the block.
Node representing a loop break.
Compiler_Break_Stmt(const Source_Span &kw={}, const Source_Span &semi={}) noexcept
Constructs a break statement.
Source_Span semicolon_span
Location of the trailing ‘’;'`.
Source_Span keyword_span
Location of the break keyword.
Node representing a function or method call.
DynArray< Compiler_Expr * > arguments
list of call arguments.
Compiler_Call_Expr(Compiler_Expr *func=nullptr, const Source_Span &lparen={}, const Source_Span &rparen={}) noexcept
Constructs a call expression.
Source_Span lparen_span
Location of ‘’('`.
Source_Span rparen_span
Location of ‘’)'`.
Node representing a loop continuation.
Source_Span keyword_span
Location of the continue keyword.
Source_Span semicolon_span
Location of the trailing ‘’;'`.
Compiler_Continue_Stmt(const Source_Span &kw={}, const Source_Span &semi={}) noexcept
Constructs a continue statement.
Nominal top-level enum declaration with unit variants.
DynArray< Compiler_Enum_Variant > variants
Declared unit variants in source order.
Source_Span lbrace_span
Span of the opening {.
Source_Span rbrace_span
Span of the closing }.
Compiler_Enum_Decl(const Source_Span &kw={}, std::string value="", const Source_Span &name_sp={}, const Source_Span &lbrace_sp={}, const Source_Span &rbrace_sp={}) noexcept
Constructs one enum declaration.
One named variant inside a parsed enum declaration.
std::string name
Variant name.
Source_Span name_span
Span of the variant name.
Node representing an expression evaluated as a statement.
Source_Span semicolon_span
Location of the trailing ‘’;'`.
Compiler_Expr_Stmt(Compiler_Expr *value=nullptr, const Source_Span &semi={}) noexcept
Constructs an expression statement.
Abstract base class for expression nodes.
Compiler_Expr_Kind kind
Specific expression type.
Compiler_Expr(const Compiler_Expr_Kind k=Compiler_Expr_Kind::Invalid, const Source_Span &sp={}) noexcept
Constructs an expression base.
Node representing a top-level function declaration.
Source_Span name_span
Location of the function name token.
std::string name
Function name.
DynArray< Compiler_Param > parameters
Ordered list of parameters.
Compiler_Function_Decl(const Source_Span &kw={}, std::string value="", const Source_Span &name_sp={}, const Source_Span &arrow_sp={}, Compiler_Type_Expr *result_annot=nullptr, Compiler_Block_Stmt *block=nullptr) noexcept
Constructs a function declaration.
Source_Span keyword_span
Location of the fn keyword.
Source_Span arrow_span
Location of the optional -> before the result annotation.
Function type syntax such as fn(Int, T) -> Bool.
Source_Span arrow_span
Span of the -> token.
Source_Span rparen_span
Span of the closing ).
Compiler_Function_Type_Expr(const Source_Span &kw={}, const Source_Span &lparen={}, const Source_Span &rparen={}, const Source_Span &arrow={}, Compiler_Type_Expr *res=nullptr) noexcept
Constructs a function type-expression node.
Source_Span lparen_span
Span of the opening (.
DynArray< Compiler_Type_Expr * > parameters
Parameter types in declaration order.
Source_Span keyword_span
Span of the fn keyword.
Node representing an expression explicitly wrapped in parentheses.
Source_Span rparen_span
Location of the closing ‘’)'`.
Compiler_Grouping_Expr(Compiler_Expr *expr=nullptr, const Source_Span &lparen={}, const Source_Span &rparen={}) noexcept
Constructs a grouping expression.
Source_Span lparen_span
Location of the opening ‘’('`.
Node representing a named identifier reference.
std::string name
Name of the identifier.
Compiler_Identifier_Expr(std::string value="", const Source_Span &sp={}) noexcept
Constructs an identifier reference.
Source_Span name_span
Span covering only the name lexeme.
Node representing a conditional branch.
Source_Span else_span
Location of the else keyword (if present).
Source_Span if_span
Location of the if keyword.
Compiler_If_Stmt(const Source_Span &if_kw={}, Compiler_Expr *cond=nullptr, Compiler_Stmt *then_stmt=nullptr, const Source_Span &else_kw={}, Compiler_Stmt *else_stmt=nullptr) noexcept
Constructs an if-else statement.
Abstract base class for top-level import declarations.
Source_Span module_name_span
Span of the imported string literal.
Source_Span keyword_span
Span of the introducing import keyword.
Compiler_Import_Decl(const Compiler_Import_Decl_Kind k=Compiler_Import_Decl_Kind::Invalid, const Source_Span &kw={}, std::string imported="", const Source_Span &module_sp={}, const Source_Span &semi_sp={}, const Source_Span &sp={}) noexcept
Constructs an import-declaration base node.
Source_Span semicolon_span
Span of the trailing ;.
std::string module_name
Imported source name without surrounding quotes.
Placeholder node for expressions that failed to parse.
Compiler_Invalid_Expr(const Source_Span &sp={}) noexcept
Constructs an invalid expression sentinel.
Placeholder node for malformed import declarations.
Compiler_Invalid_Import_Decl(const Source_Span &sp={}) noexcept
Constructs an invalid import-declaration sentinel.
Placeholder node for statements that failed to parse.
Compiler_Invalid_Stmt(const Source_Span &sp={}) noexcept
Constructs an invalid statement sentinel.
Placeholder node for malformed type declarations.
Compiler_Invalid_Type_Decl(const Source_Span &sp={}) noexcept
Constructs an invalid type-declaration sentinel.
Placeholder node for type syntax that failed to parse.
Compiler_Invalid_Type_Expr(const Source_Span &sp={}) noexcept
Constructs an invalid type-expression sentinel.
Node representing a local variable binding.
Compiler_Let_Stmt(const Source_Span &kw={}, std::string value="", const Source_Span &name_sp={}, const Source_Span &colon_sp={}, Compiler_Type_Expr *annot=nullptr, Compiler_Expr *init=nullptr, const Source_Span &semi={}) noexcept
Constructs a variable binding statement.
std::string name
Name of the bound variable.
Source_Span keyword_span
Location of the let keyword.
Source_Span name_span
Location of the variable name.
Source_Span semicolon_span
Location of the trailing ‘’;'`.
Source_Span colon_span
Location of the optional : before the type annotation.
Node representing a literal value.
Compiler_Literal_Expr(const Compiler_Expr_Kind k=Compiler_Expr_Kind::Invalid, std::string value="", const Source_Span &sp={}, const bool bool_val=false) noexcept
Constructs a literal expression.
std::string lexeme
Raw source spelling of the literal.
Node representing a complete translation unit or module.
std::string source_name
User-facing source name that produced the module.
DynArray< Compiler_Type_Decl * > type_declarations
Top-level type declarations.
Compiler_Module(const Source_Span &sp={}) noexcept
Constructs a module node.
DynArray< Compiler_Stmt * > statements
Optional top-level code.
DynArray< Compiler_Import_Decl * > imports
Top-level import declarations.
DynArray< Compiler_Function_Decl * > functions
Top-level function definitions.
Named type syntax such as Int, Bool, or T.
Source_Span name_span
Span covering only the name token.
std::string name
Raw type-name spelling.
Compiler_Named_Type_Expr(std::string value="", const Source_Span &sp={}) noexcept
Constructs a named type-expression node.
Representation of a function parameter.
Source_Span span
Location in the source.
Source_Span colon_span
Location of the optional : before the annotation.
std::string name
Parameter identifier.
Node representing a return from the current function.
Source_Span semicolon_span
Location of the trailing ‘’;'`.
Source_Span keyword_span
Location of the return keyword.
Compiler_Return_Stmt(const Source_Span &kw={}, Compiler_Expr *expr=nullptr, const Source_Span &semi={}) noexcept
Constructs a return statement.
Top-level import declaration naming one other source unit.
Compiler_Source_Import_Decl(const Source_Span &kw={}, std::string imported="", const Source_Span &module_sp={}, const Source_Span &semi_sp={}) noexcept
Constructs one import "name"; declaration.
Abstract base class for statement nodes.
Compiler_Stmt(const Compiler_Stmt_Kind k=Compiler_Stmt_Kind::Invalid, const Source_Span &sp={}) noexcept
Constructs a statement base.
Compiler_Stmt_Kind kind
Specific statement type.
Nominal top-level struct declaration.
Source_Span rbrace_span
Span of the closing }.
Source_Span lbrace_span
Span of the opening {.
Compiler_Struct_Decl(const Source_Span &kw={}, std::string value="", const Source_Span &name_sp={}, const Source_Span &lbrace_sp={}, const Source_Span &rbrace_sp={}) noexcept
Constructs one struct declaration.
DynArray< Compiler_Struct_Field > fields
Declared fields in source order.
One named field inside a parsed struct declaration.
std::string name
Field name.
Source_Span name_span
Span of the field name.
Source_Span colon_span
Span of the separating :.
Source_Span semicolon_span
Span of the trailing ;.
Tuple type syntax such as (Int, Bool).
Compiler_Tuple_Type_Expr(const Source_Span &lparen={}, const Source_Span &rparen={}) noexcept
Constructs a tuple type-expression node.
DynArray< Compiler_Type_Expr * > members
Tuple element types in source order.
Source_Span rparen_span
Span of the closing ).
Source_Span lparen_span
Span of the opening (.
Transparent top-level type alias declaration.
Source_Span semicolon_span
Span of the trailing ;.
Compiler_Type_Alias_Decl(const Source_Span &kw={}, std::string value="", const Source_Span &name_sp={}, const Source_Span &eq_sp={}, Compiler_Type_Expr *target=nullptr, const Source_Span &semi_sp={}) noexcept
Constructs one type alias declaration.
Source_Span equal_span
Span of the separating =.
Abstract base class for top-level type declarations.
Source_Span keyword_span
Span of the introducing keyword.
Source_Span name_span
Span of the declared type name.
std::string name
Declared type name.
Compiler_Type_Decl(const Compiler_Type_Decl_Kind k=Compiler_Type_Decl_Kind::Invalid, const Source_Span &kw={}, std::string value="", const Source_Span &name_sp={}, const Source_Span &sp={}) noexcept
Constructs a type-declaration base node.
Abstract base class for parsed type-annotation syntax.
Compiler_Type_Expr(const Compiler_Type_Expr_Kind k=Compiler_Type_Expr_Kind::Invalid, const Source_Span &sp={}) noexcept
Constructs a type-expression base node.
Compiler_Type_Expr_Kind kind
Specific type-expression variant.
Node representing a prefix unary operation.
Compiler_Unary_Expr(const Compiler_Token_Kind op_kind=Compiler_Token_Kind::Invalid, const Source_Span &op_sp={}, Compiler_Expr *expr=nullptr) noexcept
Constructs a unary expression.
Source_Span operator_span
Location of the operator token.
Node representing a while-loop.
Source_Span keyword_span
Location of the while keyword.
Compiler_While_Stmt(const Source_Span &kw={}, Compiler_Expr *cond=nullptr, Compiler_Stmt *stmt=nullptr) noexcept
Constructs a while statement.
Half-open byte range inside a source file.
Source_File_Id file_id
Stable file identifier; 0 means invalid.
Lazy and scalable dynamic array implementation.