MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
ast.h File Reference
#include <deque>
#include <memory>
#include <tuple>
#include <fe/arena.h>
#include <fe/assert.h>
#include <fe/cast.h>
#include <fe/vla.h>
#include "mim/driver.h"
#include "mim/ast/tok.h"
Include dependency graph for ast.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mim::ast::Bind
 One name in a Scope: the Decl it introduces and the Vis of this binding. More...
struct  mim::ast::Mods
 Raw, unvalidated combination of priv/pub/extern/anx modifiers written before a declaration. More...
struct  mim::ast::AnnexInfo
 Bookkeeping of an annex introduced by an AxmDecl. More...
class  mim::ast::AST
 Owns the arena all AST nodes live in as well as the AnnexInfos of all plugins. More...
struct  mim::ast::AST::ForeignAlias
 An anx alias in one plugin for an annex of another, e.g. anx M = core.M; in mem. More...
class  mim::ast::Node
 Base class of all AST nodes. More...
class  mim::ast::Expr
 Base class of all expressions. More...
class  mim::ast::Decl
 Base class of all declarations; caches the emitted Decl::def. More...
class  mim::ast::IdDecl
 dbg bound to a Def whose type the binding construct dictates; hence, it carries no annotation. More...
class  mim::ast::ValDecl
 Base class of all declarations that bind values. More...
class  mim::ast::Ptrn
 Base class of all patterns. More...
class  mim::ast::ErrorPtrn
 Erroneous pattern. More...
class  mim::ast::IdPtrn
 dbg: type More...
class  mim::ast::GrpPtrn
 dbg_i of a group dbg_0 ... dbg_n-1: type for i > 0; the leading IdPtrn::id owns type. More...
class  mim::ast::AliasPtrn
 ptrn as dbg More...
class  mim::ast::TuplePtrn
 (ptrn_0, ..., ptrn_n-1), [ptrn_0, ..., ptrn_n-1], or {ptrn_0, ..., ptrn_n-1} More...
class  mim::ast::ErrorExpr
 Erroneous expression. More...
class  mim::ast::HoleExpr
 ? More...
class  mim::ast::Path
 dbg_0.....dbg_n-1. More...
class  mim::ast::PathExpr
 path More...
class  mim::ast::PrimaryExpr
 tag More...
class  mim::ast::LitExpr
 tok:type More...
class  mim::ast::DeclExpr
 decls expr or expr where decls if DeclExpr::is_where. More...
class  mim::ast::TypeExpr
 Type level More...
class  mim::ast::RuleExpr
 Rule dom More...
class  mim::ast::PrefixExpr
 op rhs; PrefixExpr::op picks the meaning - see MIM_PREFIX. More...
class  mim::ast::InfixExpr
 lhs op rhs; InfixExpr::op picks the meaning - see MIM_INFIX. More...
class  mim::ast::MatchExpr
 match scrutinee with | arm_0 | ... | arm_n-1 More...
class  mim::ast::MatchExpr::Arm
 ptrn => body, ctor ptrn => body, or index [ptrn] => body of a MatchExpr. More...
class  mim::ast::VariantExpr
 | ctor_0: type_0 | ... | ctor_n-1: type_n-1; a constructor without a type carries []. More...
class  mim::ast::VariantExpr::Ctor
 dbg: type of a VariantExpr. More...
class  mim::ast::PiExpr
 dom → codom, Cn dom, or Fn dom → codom depending on PiExpr::tag. More...
class  mim::ast::PiExpr::Dom
 One dom of a PiExpr: ptrn with an optional -> ret type. More...
class  mim::ast::LamExpr
 Wraps a LamDecl as Expr. More...
class  mim::ast::AppExpr
 callee arg More...
class  mim::ast::RetExpr
 ret ptrn = callee $ arg; body More...
class  mim::ast::SigmaExpr
 Wraps a TuplePtrn as Expr. More...
class  mim::ast::TupleExpr
 (elem_0, ..., elem_n-1) More...
class  mim::ast::SeqExpr
 «index: shape; body» or ‹index: shape; body› if SeqExpr::is_pack; index: is optional. More...
class  mim::ast::SingleExpr
 «body» or ‹body› if SingleExpr::is_wrap. More...
class  mim::ast::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  mim::ast::LetDecl
 let ptrn = value; More...
class  mim::ast::AxmDecl
 axm dbg: type, normalizer, curry, trip; or a family axm (name, ...): type, normalizer, curry, trip;. More...
class  mim::ast::AxmDecl::Name
 dbg = alias_0 = ... = alias_n-1 - one axiom of the family, which each of its names binds to. More...
class  mim::ast::RecDecl
 rec dbg = body; More...
class  mim::ast::NomDecl
 nom dbg = body; - a nominal newtype. More...
class  mim::ast::LamDecl
 tag dbg dom_0 ... dom_n-1: codom = body; with LamDecl::tag lam/con/fun or anonymous λ/cn/fn. More...
class  mim::ast::LamDecl::Dom
 One dom of a LamDecl: ptrn@(filter) with an optional : ret type. More...
class  mim::ast::MutualDecl
 mutual decl* end groups RecDecls that may refer to each other. More...
class  mim::ast::AliasDecl
 anx dbg = path; - a compiler-exposed alias sharing its target's annex slot. More...
class  mim::ast::RuleDecl
 rule dbg var: lhs when guard => rhs; or norm instead of rule if RuleDecl::is_normalizer. More...
class  mim::ast::ModDecl
 mod dbg decls end; also the base of the anonymous File. More...
class  mim::ast::File
 The AST of one source file: an anonymous ModDecl that a UseDecl binds under a name of its own. More...

Namespaces

namespace  mim
namespace  mim::ast

Typedefs

template<class T>
using mim::ast::Ptr = fe::Arena::Ref<const T>
 Nodes live in the AST's Arena and are never destroyed, so this merely points at one.
using mim::ast::Scope = fe::SymMap<Bind>
 Maps a name to the Binding introducing it.
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 mim::ast::Ptrs = fe::Vector<Ptr<T>>
using mim::ast::Dbgs = fe::Vector<Dbg>

Enumerations

enum class  mim::ast::Vis {
  mim::ast::Priv ,
  mim::ast::Pub
}
 Visibility tier of a ValDecl. More...

Functions

AST mim::ast::load_plugins (World &, fe::View< std::string >)
AST mim::ast::load_plugin (World &w, std::string_view plugin)

Class Documentation

◆ mim::ast::Bind

struct mim::ast::Bind

One name in a Scope: the Decl it introduces and the Vis of this binding.

A splicing UseDecl re-binds someone else's Decl under its own Vis, so Vis belongs here and not to the Decl.

Definition at line 46 of file ast.h.

Class Members
const Decl * decl
Vis vis

◆ mim::ast::AST::ForeignAlias

struct mim::ast::AST::ForeignAlias

An anx alias in one plugin for an annex of another, e.g. anx M = core.M; in mem.

Definition at line 164 of file ast.h.

Class Members
Sym alias
const AnnexInfo * annex
sub_t sub