From 670871345e6d178f974f55c50aeab2af8297067f Mon Sep 17 00:00:00 2001 From: Liam Waldron Date: Tue, 6 Feb 2024 09:29:19 -0500 Subject: [PATCH] working compiler maybe --- compiler/hell.l | 14 ++++++++++++- compiler/hellc | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100755 compiler/hellc diff --git a/compiler/hell.l b/compiler/hell.l index bd0c7b0..5467261 100644 --- a/compiler/hell.l +++ b/compiler/hell.l @@ -7,8 +7,20 @@ local { printf("static"); } "str" { printf("char"); } - /* Library declarations */ + /*** Library declarations ***/ + + /* ioutils */ "hell:std.ioutils" { printf(""); } "hell:std.ioutils.writeln" { printf("printf"); } "hell:std.ioutils.readln" { printf("scanf"); } + + /* keygen */ + +"hell:std.keygen" { printf(""); } +"hell:std.keygen.gen" { printf("keygen_gen"); } + + /* rng */ + +"hell:std.rng" { printf(" ${INFILE}.new + if [ "$?" != 0 ]; then + printf "${0}: error: HELL preprocessor failed to run\n" + exit 1 + fi + + printf "compiling ${INFILE}\n" + gcc ${INFILE}.new -o ${INFILE} + if [ "$?" != 0 ]; then + printf "${0}: error: C compiler failed to run\n" + exit 1 + fi + + printf "finished compiling\n" + exit 0 + ;; + -*|--*) + usage_small "$@" + exit 0 + ;; +esac + +usage_small "$@" +exit 1