aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-04 12:13:52 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-04 12:13:52 +0200
commitf384fdc3a9e4acccac2e4d322676e34115a168f7 (patch)
tree4a5ee252658508b934888324e35a6f633b1a631d /main.cpp
parentc084bee21f66e6322d4d55b8700f0779f2c58d0d (diff)
WIP meer nadenk
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp48
1 files changed, 35 insertions, 13 deletions
diff --git a/main.cpp b/main.cpp
index 05ec033..01b78b2 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,17 +1,39 @@
-#include <cstdio>
-// #include "Observer.h"
-#include "Net.h"
-#include "Gate.h"
+#include <iostream>
+#include <exception>
+#include <fstream>
+
+#include "Parser.h"
+#include "Circuit.h"
+
+using std::cout;
+using std::endl;
+using std::fstream;
+using std::exception;
int main(int argc, char** argv) {
- // Observer ob();
- Net n;
- Gate *g = new GateAnd;
- g->addInput(&n);
- n.setLevel(HIGH);
- int level = 22;
- level = n.getLevel();
- printf("hello world! %d\n", level);
- return 0;
+ Parser main_parser;
+ Circuit circuit;
+
+ main_parser.setCircuit(circuit);
+
+ fstream file{"circuits/full-adder.txt", file.out};
+
+ try {
+ main_parser << file;
+ } catch (exception e) {
+ cout << "Parser error: " << e.what() << endl;
+ return EXIT_FAILURE;
+ }
+
+ try {
+ circuit.run();
+ } catch (exception e) {
+ cout << "Circuit error: " << e.what() << endl;
+ return EXIT_FAILURE;
+ }
+
+ cout << "Circuit output: " << circuit.getOutput() << endl;
+
+ return EXIT_SUCCESS;
}