Owns the arena all AST nodes live in as well as the AnnexInfos of all plugins. More...
#include <mim/ast/ast.h>
Classes | |
| struct | ForeignAlias |
| An anx alias in one plugin for an annex of another, e.g. anx M = core.M; in mem. More... | |
| struct | Files |
Public Member Functions | |
| AST (const AST &)=delete | |
| AST (World &) | |
| AST (AST &&) | |
| ~AST () | |
| template<class T, class... Args> | |
| auto | ptr (Args &&... args) |
| The VLA ranges of a fe::VLA node come last, in the order its VLA_Types declares them. | |
| template<class R, class T = std::ranges::range_value_t<R>> | |
| fe::View< T > | copy (const R &range) |
An Arena-allocated copy of range - for the few lists that do not sit behind a node. | |
| Scope & | scope () |
| A fresh Scope for a ModDecl; owned here, as an AST node never runs a destructor. | |
Getters | |
| World & | world () const |
| Driver & | driver () const |
| Error & | error () const |
Sym | |
| Sym | sym (const char *s) |
| Sym | sym (std::string_view s) |
| Sym | sym (const std::string &s) |
| Sym | sym_return () |
| "return". | |
| Sym | sym_error () |
| "_error_". | |
Manage Files | |
| std::pair< Ptr< File > &, bool > | file (const fe::Src *src) |
Manage Annex | |
| AnnexInfo * | name2annex (Scopes &s, Dbg dbg, sub_t *sub_id, const Expr *type=nullptr) |
| const auto & | plugin2annexes (Sym plugin) |
| void | add_foreign_alias (Sym plugin, ForeignAlias alias) |
| const auto & | plugin2foreign_aliases (Sym plugin) |
bootstrap | |
| void | bootstrap (Sym plugin, std::ostream &h) |
| void | bootstrap_py (Sym plugin, std::ostream &h) |
Friends | |
| void | swap (AST &a1, AST &a2) noexcept |
| struct mim::ast::AST::ForeignAlias |
|
delete |
References AST().
Referenced by AST(), AST(), mim::ast::load_plugins(), and swap.
| mim::ast::AST::AST | ( | AST && | other | ) |
|
default |
|
inline |
| void mim::ast::AST::bootstrap | ( | Sym | plugin, |
| std::ostream & | h ) |
Definition at line 66 of file ast.cpp.
References mim::Annex::mangle(), plugin2annexes(), plugin2foreign_aliases(), and sym().
| void mim::ast::AST::bootstrap_py | ( | Sym | plugin, |
| std::ostream & | h ) |
Definition at line 202 of file ast.cpp.
References mim::Annex::mangle(), plugin2annexes(), plugin2foreign_aliases(), and sym().
|
inline |
Definition at line 117 of file ast.h.
References mim::World::driver(), and world().
Referenced by mim::ast::Parser::driver(), error(), sym(), sym(), and sym().
|
inline |
Definition at line 118 of file ast.h.
References driver().
Referenced by mim::ast::Scopes::error(), and name2annex().
The slot of src and whether it is fresh; a fresh slot is nullptr until the caller fills it in. A nullptr slot that is not fresh is a file still being parsed further up the stack.
Definition at line 25 of file ast.cpp.
Referenced by mim::ast::Parser::import().
| AnnexInfo * mim::ast::AST::name2annex | ( | Scopes & | s, |
| Dbg | dbg, | ||
| sub_t * | sub_id, | ||
| const Expr * | type = nullptr ) |
Registers dbg as an annex, deriving plugin/tag/sub from dbg's source file and s's current mod-nesting (Scopes::mod_depth/Scopes::enclosing_mod); sub_id receives dbg's sub index within its tag. nullptr if dbg is anonymous or nests more than one mod deep. type, if given, is the declared body whose constructor or field names become AnnexInfo::names.
Definition at line 359 of file bind.cpp.
References mim::ast::add_names(), error(), mim::ast::loc2plugin(), mim::Annex::mangle(), and sym_error().
|
inline |
Definition at line 161 of file ast.h.
Referenced by bootstrap(), and bootstrap_py().
|
inline |
Definition at line 170 of file ast.h.
Referenced by bootstrap(), and bootstrap_py().
|
inline |
|
inline |
|
inline |
Definition at line 123 of file ast.h.
References driver().
Referenced by bootstrap(), bootstrap_py(), sym_error(), and sym_return().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |