Classes | |
| class | AliasDecl |
| anx dbg = path; - a compiler-exposed alias sharing its target's annex slot. More... | |
| class | AliasPtrn |
| ptrn as dbg More... | |
| struct | AnnexInfo |
| Bookkeeping of an annex introduced by an AxmDecl. More... | |
| class | AppExpr |
| callee arg More... | |
| class | AST |
| Owns the arena all AST nodes live in as well as the AnnexInfos of all plugins. More... | |
| class | AxmDecl |
| axm dbg: type, normalizer, curry, trip; or a family axm (name, ...): type, normalizer, curry, trip;. More... | |
| struct | Bind |
| One name in a Scope: the Decl it introduces and the Vis of this binding. More... | |
| class | Decl |
| Base class of all declarations; caches the emitted Decl::def. More... | |
| class | DeclExpr |
| decls expr or expr where decls if DeclExpr::is_where. More... | |
| class | DummyDecl |
| class | Emitter |
| class | ErrorExpr |
| Erroneous expression. More... | |
| class | ErrorPtrn |
| Erroneous pattern. More... | |
| class | Expr |
| Base class of all expressions. More... | |
| class | File |
| The AST of one source file: an anonymous ModDecl that a UseDecl binds under a name of its own. More... | |
| class | GrpPtrn |
| dbg_i of a group dbg_0 ... dbg_n-1: type for i > 0; the leading IdPtrn::id owns type. More... | |
| class | HoleExpr |
| ? More... | |
| class | IdDecl |
| dbg bound to a Def whose type the binding construct dictates; hence, it carries no annotation. More... | |
| class | IdPtrn |
| dbg: type More... | |
| class | InfixExpr |
| lhs op rhs; InfixExpr::op picks the meaning - see MIM_INFIX. More... | |
| class | LamDecl |
| tag dbg dom_0 ... dom_n-1: codom = body; with LamDecl::tag lam/con/fun or anonymous λ/cn/fn. More... | |
| class | LamExpr |
| Wraps a LamDecl as Expr. More... | |
| class | LetDecl |
| let ptrn = value; More... | |
| class | Lexer |
| class | LitExpr |
| tok:type More... | |
| class | MatchExpr |
| match scrutinee with | arm_0 | ... | arm_n-1 More... | |
| class | ModDecl |
| mod dbg decls end; also the base of the anonymous File. More... | |
| struct | Mods |
| Raw, unvalidated combination of priv/pub/extern/anx modifiers written before a declaration. More... | |
| class | MutualDecl |
| mutual decl* end groups RecDecls that may refer to each other. More... | |
| class | Node |
| Base class of all AST nodes. More... | |
| class | NomDecl |
| nom dbg = body; - a nominal newtype. More... | |
| class | Parser |
| Parses Mim code as AST. More... | |
| class | Path |
| dbg_0.....dbg_n-1. More... | |
| class | PathExpr |
| path More... | |
| class | PiExpr |
| dom → codom, Cn dom, or Fn dom → codom depending on PiExpr::tag. More... | |
| class | PrefixExpr |
| op rhs; PrefixExpr::op picks the meaning - see MIM_PREFIX. More... | |
| class | PrimaryExpr |
| tag More... | |
| class | Ptrn |
| Base class of all patterns. More... | |
| struct | R |
| class | RecDecl |
| rec dbg = body; More... | |
| class | RetExpr |
| ret ptrn = callee $ arg; body More... | |
| class | RuleDecl |
| rule dbg var: lhs when guard => rhs; or norm instead of rule if RuleDecl::is_normalizer. More... | |
| class | RuleExpr |
| Rule dom More... | |
| struct | S |
| class | Scopes |
| class | SeqExpr |
| «index: shape; body» or ‹index: shape; body› if SeqExpr::is_pack; index: is optional. More... | |
| class | SigmaExpr |
| Wraps a TuplePtrn as Expr. More... | |
| class | SingleExpr |
| «body» or ‹body› if SingleExpr::is_wrap. More... | |
| class | Tok |
| class | TupleExpr |
| (elem_0, ..., elem_n-1) More... | |
| class | TuplePtrn |
| (ptrn_0, ..., ptrn_n-1), [ptrn_0, ..., ptrn_n-1], or {ptrn_0, ..., ptrn_n-1} More... | |
| class | TypeExpr |
| Type level More... | |
| class | UseDecl |
| import "file"|name [as alias|*];, plugin name [as alias|*];, or use path [as alias|*]; as * splices instead of naming; a use without an as is sugar for as *. More... | |
| class | ValDecl |
| Base class of all declarations that bind values. More... | |
| class | VariantExpr |
| | ctor_0: type_0 | ... | ctor_n-1: type_n-1; a constructor without a type carries []. More... | |
Typedefs | |
| template<class T> | |
| using | Ptr = fe::Arena::Ref<const T> |
| Nodes live in the AST's Arena and are never destroyed, so this merely points at one. | |
| using | Scope = fe::SymMap<Bind> |
| Maps a name to the Binding introducing it. | |
| using | Tag = Tok::Tag |
Ptrs/Dbgs | |
Scratch buffers the Parser fills before it creates a node; a node keeps its own lists right behind itself - see fe::VLA - and hands them out as a fe::View. | |
| template<class T> | |
| using | Ptrs = fe::Vector<Ptr<T>> |
| using | Dbgs = fe::Vector<Dbg> |
Enumerations | |
| enum class | Vis { Priv , Pub } |
| Visibility tier of a ValDecl. More... | |
| enum class | Assoc { N , L , R } |
| Associativity of an infix expression. More... | |
| enum class | Prec |
| Expression precedences used by the parser and the dumper; ordered low to high. More... | |
Functions | |
| AST | load_plugins (World &, fe::View< std::string >) |
| AST | load_plugin (World &w, std::string_view plugin) |
| constexpr Assoc | prec_assoc (Prec p) |
Associativity of precedence level p. | |
| constexpr bool | is_rassoc (Prec p) |
| constexpr bool | should_reduce (Prec curr, Prec op) |
Should a Pratt parser reduce when the current binding power is curr and the infix operator has precedence op? | |
| static Sym | loc2plugin (AST &ast, Loc loc) |
| static void | add_names (AnnexInfo &annex, const Expr *type) |
Records the constructor or field names that type - the body of an annex declaration - spells out. | |
| static void | add_alias (AnnexInfo *annex, sub_t sub, Sym target, Sym alias) |
Registers alias as a further name of the annex slot target introduced. | |
| static bool | is_wildcard (const Ptrn *ptrn) |
| A wildcard binds nothing, so the Def it would name need not exist - and a dump would then have to name it. | |
| static const Def * | assign (Emitter &e, const Ptrn *ptrn, const Def *type, const Def *def) |
| static void | emit_var (Emitter &e, const Ptrn *ptrn, Def *mut) |
Binds ptrn to the Var of mut - which a wildcard does not create. | |
| static std::optional< nat_t > | isa_math_f (Emitter &e, const Def *type) |
If type is a math.F type of known precision/exponent, yields its bit width. | |
| static u64 | encode_f (Emitter &e, Loc loc, const Def *t, u64 bits) |
A float Tok stores its value as mim::f64 bits; re-encode them for the width of the annotated type t. | |
| static void | emit_union (Emitter &e, const Expr *expr, DefVec &types) |
| a ∪ b ∪ c is one n-ary Join, so flatten the left spine the left-associative parse built. | |
| static void | check_nom_scope (Emitter &e, Loc loc, const Nom *nom) |
| A private nom's representation is confined to the mod that declared it; the type itself is not. | |
| static void | open_nom (Emitter &e, Loc loc, const Nom *nom) |
Checks and prepares access to nom's representation. | |
| static const Def * | unwrap_field (Emitter &e, const InfixExpr *ex, const Def *tup) |
Unwraps tup if it is a value of a nom and ex names one of its fields; nullptr otherwise. | |
| static const Def * | emit_ctor (Emitter &e, const Variant *variant, const Expr *index, const Nom *nom=nullptr) |
| T#C or T#i selects case C or i of the Variant T: a constructor function - or its value for a [] payload. | |
| static Tok | negate (Tok tok) |
| Applies a leading - to a numeric literal Tok. | |
| static void | stream_decls (fe::Tab &tab, std::ostream &os, fe::View< Ptr< ValDecl > > decls) |
| static std::string | escape_char (char8_t c) |
| static std::string_view | vis2str (Vis vis) |
| static std::ostream & | operator<< (std::ostream &os, const Mods &mods) |
| Prints vis/extern/anx, skipping vis if it's the modifier-nudged Mods::default_vis. | |
| static bool | is_block (const Expr *expr) |
Does expr span several statements and hence deserve an indented block of its own? | |
std::ostream operator | |
| std::ostream & | operator<< (std::ostream &os, Tok tok) |
Variables | |
| constexpr size_t | Look_Ahead = 2 |
| constexpr auto | Num_Keys = size_t(0) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) |
| constexpr auto | Num_Subst = size_t(0) + size_t(1) + size_t(1) + size_t(1) |
| struct mim::ast::Bind |
| using mim::ast::Dbgs = fe::Vector<Dbg> |
| using mim::ast::Ptr = fe::Arena::Ref<const T> |
| using mim::ast::Ptrs = fe::Vector<Ptr<T>> |
| using mim::ast::Scope = fe::SymMap<Bind> |
| using mim::ast::Tag = Tok::Tag |
|
strong |
|
strong |
|
strong |
Visibility tier of a ValDecl.
Priv is only visible inside its enclosing mod; Pub is visible via a path/use from outside. Orthogonal to this, a ValDecl may independently be extern (Decl::is_extern) and/or anx (Decl::is_anx); either one nudges the default visibility to Pub unless priv is given explicitly.
| Enumerator | |
|---|---|
| Priv | |
| Pub | |
Registers alias as a further name of the annex slot target introduced.
Definition at line 403 of file bind.cpp.
References add_alias(), and mim::ast::AnnexInfo::subs.
Referenced by add_alias(), mim::ast::AliasDecl::bind(), and mim::ast::AxmDecl::bind().
Records the constructor or field names that type - the body of an annex declaration - spells out.
Definition at line 348 of file bind.cpp.
References add_names(), mim::ast::AnnexInfo::fields, and mim::ast::AnnexInfo::names.
Referenced by add_names(), and mim::ast::AST::name2annex().
|
static |
Definition at line 225 of file emit.cpp.
References assign(), mim::Check::coerce(), mim::ast::Decl::dbg(), mim::ast::Node::loc(), mim::Def::set(), and mim::type_of().
Referenced by assign(), mim::ast::GrpPtrn::emit_value(), and mim::ast::IdPtrn::emit_value().
A private nom's representation is confined to the mod that declared it; the type itself is not.
Definition at line 495 of file emit.cpp.
References check_nom_scope(), and mim::Def::loc().
Referenced by check_nom_scope(), mim::ast::InfixExpr::emit_(), and open_nom().
|
static |
T#C or T#i selects case C or i of the Variant T: a constructor function - or its value for a [] payload.
If nom is given, T is its body and the constructor yields nom.
Definition at line 545 of file emit.cpp.
References mim::Def::dbg(), mim::ast::Path::dbgs(), mim::ast::Expr::emit(), emit_ctor(), mim::Lit::isa(), mim::ast::Node::loc(), mim::Def::num_ops(), mim::Def::op(), and mim::ast::PathExpr::path().
Referenced by mim::ast::InfixExpr::emit_(), and emit_ctor().
a ∪ b ∪ c is one n-ary Join, so flatten the left spine the left-associative parse built.
Definition at line 466 of file emit.cpp.
References mim::ast::Expr::emit(), emit_union(), and mim::ast::InfixExpr::isa_op().
Referenced by mim::ast::InfixExpr::emit_(), and emit_union().
Binds ptrn to the Var of mut - which a wildcard does not create.
Definition at line 253 of file emit.cpp.
References mim::ast::Ptrn::emit_type(), mim::ast::Ptrn::emit_value(), emit_var(), is_wildcard(), and mim::Def::var().
Referenced by mim::ast::PiExpr::Dom::emit_type(), mim::ast::LamDecl::Dom::emit_value(), and emit_var().
A float Tok stores its value as mim::f64 bits; re-encode them for the width of the annotated type t.
Definition at line 407 of file emit.cpp.
References encode_f(), and isa_math_f().
Referenced by mim::ast::LitExpr::emit_(), and encode_f().
|
static |
Definition at line 116 of file stream.cpp.
References mim::ast::Lexer::escape(), and escape_char().
Referenced by escape_char(), and mim::ast::LitExpr::stream().
|
static |
Does expr span several statements and hence deserve an indented block of its own?
Definition at line 347 of file stream.cpp.
References is_block().
Referenced by is_block(), and mim::ast::LamDecl::stream_().
|
constexpr |
Definition at line 68 of file tok.h.
References is_rassoc(), prec_assoc(), and R.
Referenced by is_rassoc(), and should_reduce().
|
static |
A wildcard binds nothing, so the Def it would name need not exist - and a dump would then have to name it.
Definition at line 216 of file emit.cpp.
References is_wildcard().
Referenced by mim::ast::Ptrn::emit_proj(), emit_var(), and is_wildcard().
If type is a math.F type of known precision/exponent, yields its bit width.
Note that libmim must not depend on the generated math plugin header, so lookup the Axm at runtime instead.
Definition at line 394 of file emit.cpp.
References mim::App::callee(), and isa_math_f().
Referenced by encode_f(), and isa_math_f().
Definition at line 1379 of file ast.h.
References load_plugin(), and load_plugins().
Referenced by load_plugin().
Definition at line 293 of file ast.cpp.
References mim::ast::AST::AST(), mim::Flags::bootstrap, mim::ast::File::compile(), mim::World::driver(), mim::Driver::flags(), load_plugins(), and mim::ast::Parser::Parser().
Referenced by load_plugin(), and load_plugins().
|
static |
Definition at line 343 of file bind.cpp.
References mim::ast::Node::loc(), and loc2plugin().
Referenced by mim::ast::AliasDecl::bind(), loc2plugin(), and mim::ast::AST::name2annex().
Applies a leading - to a numeric literal Tok.
Definition at line 405 of file parser.cpp.
References mim::ast::Tok::lit_i(), mim::ast::Tok::lit_u(), mim::ast::Tok::loc(), negate(), and mim::ast::Tok::tag().
Referenced by negate().
Checks and prepares access to nom's representation.
Definition at line 507 of file emit.cpp.
References check_nom_scope(), and open_nom().
Referenced by mim::ast::InfixExpr::emit_(), mim::ast::MatchExpr::emit_(), mim::ast::PrefixExpr::emit_(), open_nom(), and unwrap_field().
|
static |
Prints vis/extern/anx, skipping vis if it's the modifier-nudged Mods::default_vis.
Definition at line 247 of file stream.cpp.
References mim::ast::Mods::default_vis(), mim::ast::Mods::is_anx, mim::ast::Mods::is_extern, operator<<(), mim::ast::Mods::resolved_vis(), and vis2str().
| std::ostream & mim::ast::operator<< | ( | std::ostream & | os, |
| Tok | tok ) |
Definition at line 30 of file tok.cpp.
Referenced by operator<<().
Associativity of precedence level p.
Definition at line 58 of file tok.h.
References CODE, MIM_PREC, and prec_assoc().
Referenced by is_rassoc(), and prec_assoc().
Should a Pratt parser reduce when the current binding power is curr and the infix operator has precedence op?
Definition at line 72 of file tok.h.
References is_rassoc(), and should_reduce().
Referenced by should_reduce().
|
static |
Definition at line 263 of file stream.cpp.
References mim::ast::S::S(), and stream_decls().
Referenced by mim::ast::DeclExpr::stream(), mim::ast::File::stream(), mim::ast::ModDecl::stream(), and stream_decls().
Unwraps tup if it is a value of a nom and ex names one of its fields; nullptr otherwise.
Definition at line 513 of file emit.cpp.
References mim::Def::isa_type(), mim::ast::Node::loc(), open_nom(), mim::ast::InfixExpr::rhs(), and unwrap_field().
Referenced by mim::ast::InfixExpr::emit_(), and unwrap_field().
|
static |
Definition at line 238 of file stream.cpp.
References Priv, Pub, and vis2str().
Referenced by operator<<(), and vis2str().
|
constexpr |
Definition at line 126 of file tok.h.
Referenced by mim::ast::Tok::is_key().