Website Summary Files Commits Branches @commit @diff @stats
path: root / spasm / src / asm / assembler.hpp
blob: 90e8815b740db86b479f62628833a04d4ff5c104 (plain) (blame)
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
#ifndef ASSEMBPLER_HPP
#define ASSEMBPLER_HPP

#include <iostream>

#include "bytecode.hpp"
#include "symbol.hpp"
#include "tokenizer.hpp"

namespace SpasmImpl
{
namespace ASM
{
class Assembler
{
   public:
    Assembler(Lexer::Tokenizer&, Bytecode_Stream&);

    void assemble();

   private:
    void backpatch(const Symbol*);
    void assemble_identifier(const Lexer::Token&);

    Lexer::Tokenizer* _tokenizer;
    Bytecode_Stream* _bytecode;

    Symbol_Table _symbols;

};  // class Assembler

bool compile(std::istream&, Bytecode_Stream& bytecode);
}  // namespace ASM
}  // namespace SpasmImpl

#endif  // ASSEMBPLER_HPP