From 12be649bb7868a0b513e107e95125e89061a8ba3 Mon Sep 17 00:00:00 2001 From: "jazz (gitea)" Date: Thu, 26 Feb 2026 14:57:24 -0600 Subject: [PATCH] initial commit --- .gitignore | 2 ++ LICENSE | 24 ++++++++++++++++++++++++ Makefile | 13 +++++++++++++ README.md | 24 ++++++++++++++++++++++++ gw.hc | 4 ++++ main.c | 40 ++++++++++++++++++++++++++++++++++++++++ vd.hc | 10 ++++++++++ 7 files changed, 117 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 gw.hc create mode 100644 main.c create mode 100644 vd.hc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cda1fde --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.o +testprog diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..efb9808 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1bb7652 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +all: obj link + +obj: + hcc -obj gw.hc + hcc -obj vd.hc + gcc -c main.c + +link: + gcc gw.o vd.o main.o -o testprog + +clean: + rm -f *.o testprog + diff --git a/README.md b/README.md new file mode 100644 index 0000000..fe0a55d --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# it works lol + +the HolyC-lang compiler `hcc` just converts everything to straigh tassembly +and passes it to `gcc`, which i'm pretty sure just hands that off to the GNU +Assembler `as`. + +you can get a copy of it [here](https://holyc-lang.com/install) + +## run that shit + +``` +make +./testprog +``` + +If you take a peep at `Makefile` you'll notice that `hcc` can't compile multiple +objects in a single command. It also doesn't know when you've passed multiple +`.hc` file arguments, so it only processes the last one. + +HolyC actually has some surprisingly rich features, like vectors, hashtables, +and even a built-in JSON class. + +crazy stuff + diff --git a/gw.hc b/gw.hc new file mode 100644 index 0000000..b32ca20 --- /dev/null +++ b/gw.hc @@ -0,0 +1,4 @@ +U0 godword() +{ + "Let there be light!\n"; +} diff --git a/main.c b/main.c new file mode 100644 index 0000000..fcbafce --- /dev/null +++ b/main.c @@ -0,0 +1,40 @@ +#include + +extern int voodoo(); /* from vd.hc */ +extern void godword(); /* from gw.hc */ + +int +main(void) +{ + int t; + int f; + int g; + + t = voodoo(1); + f = voodoo(0); + g = voodoo(4); + + puts("voodoo() is a HolyC function."); + puts("If we pass 1 to it, it should return 0."); + puts("If we pass 0 to it, it should return 1."); + puts("For any other value, it should return 69."); + + puts("Tests:"); + + printf("pass 1, want 0 --> t = %d\n", t); + printf("pass 0, want 1 --> f = %d\n", f); + + printf("pass 4, want 69 --> g = %d\n", g); + + puts(""); + puts("Is this divine intellect?"); + puts(""); + + puts("Now let's try printing to stdout."); + puts("We are going to call godword(), a void-returning function."); + puts("If this works correctly, it should say something biblical:"); + + godword(); + + return 0; +} diff --git a/vd.hc b/vd.hc new file mode 100644 index 0000000..126db88 --- /dev/null +++ b/vd.hc @@ -0,0 +1,10 @@ +I32 voodoo(I32 testval) +{ + if (testval == 1) { + return 0; + } else if (testval == 0) { + return 1; + } + + return 69; +}