12#ifndef ARK_COMPILER_EXECUTOR_HPP
13#define ARK_COMPILER_EXECUTOR_HPP
15#include <unordered_map>
107 void unify(
const std::unordered_map<std::string, Node>&,
Node&,
Node*);
AST node used by the parser, optimizer and compiler.
A class that applies macros in a Node.
Node evaluate(Node &node, bool is_not_body)
Evaluate only the macros.
MacroProcessor * m_macroprocessor
virtual bool canHandle(Node &node)=0
Checks if the executor can apply a macro on the passed Node.
bool isTruthy(const Node &node)
Check if a node can be evaluated to true.
void throwMacroProcessingError(const std::string &message, const Node &node)
Throw a macro processing error.
virtual bool applyMacro(Node &node)=0
Executes macros in the Node if the Executor can handle it.
virtual ~MacroExecutor()
Need a virtual destructor to correctly destory object.
void registerMacro(Node &node)
Registers macros based on their type.
void unify(const std::unordered_map< std::string, Node > &, Node &, Node *)
Applies the spread operator.
bool isPredefined(const std::string &symbol)
Check if a given symbol is a predefined macro.
const Node * findNearestMacro(const std::string &name) const
Find the nearest macro matching a giving name.
bool applyMacroProxy(Node &node)
Execute a node, trying to emplace macros calls.
The class handling the macros definitions and calls, given an AST.
A node of an Abstract Syntax Tree for ArkScript.