sd:tinyc_developer_diary
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| sd:tinyc_developer_diary [2026/04/22 16:13] – appledog | sd:tinyc_developer_diary [2026/04/22 17:14] (current) – appledog | ||
|---|---|---|---|
| Line 837: | Line 837: | ||
| These provide the test cases I used to check my compiler. In order. | These provide the test cases I used to check my compiler. In order. | ||
| - | === First | + | ==== First |
| < | < | ||
| int main(void) { return 0; } | int main(void) { return 0; } | ||
| </ | </ | ||
| - | === Symbol table | + | |
| + | ==== Symbol table | ||
| < | < | ||
| int main(void) { int a = 5; return a; } | int main(void) { int a = 5; return a; } | ||
| </ | </ | ||
| - | === Globals | + | 24 bit: |
| + | < | ||
| + | .clear | ||
| + | int main(void) { | ||
| + | int a = 0x123456; | ||
| + | return a; | ||
| + | } | ||
| + | .compile | ||
| + | .run | ||
| + | </ | ||
| + | |||
| + | ==== Globals | ||
| We can't define them when we make them. It seems like I did something wrong here but I don't know how to fix it. Just define them in main. Whoop de doo. | We can't define them when we make them. It seems like I did something wrong here but I don't know how to fix it. Just define them in main. Whoop de doo. | ||
| Line 857: | Line 869: | ||
| </ | </ | ||
| - | === function call | + | ==== function call |
| < | < | ||
| int a(int x) { return x + 1; } | int a(int x) { return x + 1; } | ||
| Line 873: | Line 885: | ||
| </ | </ | ||
| - | === Forward Declarations | + | ==== Forward Declarations |
| Single | Single | ||
| Line 892: | Line 904: | ||
| </ | </ | ||
| - | === Recursion | + | ==== Recursion |
| < | < | ||
| int even(int n); | int even(int n); | ||
| Line 901: | Line 913: | ||
| </ | </ | ||
| - | === Built-in functions | + | ==== Built-in functions |
| < | < | ||
| int main(void) { | int main(void) { | ||
| Line 909: | Line 921: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | === Re-wiring pointers | ||
| + | Unfortunately the changes were far more in depth than I expected, and I had to spend an additional ten hours going over the code to fix pointers, the lexer, and everything in between. Oh, and yet more emitters I forgot needed to be changed. Even the REPL itself didn't print out the full return value. This makes me reconsider my choice to go with a 16 bit system. Should the SD-8516 have been 32 bit? Maybe, maybe not. In the end, it works. A 16 bit system can run a 32 bit c, no problem. I mean, look at Commodore BASIC 2.0. It used floats for ints. Steve Wozniak even made a Sweet-16 so that it could use 16 bit registers. We can do 32 bit in the languages. No problem. We are not going to get any practical advantage from going 32 bit internal since we're running on WASM which is 64 bit native anyways. See? We can have our cake and eat it too here. | ||
sd/tinyc_developer_diary.1776874391.txt.gz · Last modified: by appledog
