diff options
| -rw-r--r-- | LICENSE | 24 | ||||
| -rw-r--r-- | Makefile | 12 | ||||
| -rw-r--r-- | README | 22 | ||||
| -rw-r--r-- | godword.hc | 4 | ||||
| -rw-r--r-- | main.c | 34 | ||||
| -rw-r--r-- | voodoo.hc | 10 |
6 files changed, 105 insertions, 1 deletions
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 <https://unlicense.org/> diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d418b8b --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +all: obj link + +obj: + hcc -obj godword.hc + hcc -obj voodoo.hc + gcc -c main.c + +link: + gcc godword.o voodoo.o main.o -o testprog + +clean: + rm -f *.o testprog diff --git a/README b/README new file mode 100644 index 0000000..f4562c9 --- /dev/null +++ b/README @@ -0,0 +1,22 @@ +HolyC is a programming language created by the late Terry A. Davis + +This is a demo of James Barford's HolyC compiler, `hcc`. + +`hcc` just converts everything to straight assembly and passes it to `gcc`, which +i'm pretty sure just hands that off to GAS. + +you can get a copy of it here: https://holyc-lang.com/install + +to run this demo: + + 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 apparently even a built-in JSON class. + +crazy stuff \ No newline at end of file diff --git a/godword.hc b/godword.hc new file mode 100644 index 0000000..b32ca20 --- /dev/null +++ b/godword.hc @@ -0,0 +1,4 @@ +U0 godword() +{ + "Let there be light!\n"; +} diff --git a/main.c b/main.c index 67159ba..fcbafce 100644 --- a/main.c +++ b/main.c @@ -1,8 +1,40 @@ #include <stdio.h> +extern int voodoo(); /* from vd.hc */ +extern void godword(); /* from gw.hc */ + int main(void) { - puts("Hello, world!"); + 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/voodoo.hc b/voodoo.hc new file mode 100644 index 0000000..126db88 --- /dev/null +++ b/voodoo.hc @@ -0,0 +1,10 @@ +I32 voodoo(I32 testval) +{ + if (testval == 1) { + return 0; + } else if (testval == 0) { + return 1; + } + + return 69; +} |
