202608260032

This commit is contained in:
starcells committed 2026-08-26 00:32:30 +08:00
1 parent c450ab3f45
commit e6505a95c0
1 file changed
+15 -6
+15 -6
View File
@@ -72,21 +72,31 @@ r8asm::general_data r8asm::ast::read_parameter(std::string index_str) {
return scopes.back().at('%' + index_str);
}
#define ADD_ROT8_PR(INS) std::string("rot8_") + INS
// TODO: FILL THE BLANK
#define ROT8_NODE(INS) \
{ \
r8asm::ast_node_t::ROT8, ADD_ROT8_PR(INS), {} \
r8asm::ast_node_t::ROT8, std::string("rot8_") + INS, {} \
}
std::vector<r8asm::ast_node>
r8asm::ast::expand_node_to_ins(const ast_node &node) {
std::vector<ast_node> to_return = {};
switch (node.type) {
case ast_node_t::ROT8: {
/*
ROT8
value: type
*/
to_return = {node};
if (node.value == ADD_ROT8_PR("stp"))
switch (rot8_map.at(node.value)) {
case rot8_t::STP:
dataptr++;
if (node.value == ADD_ROT8_PR("btp"))
break;
case rot8_t::BTP:
dataptr--;
break;
default:
break;
}
} break;
case ast_node_t::REPEAT: {
/*
@@ -207,5 +217,4 @@ r8asm::ast::expand_node_to_ins(const ast_node &node) {
}
return to_return;
}
#undef ROT8_NODE
#undef ADD_ROT8_PR
#undef ROT8_NODE