Start working on types.
This commit is contained in:
32
src/type.hpp
Normal file
32
src/type.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#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)) {}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user