💾 Archived View for soviet.circumlunar.space › ayb › G › devlog_0.gmi captured on 2024-07-09 at 00:17:32. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
I've started the backend by writing a small assembler for the ABC code and a disassembler to test it. Currently it doesn't check the type of arguments, however it should be straight forward to implement it using a list which would contain the types of arguments.
I've also started a simple backend for x86_64 CPUs, it doesn't build basic blocks nor DAGs, since the goal is just to have an implementation working as fast as possible. Currently, a backend has only to provide functions for each instruction, so it modulable. I am not sure about the layout I'll adopt in memory. Because we could just allocate 2 blocks of memory instead of having only one and each stack at an end to have a similar treatment of the A and the B stacks, the C stack being the regular one. Since, we won't allocate more than 4G by stack we could optimize the A Stack by using 32 bits pointer, relative to the root of Heap. A possibility would be to allocate everything in the bss section and avoid dynamic allocation in the heap. I have not yet starting thinking about the garbage collection mechanism, however the book² provides several methods. I'll probably write it in C instead of assembly so I will only have to change a few things when porting it to new platforms, since the only things which should change are the structure of the nodes and size of the structures.
For the syntax, it's really similar to Haskell and Clean with the addition of Agda's mifix operators and a bit more of verbosity because I found Haskell's syntax which can be cryptic by moment. So it will be indentation based where only tabs have semantic meaning to be able to align code with spaces without changing the behaviour of the program.
For the IO, it will probably have a system with uniquness typing - if it can be added to HM - à la Clean. Maybe some operators will be provided as syntaxic sugar to mimic Monadic IO's look.
http://www.mbsd.cs.ru.nl/publications/papers/1990/groj90-CodeGenerator.ps.gz
Functional Programming and Parallel Graph Rewriting (especially part 4)