MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::Nest Class Reference

Builds a nesting tree of all immutables‍/binders. More...

#include <mim/nest.h>

Classes

class  Node
 

Public Member Functions

Constructors
 Nest (Def *root)
 
 Nest (View< Def * > muts)
 Constructs a virtual root with muts as children.
 
 Nest (World &)
 Virtual root with all World::externals as children.
 
Getters
Worldworld () const
 
const Noderoot () const
 
Vars vars () const
 All Vars occurring in this Nest.
 
bool contains (const Def *def) const
 
bool is_recursive () const
 
Nodes
auto muts () const
 
auto nodes () const
 
const auto & mut2node () const
 
size_t num_nodes () const
 
const Nodemut2node (Def *mut) const
 
const Nodeoperator[] (Def *mut) const
 Same as above.
 
dot

GraphViz output.

void dot (std::ostream &os) const
 
void dot (const char *file=nullptr) const
 
void dot (std::string s) const
 

Static Public Member Functions

static const Nodelca (const Node *n, const Node *m)
 Least common ancestor of n and m.
 

Detailed Description

Builds a nesting tree of all immutables‍/binders.

Definition at line 11 of file nest.h.

Constructor & Destructor Documentation

◆ Nest() [1/3]

mim::Nest::Nest ( Def * root)

Definition at line 11 of file nest.cpp.

◆ Nest() [2/3]

mim::Nest::Nest ( View< Def * > muts)

Constructs a virtual root with muts as children.

Definition at line 17 of file nest.cpp.

References muts().

◆ Nest() [3/3]

mim::Nest::Nest ( World & world)

Virtual root with all World::externals as children.

Definition at line 24 of file nest.cpp.

References world().

Member Function Documentation

◆ contains()

bool mim::Nest::contains ( const Def * def) const
inline

◆ dot() [1/3]

void mim::Nest::dot ( const char * file = nullptr) const

Definition at line 159 of file dot.cpp.

References dot().

◆ dot() [2/3]

void mim::Nest::dot ( std::ostream & os) const

Definition at line 168 of file dot.cpp.

References mim::println(), mim::Tab::println(), and root().

Referenced by dot(), and main().

◆ dot() [3/3]

void mim::Nest::dot ( std::string s) const
inline

Definition at line 154 of file nest.h.

References dot().

Referenced by dot().

◆ is_recursive()

bool mim::Nest::is_recursive ( ) const
inline

Definition at line 132 of file nest.h.

References mim::Nest::Node::is_recursive(), and root().

Referenced by mim::LamSpec::rewrite().

◆ lca()

const Nest::Node * mim::Nest::lca ( const Node * n,
const Node * m )
static

Least common ancestor of n and m.

Definition at line 78 of file nest.cpp.

References mim::Nest::Node::level(), and mim::Nest::Node::parent().

◆ mut2node() [1/2]

const auto & mim::Nest::mut2node ( ) const
inline

Definition at line 141 of file nest.h.

Referenced by operator[](), and mim::post_order().

◆ mut2node() [2/2]

const Node * mim::Nest::mut2node ( Def * mut) const
inline

Definition at line 143 of file nest.h.

◆ muts()

auto mim::Nest::muts ( ) const
inline

Definition at line 137 of file nest.h.

Referenced by Nest(), and mim::Scheduler::Scheduler().

◆ nodes()

auto mim::Nest::nodes ( ) const
inline

Definition at line 138 of file nest.h.

◆ num_nodes()

size_t mim::Nest::num_nodes ( ) const
inline

Definition at line 142 of file nest.h.

◆ operator[]()

const Node * mim::Nest::operator[] ( Def * mut) const
inline

Same as above.

Definition at line 144 of file nest.h.

References mut2node().

◆ root()

const Node * mim::Nest::root ( ) const
inline

◆ vars()

Vars mim::Nest::vars ( ) const
inline

All Vars occurring in this Nest.

Definition at line 130 of file nest.h.

Referenced by contains().

◆ world()

World & mim::Nest::world ( ) const
inline

Definition at line 128 of file nest.h.

Referenced by Nest(), and mim::Scheduler::world().


The documentation for this class was generated from the following files: