aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp47
1 files changed, 34 insertions, 13 deletions
diff --git a/main.cpp b/main.cpp
index 05ec033..01ddeb7 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,17 +1,38 @@
-#include <cstdio>
-// #include "Observer.h"
-#include "Net.h"
-#include "Gate.h"
+#include <iostream>
+#include <fstream>
+
+#include "Parser.h"
+#include "Circuit.h"
+
+using std::cout;
+using std::endl;
+using std::ifstream;
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.set_circuit(circuit);
+
+ ifstream file("circuits/full-adder.txt");
+
+ try {
+ file >> main_parser;
+ // main_parser << file;
+ } catch (ParserException & 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;
}