TempleOS: The Controversial Project With Over 100,000 Lines of Code

TempleOS, The JIT OS written in Holy C

Share This Post

TempleOS: The OS Built By A One-Man Army

You have probably heard of C, C++ and C#. But have you heard of Holy C? In 2019, a friend had jokingly told me to code up our homework in Holy C. When I searched for the documentation on this language, I quickly found out that this project has a lot of history.

The story behind Holy C and TempleOS is both fascinating and sad at the same time. Behind this project was a talented programmer who designed a programming languageeditor, compiler, kernel and various programs from scratch over the span of a decade. The programmer behind it all was schizophrenic and the inspiration behind the project comes from what he believed was God telling him to build the “Second Temple” (hence, TempleOS).

Rather than embellish on Terry Davis’s mental health, medical diagnoses and actions, I will only cover the technical details and code examples in this post. The language and operating system are impeccable feats that many would presume impossible to do without a team. Considering the time period, the storage reduction and performance boost Davis was able to achieve is phenomenal. In fact, this operating system could have competed in popularity among developers.

What is Holy C?


Holy C is a programming language designed by Terrence Andrew Davis, who lived from 1969 to 2018. This language is a derivation of C and is designed to exclusively run in the TempleOS environment.

Davis spent over one decade developing an operating system. Davis’s TempleOS project is actually one of the most complex undertakings a single person has ever completed. With over 100,000 lines of code in a language entirely designed by Davis, this decade-long project is a feat of ingenuity. The OS is free and open-source on GitHub and archive.org if you want to check it out. 

Holy C Syntax

I like to think of the syntax of Holy C as a combination of C and Python, but with an emphasis on Assembly. The language itself is quite impressive, considering the available resources Davis had on hand, but it only compiles and runs inside of the TempleOS environment. This is because Holy C is non-standard C/C++ and it will not run correctly on other operating systems that do not support Holy C.

NOTE: Big thank you to Harrison Totty for demo-ing a variety of examples! There are several links to resources, however, I couldn’t seem to find one that was online except for Harrison’s. I will showcase some of Harrison’s functions and introduce new ones in this post.

In short, Holy C supports numeric types including unsigned integers (Ex. U8), integers (Ex. I8) and floating point numbers (F64). Integers and unsigned integers can have 8, 16, 32 and 64 bits, whereas floating point numbers only have 64 bits.

					U0 HelloWorld()
    Print("Hello World");


Additionally, U0 represents a void type, which is more in-tune with the void type in Rust than it is the original C which takes up 1 bit of memory. One of the coolest features is Davis’s take on positional and default arguments. Unlike Python where you must declare your required arguments first and optional arguments last, Holy C allows you to order these however you please

					// Returns the largest number
I32 Max(I32 a=2, I32 b)
    switch (a) {
        case (a < b): return a;
        case (b > a): return b;
    return a;

In addition to variable arguments (U0 FunctionName(…)  and reference argc and argv[]), Start/End keywords for sub-switch statements and the #exe directive to run code from other libraries, this language is quite impressive. Not only does it have the capabilities of running an Operating System, but it can certainly support various desktop applications.

					// Sub Switch Statements
// Source from Harrison Totty
U0 SubSwitch ()
    I64 i;
    for (i=0;i<10;i++)
        switch(i) {
            case 0: "Zero ";     break;
            case 2: "Two ";      break;
            case 4: "Four ";     break;
                case 1: "One";   break;
                case 3: "Three"; break;
                case 5: "Five";  break;
                "] ";


// Implicit Print Statements
// Source from Harrison Totty
U0 PrintMessage(char *first, char *last)
    "Hello person!\n";
    "Your name is %s %s.\n", first, last;

// Variable Arguments
// Open-Source
I64 Multiply(...)
    I64 i, total = 0;
    for (i = 0; i < argc; i++)
        total *= argv[i];
    return total;

I64 val = Multiply(2, 3, 4, 5, 6);

Where To Download?

On the public GitHubMidnoclose notes that you should learn C first and then study the dialect of Holy C since it is non-standard. You are also cautioned that this may not make sense since Davis did suffer from schizophrenia.

While some of Davis’s comments are a little esoteric, Holy C can be followed with relative ease if you have a decent background in C programming already. Since this language was entirely designed by one individual, you’ll see omissions from C and additions based around Davis’s opinions on the original C language which is also neat.

What Makes TempleOS Technically Special?

One of the features I haven’t talked about yet is the Just In Time (JIT) compilation features. Similar to Python, Holy C will compile and run files, meaning you can make changes to the core files of the OS, reboot and see the live changes.

Additionally, you do not need to have a main function; the syntax is similar to Python where functions can be declared wherever in the file and any operation outside of functions will be executed from the top-down.

Be sure to check out the TempleOS page and download the virtual image of the operating system. You can install it on a 64-bit processor machine or use a virtual machine to run the program. Davis also included several games onto the operating system which is a nice touch you can try out as well.

That's weird... something went wrong. Please try again.
Welcome to the R U Coding Me Newsletter!

R U Coding Me Newsletter

Subscribe to our newsletter and stay updated.

We use Brevo as our marketing platform. By Clicking below to submit this form, you acknowledge that the information you provided will be transferred to Brevo for processing in accordance with their terms of use

Are You Coding?

If the answer is no, you’re probably missing out on a large opportunity here. And yes, I said the name!

Our FREE developer resources will help you start programming. Additionally, consider applying for mentorship to accelerate you to your career. Click on the Student button below to get started. It will take you to our available courses and any relevant materials to help get you started.

Ready to take your business to the next level? Creating a robust solution in a short amount of time is hard to do if you’ve never done it before. Plus, why should you juggle yet another project with your business? Click on the Business button below if you’re looking to scale your current business online but don’t want to spend a few years to learn how to do it. It will take you to our services so you can see what would best work for you.

More To Explore
Learn C Programming
Multidimensional Arrays in C With Example

FacebookTweetPinLinkedInEmail Wait, You Said There Wouldn’t Be Any More Pointers! No, if you recall from last time, I mentioned there could be pointers that point

R U Coding Me LLC