Cequals Documentation

Elliot Bruhl

Table of Contents


About


The Cequals language and compiler were made by Elliot Bruhl as a project to learn more about how compilers and computers work at a lower level. The compiler is written in the C programming language , and the output is x86 assembly, intended for the Win64 platform.

The Cequals language is not a very practical language, as there are certain important features that are implemented poorly or not at all. However, the language does serve as a good learning tool by providing a simple syntax and a literal, annotated assembly output.

This project was started in September 2024 and was completed in August 2025. The project was built in a series of phases, each lasting about a month. The first month was used to learn C and make the project’s lexer. The next month was used to set up the data structures that the AST (Abstract Syntax Tree) would use during the parsing phase. The next two months were used for parsing math operations and function calls. The rest of the constructions were parsed in the following month. Learning x86 assembly and writing the output code from the AST took another month. The remaining months were used writing the documentation, fixing bugs, and adding more features.

Setup Guide


Installing Other Tools

To compile and run Cequals programs, you must install these two tools:

Ensure that both are installed and added to your system's PATH. Verify the installation by running gcc -v and nasm -v in your command prompt.

Installing the Compiler

The Cequals compiler is available as a pre-compiled executable. You can download it from this folder on GitHub. Alternatively, you can compile it from the source code that is available at this folder on GitHub.

Setting Up and Compiling a Project

To set up a Cequals project, create a folder containing the Cequals compiler executable, an input file (e.g., setupTest.ceq), and an output file (e.g., setupTest.asm). Write your Cequals code in the input file. As an example, you can use the following code:

     func main() {
        return 0;
    }
To compile and run the project, open a command prompt in the project folder and run the following commands:

The Cequals Language


Declaring main

Declaring and Assigning Variables

Math Operations

Conditional Statements

While Loops

Declaring and Calling Functions

Calling External Functions

The Cequals Compiler


Main

Tokenizer

varTable/funcTable

Parser

Code Generation