Reflecting on this

This commit is contained in:
Dominik Moritz Roth 2026-01-11 11:36:47 +01:00
parent c66bed3dee
commit 96c543672b

View File

@ -20,3 +20,9 @@ A variation of asm.py to emulate a MiMa (minimal machine). No, the compiler can
### asmCust.py ### asmCust.py
Does not work (I think...) Does not work (I think...)
---
I wrote this before learning about compilers or such, accidentally invented some things I learned about later. Making stuff up as I went along led to very bad code, no sensible abstractions. Basis were mostly Minecraft redstone-computer tutorials.
I even made the same mistake with the current compiler implementation as early versions of Pascal:
We don't support self recursion (neither direct nor indirect) as we store return addresses for function calls in memory slots specific to functions. Any self recursion thus overrides the return pointer of an outer invocation with the address for the inner invocation. Returning from the outer function call thus steps down again leading to an infinite loop. The beta compiler (if actually functional) solves this the way the Pascal devs did back then: Using a stack for return pointers. The concept of local vars / scoping via stack is still missing thought.