diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 47 |
1 files changed, 34 insertions, 13 deletions
@@ -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; } |