davidgiven / cowgol

A self-hosted Ada-inspired programming language for very small systems.
BSD 2-Clause "Simplified" License
247 stars 20 forks source link

Status of the project? #120

Open slaykachu opened 3 years ago

slaykachu commented 3 years ago

Fascinating project! I'd like to achieve something similar (more context)

I have seen some recent changes here, I'd love to know what is planed next.

davidgiven commented 3 years ago

Thanks!

The last change was to remove the requirement of passing subroutine parameters on the stack, to make it more friendly for non-stack-based architectures. I've recently been nerd sniped by a weird 8051 architecture with 16-bit extensions that'd be interesting to make a code generator before and that should be helpful there.

The next main thing which needs doing is to rewrite the assembler. The current version is a quick hack and it only supports absolute files, which means that generating code for e.g. 68000 architectures (Amiga and Atari ST) is difficult. As I already have a flex and lemon port to Cowgol used by the main compiler, the obvious thing is to reuse those and use a real parser. That should also, I hope, make it easier to make assemblers for new architectures (like my weird 8051).

For long term goals, generating better code is always good, but this is very much limited by the statement-at-a-time code generation. For example, keeping values in registers is hard because there's no way to know when they're going to be used next. This probably wants some thought...