#include #include #include "mnemonics.h" #include "nqasm.h" #include "lexer.h" #include "parser.h" void add_instruction(const struct instruction *inst) { const struct mnemonic *mnem = &mnemonics[inst->mnem]; uint16_t bits = mnem->bits; const struct operand *ops = mnem->operands; const struct argument *args = inst->args.args; for (int i = 0; i < 3 && ops[i].type; i++) { bits |= args[i].value << ops[i].shift; } printf("%04x\n", bits); } int main(int argc, char **argv) { yyparse(); return 0; }