blob: 13eca00deb7ed5259c948c665ef3b4bf15337873 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#pragma once
#include <string>
#include <vector>
#include "instruction.h"
#include "parse.h"
class Encoding
{
};
class OpCode: public Encoding
{
private:
Instruction _instruction;
std::vector<std::string> _arguments;
};
class Data: public Encoding
{
};
using Assembly = std::vector<Encoding>;
class Assembler
{
public:
Assembler(){}
// passes:
// 0. parse
// 1. assign sizes and offsets to codes (assign labels)
// 2. assemble to code sequence (use labels for offsets)
code_sequence encode(const std::string& source){ throw std::runtime_error("Assembler.encode unimplemented");}
std::string decode(code_sequence) { throw std::runtime_error("Assembler.decode unimplemented");}
};
|