duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 197fd5e4f114f4b5ea88f605098625adea132a57
parent c78f9c88cbc5a4bb51e6bc2f5d3c8e2f2b51d478
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Wed, 15 Jun 2022 19:18:00 -0400

Add fs/doc/cc.txt

Diffstat:
MREADME.md | 2+-
Mfs/doc/arch.txt | 2+-
Afs/doc/cc.txt | 26++++++++++++++++++++++++++
3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md @@ -80,7 +80,7 @@ type are simple Forth words. Here's the plan so far: 1. Have a 32-bit Forth written in x86 run on top of of a Linux system. -2. Create an ANSI C compiler that is partly written in Forth and has the +2. Create a pseudo C compiler that is partly written in Forth and has the peculiarity of bootstrapping itself from it. No binary except Dusk's core. 3. Run as PID 1 on top of a Linux kernel. 4. Target a machine and have it run bare metal on it. diff --git a/fs/doc/arch.txt b/fs/doc/arch.txt @@ -30,7 +30,7 @@ flag (1=immediate). Native words don't save registers they use. For Forth words, it doesn't matter much because all words are "atomic". Once they return, register values don't -matter anymore. Some native words call each other and this this case, careful +matter anymore. Some native words call each other and in this case, careful threading is necessary, but otherwise, it works well as is. When other languages are concerned, however, this attribute becomes important diff --git a/fs/doc/cc.txt b/fs/doc/cc.txt @@ -0,0 +1,26 @@ +# Dusk OS C compiler + +The C compiler is a central piece of Dusk OS. It's written in Forth and is +loaded very early in the boot process so that it can compile drivers we're +about to use. + +This compiler needs to meet two primary design goals: + +1. Be as elegant and expressive as possible in the context of a Forth, that is, + be an elegant fallback to Forth's shortcomings. +2. Minimize the work needed to port exiting C applications. + +It is *not* a design goal of this C compiler to be able to compile POSIX +applications without changes. It is expected that a significant porting effort +will be needed each time. + +Because of the first goal, we have to diverge from ANSI C. The standard library +will likely be significantly different, the macro system too. Both will +hopefully fit better with Forth than their ANSI counterpart. + +But because of the second goal, we want to stay reasonably close to ANSI. The +idea is that the porting effort should be mostly a mechanical effort and +it should be as little prone as possible to subtle logic changes caused by the +porting. + +For this reason, the core of the language is the same.