README added

This commit is contained in:
starcells committed 2026-09-14 21:01:48 +08:00
1 parent 7c57f4e628
commit bef8310558
6 files changed
+111 -17

No files matched your search

+6 -11
View File
@@ -9,12 +9,6 @@
#include <string>
#include <vector>
constexpr size_t CELL_SIZE = 8;
constexpr size_t CELL_MAX(((uint64_t)1 << CELL_SIZE) - 1);
constexpr size_t ROL_STEP(CELL_SIZE - 1);
namespace r8asm_maps {}
class r8asm {
using data = int16_t;
using parameter_index = uint8_t;
@@ -89,13 +83,13 @@ private:
class ast {
public:
ast_node root = {r8asm::ast_node_t::CODEBLOCK, "", {}};
size_t CELL_SIZE;
// I know template class is the most elegant solution of CELL_SIZE
// but I can't be bother to add that.
private:
addr dataptr = 0;
std::vector<std::map<std::string, general_data>> scopes = {
{{"_CELL_SIZE", CELL_SIZE},
{"_CELL_MAX", CELL_MAX},
{"_ROL_STEP", ROL_STEP}}};
std::vector<std::map<std::string, general_data>> scopes;
std::map<std::string, ast_node> macros;
enum class builtin_t {
@@ -159,6 +153,7 @@ private:
ast_node expand_node_to_ins(const ast_node &node);
std::string expand_root();
bool import_macro(const std::string &macro_name, const ast_node &node);
void set_cell_size(size_t cell_size);
};
ast main_tree;
@@ -183,5 +178,5 @@ private:
public:
std::string export_rot8();
bool import_file(const std::string &filename);
bool import_file(const std::string &filename, size_t cell_size);
};