summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/parser.c b/parser.c
index 274f9a0..dc1e9a9 100644
--- a/parser.c
+++ b/parser.c
@@ -7,6 +7,11 @@
#include "logic.h"
#include "gate.h"
+
+int parse_input(char *);
+int parse_module(char *);
+int parse_expr(char *);
+
struct tok_lookup {
char *str;
int (*handler)(char*);
@@ -29,6 +34,12 @@ static struct op_lookup bop_handlers[] = {
{.str = "xor", .handler = logic_xor}
};
+static struct tok_lookup tok_handlers[] = {
+ {.str = "input", .handler = parse_input},
+ {.str = "module", .handler = parse_module},
+ {.str = "expr", .handler = parse_expr}
+};
+
int
expect(const char *expect, char *actual) {
int min_len = 0;
@@ -137,19 +148,6 @@ parse_module(char *str) {
return 0;
}
-
-
-
-static struct tok_lookup tok_handlers[] = {
- {.str = "input", .handler = parse_input},
- {.str = "module", .handler = parse_module},
- {.str = "expr", .handler = parse_expr}
-};
-
-
-
-
-
int
parse_line(char *line) {
size_t i = 0;
@@ -191,19 +189,11 @@ int main(void) {
return 1;
}
}
- gate_dump();
gate_set_input("a", LOGIC_LOW);
gate_set_input("b", LOGIC_LOW);
-
gate_update();
-
gate_dump();
-
-
return 0;
}
-
-
-