33 lines
562 B
C++
33 lines
562 B
C++
|
#pragma once
|
||
|
#include <string>
|
||
|
#include <vector>
|
||
|
|
||
|
namespace lily {
|
||
|
enum reserved_types {
|
||
|
type_id_int = 0,
|
||
|
type_id_str,
|
||
|
type_id_last
|
||
|
};
|
||
|
|
||
|
struct type {
|
||
|
virtual ~type() = default;
|
||
|
};
|
||
|
|
||
|
typedef std::shared_ptr<type> type_ptr;
|
||
|
|
||
|
struct type_int : type {
|
||
|
int type_id;
|
||
|
|
||
|
type_int(int id) : type_id(id) {}
|
||
|
};
|
||
|
|
||
|
struct type_func : type {
|
||
|
type_ptr left;
|
||
|
type_ptr right;
|
||
|
|
||
|
type_func(type_ptr l, type_ptr r) :
|
||
|
left(std::move(l)), right(std::move(r)) {}
|
||
|
};
|
||
|
}
|
||
|
|