Compare commits
2 Commits
b51eaed858
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| e7a4245a6d | |||
| 9a75ada5aa |
94
README.md
94
README.md
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user