MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::ast::RuleDecl Class Reference

rule dbg var: lhs when guard => rhs; or norm instead of rule if RuleDecl::is_normalizer. More...

#include <mim/ast/ast.h>

Inheritance diagram for mim::ast::RuleDecl:
[legend]

Public Member Functions

 RuleDecl (Loc loc, Dbg dbg, Ptr< Ptrn > var, Ptr< Expr > lhs, Ptr< Expr > rhs, Ptr< Expr > guard, bool is_normalizer)
Dbg dbg () const override
 The name this Decl introduces; anonymous if it has none.
const Ptrnvar () const
const Exprlhs () const
const Exprrhs () const
const Exprguard () const
bool is_normalizer () const
void bind (Scopes &) const override
void stream (fe::Tab &, std::ostream &) const override
Public Member Functions inherited from mim::ast::ValDecl
Vis vis () const override
 A ValDecl's own Vis; Pub for anything else (Ptrn, Import, ...), which the priv/pub system ignores.
bool is_extern () const override
 Whether this decl crosses the Mim/native boundary (extern); body presence picks which side supplies it.
bool is_anx () const override
 Whether this decl is registered as a compiler-exposed annex (anx).
const Modsmods () const
Public Member Functions inherited from mim::ast::Decl
const Defdef () const
virtual const Scopescope () const
 Non-nullptr if this Decl is a module whose members a Path may walk into.
virtual std::pair< AnnexInfo *, sub_tannex_sub () const
 The (AnnexInfo, sub) slot this decl registered itself under as an annex; {nullptr, 0} if it isn't one.
Public Member Functions inherited from mim::ast::Node
Loc loc () const
void dump () const

Private Member Functions

void emit (Emitter &) const override

Additional Inherited Members

Protected Member Functions inherited from mim::ast::ValDecl
 ValDecl (Loc loc, Mods mods={})
Protected Member Functions inherited from mim::ast::Decl
 Decl (Loc loc)
Protected Member Functions inherited from mim::ast::Node
 Node (Loc loc)
Protected Attributes inherited from mim::ast::Decl
const Defdef_ = nullptr

Detailed Description

rule dbg var: lhs when guard => rhs; or norm instead of rule if RuleDecl::is_normalizer.

Definition at line 1137 of file ast.h.

Constructor & Destructor Documentation

◆ RuleDecl()

mim::ast::RuleDecl::RuleDecl ( Loc loc,
Dbg dbg,
Ptr< Ptrn > var,
Ptr< Expr > lhs,
Ptr< Expr > rhs,
Ptr< Expr > guard,
bool is_normalizer )
inline

Member Function Documentation

◆ bind()

void mim::ast::RuleDecl::bind ( Scopes & s) const
overridevirtual

Implements mim::ast::ValDecl.

Definition at line 554 of file bind.cpp.

References dbg(), guard(), lhs(), rhs(), and var().

◆ dbg()

Dbg mim::ast::RuleDecl::dbg ( ) const
inlineoverridevirtual

The name this Decl introduces; anonymous if it has none.

Reimplemented from mim::ast::Decl.

Definition at line 1148 of file ast.h.

Referenced by bind(), emit(), and RuleDecl().

◆ emit()

void mim::ast::RuleDecl::emit ( Emitter & e) const
overrideprivatevirtual

Implements mim::ast::ValDecl.

Definition at line 665 of file emit.cpp.

References dbg(), mim::ast::Decl::def_, guard(), lhs(), mim::ast::Node::loc(), rhs(), and var().

◆ guard()

const Expr * mim::ast::RuleDecl::guard ( ) const
inline

Definition at line 1152 of file ast.h.

Referenced by bind(), emit(), RuleDecl(), and stream().

◆ is_normalizer()

bool mim::ast::RuleDecl::is_normalizer ( ) const
inline

Definition at line 1153 of file ast.h.

Referenced by RuleDecl().

◆ lhs()

const Expr * mim::ast::RuleDecl::lhs ( ) const
inline

Definition at line 1150 of file ast.h.

Referenced by bind(), emit(), RuleDecl(), and stream().

◆ rhs()

const Expr * mim::ast::RuleDecl::rhs ( ) const
inline

Definition at line 1151 of file ast.h.

Referenced by bind(), emit(), RuleDecl(), and stream().

◆ stream()

void mim::ast::RuleDecl::stream ( fe::Tab & tab,
std::ostream & os ) const
overridevirtual

Implements mim::ast::Node.

Definition at line 298 of file stream.cpp.

References guard(), lhs(), rhs(), mim::ast::S::S(), and var().

◆ var()

const Ptrn * mim::ast::RuleDecl::var ( ) const
inline

Definition at line 1149 of file ast.h.

Referenced by bind(), emit(), RuleDecl(), and stream().


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