diff --git a/Makefile b/Makefile index 262c18b..65bb852 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,8 @@ LDFLAGS += -lm OUT := eaxhla +PLUG := tool/plug + SOURCE.d := source OBJECT.d := object @@ -67,26 +69,22 @@ bootstrap: ./library/bootstrap.sh test: ${OUT} - #fcpp -C -LL debug/xop.eax > debug/xop.eax.pp #${WRAP} ./${OUT} debug/xop.eax - #./${OUT} debug/xop.eax # NOTE as of now broken, but only because of undefined instructions - #${WRAP} ./${OUT} debug/artimetrics.eax - #@echo -e "\033[31;1m --- ERROR TESTING BEGINS BELOW ---\033[0m" - #debug/error_test.sh - #./${OUT} debug/heyo_world.eax ORIGIN="$$(realpath .)" PATH="$$(realpath .):${PATH}" cmdtest -clean: +clean: unplug -rm ${OUT} ${OBJECT} ${GENOBJECT} ${GENSOURCE} ${OBJECT.d}/%.pp: debug/%.tcl debug/instructions.tcl tclsh $< > $@ +unplug: + ${PLUG} -u -d token_list '' -d scanner_instructions '' -d parser_rules '' source/eaxhla.l source/eaxhla.y + plug: ${OBJECT.d}/token_list.pp ${OBJECT.d}/scanner_instructions.pp ${OBJECT.d}/parser_rules.pp - plug -u -d token_list '' -d scanner_instructions '' -d parser_rules '' source/eaxhla.l source/eaxhla.y - plug -g -e token_list ${OBJECT.d}/token_list.pp source/eaxhla.y - plug -g -e scanner_instructions ${OBJECT.d}/scanner_instructions.pp source/eaxhla.l - plug -g -e parser_rules ${OBJECT.d}/parser_rules.pp source/eaxhla.y + ${PLUG} -g -e token_list ${OBJECT.d}/token_list.pp source/eaxhla.y + ${PLUG} -g -e scanner_instructions ${OBJECT.d}/scanner_instructions.pp source/eaxhla.l + ${PLUG} -g -e parser_rules ${OBJECT.d}/parser_rules.pp source/eaxhla.y .PHONY: test clean bootstrap diff --git a/documentation/DEADLINES.md b/documentation/DEADLINES.md deleted file mode 100644 index 3bf26f6..0000000 --- a/documentation/DEADLINES.md +++ /dev/null @@ -1,3 +0,0 @@ -# DEADLINES - -- EAXHLA Stable By 24/07/26: Waiting. diff --git a/documentation/TODO.md b/documentation/TODO.md index 67344e9..2eacf04 100644 --- a/documentation/TODO.md +++ b/documentation/TODO.md @@ -1,4 +1 @@ -+ {} is the new artimetric -+ [] is the new dereference + terrible infinit error on ../debug/comment\_as\_space.eax -+ arrays diff --git a/source/eaxhla.y b/source/eaxhla.y index 0f7c74c..8ec8559 100644 --- a/source/eaxhla.y +++ b/source/eaxhla.y @@ -361,7 +361,7 @@ instruction: INOP { append_instruction_t1(NOP); } | ITSUB register register { append_instruction_t6( SUB, $2.size, REG, $2.number, REG, $3.number ); } | ITXOR register register { append_instruction_t6( XOR, $2.size, REG, $2.number, REG, $3.number ); } | ITCMP register register { append_instruction_t6( CMP, $2.size, REG, $2.number, REG, $3.number ); } - | ITMOV register immediate { append_instruction_t6( MOV, $2.size, REG, $2.number, IMM, (int)3 ); } + | ITMOV register immediate { append_instruction_t6( MOV, $2.size, REG, $2.number, IMM, (int)$3 ); } // #placeholder END ; diff --git a/debug/instructions.tcl b/tool/instruction_generator/instructions.tcl similarity index 100% rename from debug/instructions.tcl rename to tool/instruction_generator/instructions.tcl diff --git a/debug/parser_rules.tcl b/tool/instruction_generator/parser_rules.tcl similarity index 98% rename from debug/parser_rules.tcl rename to tool/instruction_generator/parser_rules.tcl index a8b7b47..c96c575 100644 --- a/debug/parser_rules.tcl +++ b/tool/instruction_generator/parser_rules.tcl @@ -11,7 +11,7 @@ proc make_parser_rules {is} { } "immediate" { dict set r enum "IMM" - dict set r value "(int)$n" + dict set r value "(int)$$n" dict set r size "32" } "memory" { diff --git a/debug/scanner_instructions.tcl b/tool/instruction_generator/scanner_instructions.tcl similarity index 100% rename from debug/scanner_instructions.tcl rename to tool/instruction_generator/scanner_instructions.tcl diff --git a/debug/token_list.tcl b/tool/instruction_generator/token_list.tcl similarity index 100% rename from debug/token_list.tcl rename to tool/instruction_generator/token_list.tcl diff --git a/tool/plug b/tool/plug new file mode 100755 index 0000000..a60479a --- /dev/null +++ b/tool/plug @@ -0,0 +1,239 @@ +#!/usr/bin/python3 +# "PlacehoLder Un- and Generator" + +import sys +import re +from enum import Enum, auto + +C = {} # ANSI colors + +def has_color(): + import os + return "color" in os.environ.get('TERM') + +def def_colors(): + global C + C = { + 'b': '\033[34m', + 'y': '\033[33m', + 'g': '\033[32m', + 'r': '\033[31m', + 'm': '\033[35m', + 'B': '\033[1m', + 'R': '\033[7m', + 'n': '\033[0m', + } + +def undef_colors(): + global C + C = { + 'b': '', + 'y': '', + 'g': '', + 'r': '', + 'B': '', + 'n': '', + 'R': '', + 'm': '', + } +undef_colors() + +class Error(Enum): + PARAM_MISS = auto() + UNK_FLAG = auto() + IO = auto() + UNK_OPT = auto() + UNTERM_DEF = auto() + NO_FILES = auto() + MULTI_OP = auto() + NO_OP = auto() + +def usage(): + print( +'''{C[g]}{C[B]}{argv0}{C[n]} {C[B]}{C[y]}({C[b]}-g{C[y]}|{C[b]}-u{C[y]}) {C[B]}{C[y]}({C[b]}