MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
emit.cpp File Reference
#include "mim/def.h"
#include "mim/rewrite.h"
#include "mim/ast/ast.h"
#include "family.h"
Include dependency graph for emit.cpp:

Go to the source code of this file.

Classes

class  mim::ast::Emitter
struct  mim::ast::Emitter::NomInfo

Namespaces

namespace  mim
namespace  mim::ast

Functions

static bool mim::ast::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 * mim::ast::assign (Emitter &e, const Ptrn *ptrn, const Def *type, const Def *def)
static void mim::ast::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 > mim::ast::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 mim::ast::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 mim::ast::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 mim::ast::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 mim::ast::open_nom (Emitter &e, Loc loc, const Nom *nom)
 Checks and prepares access to nom's representation.
static const Def * mim::ast::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 * mim::ast::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.

Class Documentation

◆ mim::ast::Emitter::NomInfo

struct mim::ast::Emitter::NomInfo

Definition at line 130 of file emit.cpp.

Class Members
const Nom * decl
const ModDecl * owner