top | item 46628084

(no title)

rahimiali | 1 month ago

It's neat to see an attempt at writing a compiler in Python without using a compiler toolkit and without writing it in Haskell. But also, I think you're running past some of the hard problems without solving them.

For example, your while-loops here

https://github.com/AGDNoob/axis-lang/blob/main/code_generato...

look like they might not be able to nest, since they assume the condition is always in eax and the loop doesn't push it down. So you'll need some kind of register allocation, which is a terrible pain in x86.

Also, I think it's worth coming up with an opinion about what other system programming languages are missing. And do the minimum work to provide that as a proof of concept, rather than trying to build a competitor to Zig right out of the gate. For example, maybe you have a perspective on a datastructure that should be a first class citizen, or maybe you've discovered the next best construct since async. Having that kind of vision might help focus the effort.

discuss

order

AGDNoob|1 month ago

Thanks, that's fair criticism. You're right about the while-loop thing, that code was very naive and did break with nesting. I actually ran into exactly the pain you described and ended up fixing it the hard way. It was one of the moments where I realized how quickly you start fighting the architecture instead of working on the language itself. About the bigger point: I agree with you, and that's kind of the direction I'm drifting towards now. I'm not really interested in competing with Zig feature-for-feature. What I'm more interested in is whether there's a different mental model for system programming that feels simpler. I originally planned to add pointers, but they gave me massive headaches. That was exactly the point where "low-level" and "simple" started to completely collide in my brain. The more I tried to make pointers feel clean, the more complex everything became. So the current idea I'm exploring is: what if you could write system-level code without having to think in memory addresses at all, but still keep things explicit and predictable? More like thinking in values and state changes, instead of locations in memory. That's still very much an experiment, but that's the "missing opinion" I'm trying to test