blob: 9e355ff0add20841281c34c6954f37ed89783655 (
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
|
#ifndef BRAINFUCK_INTERPRETER_H
#define BRAINFUCK_INTERPRETER_H
#include <cstddef>
#include <iostream>
class BFInterpreter {
public:
using uchar = unsigned char;
BFInterpreter(const char *program, std::istream &input = std::cin, std::ostream &output = std::cout);
~BFInterpreter();
void compile();
private:
void addMemory();
void loop();
void proccessNonLoopCmd(char c);
private:
std::istream &input;
std::ostream &output;
size_t memory_size;
uchar *memory_blocks;
uchar *p;
char *program;
char *pp;
};
#endif /* BRAINFUCK_INTERPRETER_H */
|