stratom numatom

This commit is contained in:
2023-12-26 12:04:16 +01:00
parent 4513ec82aa
commit a45494d861
4 changed files with 40 additions and 6 deletions

View File

@@ -7,9 +7,12 @@
#include <cassert>
#include <cstdint>
#include <string>
#include <utility>
enum class CellType {
INT,
NUMATOM,
STRATOM,
CONS
};
@@ -23,13 +26,20 @@ struct Cell {
bool live = false;
};
struct ValueCell : public Cell {
ValueCell() = delete;
explicit ValueCell(CellValType val) : Cell(CellType::INT), _val(val) {}
struct NumAtomCell : public Cell {
NumAtomCell() = delete;
explicit NumAtomCell(CellValType val) : Cell(CellType::NUMATOM), _val(val) {}
CellValType _val;
};
struct StrAtomCell : public Cell {
StrAtomCell() = delete;
explicit StrAtomCell(std::string val) : Cell(CellType::STRATOM), _val(std::move(val)) {}
std::string _val;
};
struct ConsCell : public Cell {
ConsCell() : Cell(CellType::CONS) {}
explicit ConsCell(Cell *car) : Cell(CellType::CONS), _car(car) {}