Compare commits

..

2 Commits

Author SHA1 Message Date
e7a4245a6d Added description of how to build the compiler and projects. 2025-11-18 12:11:35 +01:00
9a75ada5aa test 2025-11-17 16:11:12 +01:00

View File

@@ -13,6 +13,7 @@ The C compiler does the rest.
🧩 **Drop-in compatibility** with existing C toolchains
🛠 Uses **TinyCC**, GCC, or Clang to compile the output
---
### Why C?
@@ -241,7 +242,96 @@ The compiler itself is written in **clean C99** using a tiny standard library of
---
# 🤝 Contributing
## 🏗 Build Flow Overview (How C Compiles)
C uses a **three-stage build pipeline**:
```
[1] Build the preprocessor → [2] Translate C → C → [3] Build C output
```
### 1 — Compile the Preprocessor Compiler
The script:
```
scripts/compilePreprocessor.sh
```
Compiles all code in `/source` into a standalone binary:
```
/binaries/preprocessor
```
This binary **is the C compiler**.
It takes `.cprime` projects and rewrites them into pure C99 source.
---
### 2 — Convert C code into pure C99
All example/demo projects live in:
```
/application/source
```
The script:
```
scripts/runPreprocessor.sh
```
runs the freshly built compiler on a demo project and outputs C files into:
```
/application/demos/<demo-name>/
```
The structure stays clean: every project has its own demo folder.
---
### 3 — Compile the generated C99 project
The script:
```
scripts/compileApplication.sh
```
compiles the generated C99 code using **TinyCC (tcc)** and links any needed libraries.
This produces final runnable binaries in:
```
/binaries/
```
---
### In short
```
+----------------+ +------------------+ +----------------------+
| Your C source | --> | C Preprocessor | --> | Pure C99 + Binaries |
| (application) | | compiler | | (example.opengl, etc)|
+----------------+ +------------------+ +----------------------+
^ ^
| |
/application/source /binaries/preprocessor
```
You can automate everything through the helper menu program in `/scripts/menu.c`.
---
# Contributing
C is young — contributions are very welcome!
@@ -255,7 +345,7 @@ Ideas:
---
# 📜 License
# License
MIT License — do what you want, just keep the copyright notice.