diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2017-01-12 20:05:45 -0600 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2017-01-15 23:18:52 -0600 |
commit | cf366387449dcf9d34875a7d76f3b79c1e231d6f (patch) | |
tree | b892febf08e3c5791e414c9cdc011477a9420ae1 /nqasm.c | |
parent | 239ee7648658b77b217f5c8142ef887612516af4 (diff) |
nqasm: Initial stab at a lexer and parser
So far, this only understands instructions, but no operands or labels. It
doesn't handle bad input gracefully. It's just enough to test the basics.
Diffstat (limited to 'nqasm.c')
-rw-r--r-- | nqasm.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -0,0 +1,20 @@ +#include <stdio.h> + +#include "mnemonics.h" +#include "nqasm.h" + +#include "lexer.h" +#include "parser.h" + +void add_instruction(const struct instruction *i) +{ + const struct mnemonic *m = &mnemonics[i->mnem]; + printf("%04x\n", m->bits); +} + +int main(int argc, char **argv) +{ + yyparse(); + return 0; +} + |