bloglang/06/instruction.hpp

84 lines
1.4 KiB
C++
Raw Normal View History

#pragma once
#include <string>
#include <memory>
#include "binop.hpp"
struct instruction {
virtual ~instruction() = default;
};
using instruction_ptr = std::unique_ptr<instruction>;
struct instruction_pushint : public instruction {
int value;
instruction_pushint(int v)
: value(v) {}
};
struct instruction_pushglobal : public instruction {
std::string name;
instruction_pushglobal(std::string n)
: name(std::move(n)) {}
};
struct instruction_push : public instruction {
int offset;
instruction_push(int o)
: offset(o) {}
};
struct instruction_mkapp : public instruction {
};
struct instruction_update : public instruction {
int offset;
instruction_update(int o)
: offset(o) {}
};
struct instruction_pack : public instruction {
int tag;
int size;
instruction_pack(int t, int s)
: tag(t), size(s) {}
};
struct instruction_split : public instruction {
};
struct instruction_slide : public instruction {
int offset;
instruction_slide(int o)
: offset(o) {}
};
struct instruction_binop : public instruction {
binop op;
instruction_binop(binop o)
: op(o) {}
};
struct instruction_eval : public instruction {
};
struct instruction_alloc : public instruction {
int amount;
instruction_alloc(int a)
: amount(a) {}
};
struct instruction_unwind : public instruction {
};