akkartik / mu

Soul of a tiny new machine. More thorough tests → More comprehensible and rewrite-friendly software → More resilient society.
http://akkartik.name/akkartik-convivial-20200607.pdf
Other
1.35k stars 47 forks source link

New syntax for segment headers #33

Closed akkartik closed 5 years ago

akkartik commented 5 years ago

Fixes #29.

Right now SubX defines headers with the following syntax:

  === ...

The ... can be either a numeric address or a name. Numeric addresses are useful for tests where we want to check addresses of individual instructions. Names are useful in real programs where we want to add to a segment in many places.

This approach has long seemed a mess. It's hard to explain, and there's a certain amount of historical evolution that led to it that should be irrelevant to comprehend the current state of the codebase. I started out assuming the first segment was always code, before adding the special names 'code' and 'data'. We pretend to support more than two segments but we don't really.

To simplify the code and explanation we'll move to a new syntax:

  === <name> <address>

Code will always belong in the special name 'code', but it no longer has to be first.

We need to migrate both our SubX-in-SubX phases and the C++ version. The plan is to start from the top down and update bootstrapping phases that've already been built (see commit 5102 for the list of phases). Then update the core C++ implementation which should be easier.

Contact me if you'd like to contribute. Commit access freely given.