blob: 0426f293785729706ccbdbd209aec6011e30eef6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
//
// Created by martial.simon on 2/27/25.
//
#pragma once
#include "visitor.hh"
namespace visitor
{
class ComputeVisitor : public Visitor
{
public:
void visit(const tree::Tree& e);
void visit(const tree::Node& e);
void visit(const tree::AddNode& e);
void visit(const tree::SubNode& e);
void visit(const tree::MulNode& e);
void visit(const tree::DivNode& e);
void visit(const tree::Leaf& e);
int get_value();
private:
int value_ = 0;
};
} // namespace visitor
|