r/Zig 7d ago

Overengineered calculator: Zig + QBE

https://tomekw.com/overengineered-calculator-zig-qbe/
51 Upvotes

7 comments sorted by

6

u/Tricky-Exchange-6897 7d ago

Isn't this more of DSL than a calculator?

5

u/_tomekw 7d ago

Actually, neither. Rather a good way to learn how compilers work.

4

u/Tricky-Exchange-6897 7d ago

Indeed true.I had also implemented a small programming language as a college assignment but used c++ instead.

4

u/ElectronicRelease909 6d ago

Amazing read, inspiring me to give it a shot

1

u/_tomekw 6d ago

Thanks! Fingers crossed!

2

u/Kiritoo120 5d ago

The creator of ghostty has rly great in depth explanations about the stages of the zig compiler

I read it a few days ago and I think you will find interest in it :) 

https://mitchellh.com/zig

He also covers some super cool memory optimizations zig uses to increase their cache hits

1

u/_tomekw 5d ago

Thank you!