aboutsummaryrefslogtreecommitdiff
path: root/include/ast_node.hpp
blob: caffb354d6e409c181d098d96eaad6e2c23f8a90 (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
27
28
29
30
31
32
33
34
35
36
#pragma once

#include "node_type.hpp"
#include "type.hpp"

#include <string>
#include <vector>
#include <memory>

class ASTNode {
public:
    int line;
    int column;

    virtual ~ASTNode() = default;
};

class ProgramNode : ASTNode {
public:
    std::vector<ASTNode> function_declarations;

    explicit ProgramNode(std::vector<ASTNode> f) : function_declarations(f) { }
};

class FunctionDeclNode : ASTNode {
    Type type;
    std::vector<ParameterNode> parameters;
    std::vector<ASTNode> body;

    FunctionDeclNode(std::string t,std::vector<ASTNode> p, std::vector<ASTNode> b) : type(t), parameters(p), body(b) { }
};

class ParameterNode : ASTNode {
    std::string name;
    std::string type;
};