From fd528d27b11f1d85dbf6afcd65b6bb4140e56070 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Thu, 8 Sep 2022 11:11:06 -0400 Subject: handle predefined and command line macro definitions --- as/Makefile | 11 ----------- as/as.l | 25 ------------------------- as/as.y | 36 ------------------------------------ as/x86.h | 38 -------------------------------------- 4 files changed, 110 deletions(-) delete mode 100644 as/Makefile delete mode 100644 as/as.l delete mode 100644 as/as.y delete mode 100644 as/x86.h (limited to 'as') diff --git a/as/Makefile b/as/Makefile deleted file mode 100644 index 99fe9de..0000000 --- a/as/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -as: as.yy.o as.tab.o - c99 -o $@ as.yy.o as.tab.o -ly -ll - -as.yy.c: as.l as.tab.h - lex -t as.l > $@ - -as.tab.h as.tab.c: as.y - yacc -d -b as as.y - -clean: - rm -f as *.o as.yy.c as.tab.c as.tab.h diff --git a/as/as.l b/as/as.l deleted file mode 100644 index 059b7c3..0000000 --- a/as/as.l +++ /dev/null @@ -1,25 +0,0 @@ -%{ -#include -#include "as.tab.h" -%} - -NONDIGIT [_a-zA-Z] -DIGIT [0-9] -IDENTIFIERS [_a-zA-Z0-9] - -%x COMMENT - -%% - -{DIGIT}+ { yylval.n = strtoumax(yytext, NULL, 10); return NUMBER; } - -{NONDIGIT}{IDENTIFIERS}* { yylval.s = yytext; return TOKEN; } - -:|,|\. { return yytext[0]; } -\n { return NEWLINE; } - -; { BEGIN COMMENT; } -. ; -\n { BEGIN INITIAL; return NEWLINE; } - -. ; diff --git a/as/as.y b/as/as.y deleted file mode 100644 index ed8714f..0000000 --- a/as/as.y +++ /dev/null @@ -1,36 +0,0 @@ -%{ -#include -%} - -%union { - char *s; - uintmax_t n; -}; - -%token NUMBER -%token TOKEN -%token NEWLINE - -%% - -program - : /* empty */ - | instruction NEWLINE -; - -instruction - : bare_instruction - | TOKEN ':' bare_instruction -; - -bare_instruction - : TOKEN - | TOKEN operand - | TOKEN operand ',' operand - | TOKEN operand ',' operand ',' operand -; - -operand - : TOKEN - | NUMBER -; diff --git a/as/x86.h b/as/x86.h deleted file mode 100644 index 56bf639..0000000 --- a/as/x86.h +++ /dev/null @@ -1,38 +0,0 @@ -struct { -const char *mnemonic; -const char *opcode; -char x32; -char x64; -} x86_opcodes[] = { -{ "aaa", "37", 1, 0 }, - -{ "aad", "d5 0a", 1, 0 }, -{ "aad imm8", "db ib", 1, 0 }, - -{ "aam", "d4 0a", 1, 0 }, -{ "aam imm8", "d4 ib", 1, 0 }, - -{ "aas", "3f" , 1, 0 }, - -{ "adc al, imm8", "14 ib", 1, 1 }, -{ "adc ax, immm16", "15 iw", 1, 1 }, -{ "adc eax, imm32", "15 id", 1, 1 }, -{ "adc rax, imm32", "rex.w 15 id", 0, 1 }, -{ "adc r/m8, imm8", "80 /2 ib", 1, 1 }, -{ "adc r/m8*, imm8", "rex 80 /2 ib", 0, 1 }, -{ "adc r/m16, imm16", "81 /2 iw", 1, 1 }, -{ "adc r/m32, imm32", "81 /2 id", 1, 1 }, -{ "adc r/m64, imm32", "rex.w 81 /2 id", 0, 1 }, -{ "adc r/m16, imm8", "83 /2 ib", 1, 1 }, -{ "adc r/m32, imm8", "83 /2 ib", 1, 1 }, -{ "adc r/m64, imm8", "rex.w 83 /2 ib", 0, 1 }, -{ "adc r/m8, r8", "10 /r", 1, 1 }, -{ "adc r/m8*, r8*", "rex 10 /r", 0, 1 }, -{ "adc r/m16, r16", "11 /r", 1, 1 }, -{ "adc r/m32, r32", "11 /r", 1, 1 }, -{ "adc r/m64, r64", "rex.w 11 /r", 0, 1 }, -{ "adc r8, r/m8", "12 /r", 1, 1 }, -{ "adc r8*, r/m8*", "rex 12 /r", 0, 1 }, -{ "adc r16, r/m16", "13 /r", 1, 1 }, -{ "adc r32, r/m32", "13 /r", 1, 1 }, -{ "adc r64, r/m64", "rex.w 13 /r", 0, 1 }, -- cgit v1.2.1