sd:tinyc-1
Differences
This shows you the differences between two versions of the page.
| sd:tinyc-1 [2026/04/14 06:09] – created appledog | sd:tinyc-1 [Unknown date] (current) – external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | = TinyC-1 | ||
| + | |||
| + | This page is about bootstrapping TinyC-1, a typical bootstrapping C compiler, in assembly language, on your own custom architecture -- in this case, the SD-8516 | ||
| + | |||
| + | == The Plan | ||
| + | Well, I wrote the SD-8516, I spent a long time trying to implement BASIC on it, and then I did Forth. Forth was a lot easier than BASIC. In any case I learned quite a bit, and I think i'm up to the task of tackling C now. Pound for pound, it is not terribly difficult as long as you start with some very basic goals. | ||
| + | |||
| + | int main(void) { return 0; } | ||
| + | |||
| + | The first goal is simply to compile int main(void) { return 0; } and iterate from there. This at first glance seems simple, but if you attempt to do it " | ||
| + | |||
| + | * 1. Basic REPL (interpreter prompt). | ||
| + | ** There' | ||
| + | * 2. Paste-in editing | ||
| + | ** The autotyper is the easiest way to get source into the system right now. It will take what's typed in the REPL and paste it against what it already has. We can do OPFS later maybe. | ||
| + | * 3. The Lexer | ||
| + | ** The Lex Luthor to my Superman. The hardest part. Can we do this token by token? Do we need to build an AST? I don't even know what that is right now. | ||
| + | * 4. Parser | ||
| + | ** According to my research I need a parser. | ||
| + | * 5. Emitter | ||
| + | ** Like Forth, we have to emit code. It shouldn' | ||
| + | |||
| + | === The REPL | ||
| + | Based on BASIC' | ||
| + | |||
