add preprocessing via~

main
Brett 2023-11-13 15:36:43 -05:00
parent 702d5c3b57
commit 06fb208e46
9 changed files with 39 additions and 8 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.26) cmake_minimum_required(VERSION 3.1)
project(BrainFuck_Misc) project(BrainFuck_Misc)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)

1
bf.bf
View File

@ -1 +1,2 @@
~../hellobf.bf
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

1
hellobf.bf Normal file
View File

@ -0,0 +1 @@
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

@ -1 +1 @@
Subproject commit 32e2d48cd31d20d80ecd7cd87ecfe74c2bbc1e5a Subproject commit 5472783bd7194cfc844da81bfa696e7761bd2047

4
shader1.txt Normal file
View File

@ -0,0 +1,4 @@
#include <../shader2.txt>
#include "../shader3.txt"
SHADER 1 ENDING TEXT

17
shader2.txt Normal file
View File

@ -0,0 +1,17 @@
i
am
a
shader
2
i
suck
all
the
balls
possible
-----
I AM INCLUDING SHADER 3
=====
#include <../shader3.txt>
-----
END OF SHADER 2

7
shader3.txt Normal file
View File

@ -0,0 +1,7 @@
this is some text i have included in shader 3
-----
UWU
-----
end of shader 3
#include <../shader4.txt>

1
shader4.txt Normal file
View File

@ -0,0 +1 @@
SHADER 4 TEXT IS THE BEST FUCKING TEXT EVER

View File

@ -2,6 +2,7 @@
#include <cstring> #include <cstring>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <blt/std/loader.h>
class brainfuck class brainfuck
{ {
@ -72,7 +73,6 @@ class brainfuck
template<typename functor> template<typename functor>
void match(functor f, int sp, size_t& index, const std::string& program) void match(functor f, int sp, size_t& index, const std::string& program)
{ {
while (f(index) < program.size()) while (f(index) < program.size())
{ {
if (program[index] == '[') if (program[index] == '[')
@ -84,12 +84,12 @@ void match(functor f, int sp, size_t& index, const std::string& program)
} }
} }
int main() int main(int argc, const char** argv)
{ {
std::ifstream bf("../bf.bf"); std::string file{"../bf.bf"};
std::stringstream buffer; if (argc > 1)
buffer << bf.rdbuf(); file = argv[1];
auto program = buffer.str(); auto program = blt::fs::loadBrainFuckFile(file);
brainfuck fuck; brainfuck fuck;