blob: 2b33a1229b990917005e1440e5be09795a28fd17 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include <fstream>
#include <iostream>
#include "assembler.hpp"
int main(int argc, const char* argv[])
{
if (argc != 3)
return 1;
SpasmImpl::ASM::Bytecode_Memory bytecode;
std::ifstream input(argv[1]);
SpasmImpl::ASM::compile(input, bytecode);
std::ofstream output(argv[2], std::ios_base::out | std::ios_base::binary);
// output.write ("SPASM", 5);
auto& bc = bytecode.bytecode();
auto size = bc.size();
output.write(reinterpret_cast<const char*>(&size), sizeof(size));
output.write(reinterpret_cast<const char*>(bc.data()), size);
return 0;
}
|