11#ifndef COMPILER_AST_OPTIMIZER_HPP
12#define COMPILER_AST_OPTIMIZER_HPP
15#include <unordered_map>
36 explicit Optimizer(
unsigned debug)
noexcept;
43 void process(
const Node& ast)
override;
50 [[nodiscard]]
const Node& ast()
const noexcept override;
61 void countAndPruneDeadCode(
Node& node);
68 void pruneUnusedGlobalVariables(
Node& node);
AST node used by the parser, optimizer and compiler.
Interface for a compiler pass (take in an AST, output an AST)
A node of an Abstract Syntax Tree for ArkScript.
The ArkScript AST optimizer.
std::unordered_map< std::string, unsigned > m_sym_appearances
An interface to describe compiler passes.