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...
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::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 of a group dbg_0 ... dbg_n-1: type that refers to the trailing IdPtrn::id. 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::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 of a MatchExpr. 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
 «arity; body» or ‹arity; body› if SeqExpr::is_pack. More...
class  mim::ast::UniqExpr
 ⦃inhabitant⦄ 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; More...
class  mim::ast::AxmDecl::Sibling
 A further tag sharing AxmDecl::type/normalizer/curry/trip with the AxmDecl that owns them. More...
class  mim::ast::RecDecl
 rec dbg = body; with an optional and RecDecl::next. 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::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 }; 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 45 of file ast.h.

Class Members
const Decl * decl
Vis vis