/holyc

Holy C compiler. Targets LLVM.

Primary LanguageC++GNU Affero General Public License v3.0AGPL-3.0

hclang: HolyC Compiler/LLVM Frontend

HolyC is a C variant that extends the language to support a simpler, less dense syntax.

Example:

// U0 is void
U0 Main() {
    U8 *myStr = "Hello, World!";
    "This is my message: %s", myStr; // Printfs do not need a function call,
                                     // strings that are themselves statements
                                     // are interpreted as prints
}

// Code can exist outside of functions. Any code that is outside a function
// is executed first from top to bottom.
Main; // Function calls do not need to have parenthesis if there are no arguments

This project aims to implement most of HolyC for Linux (where no complete compiler currently exists). Some features, like executing code from a string, will not be implemented as they require a JIT compiler, however this project is strictly an AOT compiler (that feature in particular is also a big security risk).

See this page for more thorough comparison of C and HolyC.

Building

Dependencies

  • LLVM toolchain (at least version 14)
git clone https://github.com/Ma11ock/holyc --recurse-submodules
cd holyc
mkdir bin && cd bin
cmake ..
make -j3

The final binary will be in src/hclang.

Feature completeness

FeatureStatus
LexerComplete
ParserComplete
LLVM BakcendComplete
Math expressionsComplete
External SymbolsComplete
Intrinsic ValuesPartial (No floats yet)
FunctionsComplete
CommentsComplete
While LoopsComplete
For LoopsComplete
If-then-else StatementsComplete
PointersComplete
StructuresNone
EnumsNone
UnionsNone
PreprocessorNone