This repository contains a simple compiler built in TypeScript for a completely custom language. Please note that this compiler is not intended for practical use but serves as a reference implementation for understanding the basic concepts of compiler design and construction. It was developed as a personal learning project to explore the inner workings of compilers.
Table of Contents
Understanding how compilers work is a complex yet essential aspect of programming language development. This project aims to provide insights into the compilation process by implementing a compiler for a custom language using TypeScript.
The project structure is organised as follows:
src/
: Contains the source code of the compiler.
Lexer/index.ts
: Implements the lexer for tokenisation.Parser/index.ts
: Implements the parser for creating an abstract syntax tree (AST).Generator/index.ts
: Implements the generator for generating x86-64 Linux assembly code.main.ts
: Entry point for the compiler.examples/
: Includes sample source code files written in the custom language.Clone the repository to your local machine using the following command:
git clone https://github.com/SalemC/creagle-compiler
cd creagle-compiler
npm install
npm run build
npm run run ./relative/path/to/your/creagle/file
Contributions to improve the code, add features, or fix bugs are welcome. If you find any issues or have suggestions, please open an issue.
This project is licensed under the MIT License. Feel free to use the code for educational purposes or as a reference.