Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Concepts
VariableExpression.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <alib/string>
9#include <ast/Expression.h>
10
11namespace cli {
12
13class VariableExpression final : public Expression {
14 std::unique_ptr < cli::Arg > m_name;
15
16public:
17 VariableExpression ( std::unique_ptr < cli::Arg > name ) : m_name ( std::move ( name ) ) {
18 }
19
20 std::shared_ptr < abstraction::Value > translateAndEval ( Environment & environment ) const override {
21 return environment.getVariable ( m_name->eval ( environment ) );
22 }
23
24};
25
26} /* namespace cli */
27
Definition: Environment.h:29
std::shared_ptr< abstraction::Value > getVariable(const std::string &name) const
Definition: Environment.h:68
Definition: Expression.h:14
Definition: VariableExpression.h:13
std::shared_ptr< abstraction::Value > translateAndEval(Environment &environment) const override
Definition: VariableExpression.h:20
VariableExpression(std::unique_ptr< cli::Arg > name)
Definition: VariableExpression.h:17
Definition: Arg.h:11
Definition: FordFulkerson.hpp:16