diff options
author | David Phillips <david@sighup.nz> | 2018-08-01 01:00:54 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2018-08-01 01:00:54 +1200 |
commit | 645acc193a739ab771fb46e8ec2cf6cd87909597 (patch) | |
tree | 482c5d59220af7ae2cc8f34a860174f4b1affd01 /simulator.c | |
parent | 96776c831e9d2fcbd69bc1e0faa16026c5ed25b0 (diff) | |
download | hence-645acc193a739ab771fb46e8ec2cf6cd87909597.tar.xz |
WIP: Implement more robust, separated lexer+parser passes
Diffstat (limited to 'simulator.c')
-rw-r--r-- | simulator.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/simulator.c b/simulator.c index fb5ce8f..4f99c4f 100644 --- a/simulator.c +++ b/simulator.c @@ -1,29 +1,24 @@ #include <stdio.h> #include <string.h> -#include "gate.h" -#include "logic.h" +//#include "gate.h" +//#include "logic.h" +#include "lexer.h" #include "parser.h" int main(int argc, char **argv) { - char buf[4096]; - FILE *fd = stdin; - (void)argc; (void)argv; - gate_init(); +// gate_init(); - while (NULL != fgets(buf, sizeof(buf), fd)) { - if (parse_line(buf)) { - return 1; - } - } + struct token *tok = lex_file(stdin); + int p = parse(tok); - gate_set_input("a", LOGIC_LOW); - gate_set_input("b", LOGIC_LOW); - gate_update(); - gate_dump(); +// gate_set_input("a", LOGIC_LOW); +// gate_set_input("b", LOGIC_LOW); +// gate_update(); +// gate_dump(); return 0; } |