An implementation of Terry A. Davis's HolyC
"Hello, world!\n";Full documentation for the language can be found here: https://holyc-lang.com/
This compiler is built from scratch in C. Currently it is non optimising, converting the AST to x86_64 assembly code which is fed into gcc to assemble.
Currently the this will compile x86_64 assembly and works on linux and intel
macs.
This has been tested on an intel mac and linux ubuntu on amd. Most x86_64
architectures should be supported. Creating an IR and compiling to ARM
is high on the TODO list.
Run make, then run make install (sudo make install on linux) this will
install the compiler and holyc libraries for strings, hashtables, io, maths
etc... see ./src/holyc-lib/
autokey word for type inference, an addition which makes it easier to write code.cast<type>can be used for casting as well as post-fix type casting.breakandcontinueallowed in loops.- You can call any libc code with
extern "c" <type> <function_name>
This is a non exhuastive list of things that are buggy, if you find somethings please open an issue or open a pr.
- using
%ffor string formatting floats not work - memory management for the compiler is virtually non-existant, presently all the tokens are made before compiling which is very slow.
- line number in error messages is sometimes off and does not report the file
- function pointers in a parameter list have to come at the end
- Variable arguments are all passed on the stack
A lot of the assembly has been cobbled together by running gcc -S -O0 <file>
or clang -s O0 <file>. Which has been effective in learning assembly, as
has playing with TempleOS. The following are a non-exhaustive list of compilers
and resources that I have found particularly useful.
Find me on twitch: https://www.twitch.tv/Jamesbarford
