Added description of how to build the compiler and projects.
This commit is contained in:
93
README.md
93
README.md
@@ -242,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!
|
C′ is young — contributions are very welcome!
|
||||||
|
|
||||||
@@ -256,7 +345,7 @@ Ideas:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# 📜 License
|
# License
|
||||||
|
|
||||||
MIT License — do what you want, just keep the copyright notice.
|
MIT License — do what you want, just keep the copyright notice.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user