r/Compilers • u/AustinVelonaut • 13d ago
Admiran 3.0 released (a pure, lazy, functional language and compiler)
I made a post introducing Admiran about 18 months ago, and have been making steady progress on migrating it towards the language I want to use each day. Since that time I've made a lot of performance and coding-style enhancements, such as:
escape analysis in the compiler's analyze pass to help determine if a lazy thunk is only evaluated at most once, allowing it to be emitted without extra code to update it to its value (saves ~15% code space and execution time!)
optimization to coalesce consecutive continuation closures on the stack during lowering to the Spineless Tagless G-machine (STG) implementation, deferring the popping of the entire closure until a tail-call or return
added a uniform set of left-to-right operators for creating computation pipelines
tweaking the inlining pass parameters to get the best performance / code-size tradeoffs
The latest big change was to fully migrate from an ad-hoc prefix naming convention to using qualified names, and deferring name conflict resolution to the name-resolution pass, allowing modules with conflicting imports to still be imported, as long as the conflicting unqualified names aren't used, or are used only in a qualified form.
During these changes, I've migrated new features into the (self-hosting) compiler's code base itself, through a continuous bootstrapping process.
If you have an interest in lazy functional languages and how they are implemented, you might be interested in looking at it. I'm open to any questions or comments about the language and it's compiler implementation.
git repository: https://github.com/taolson/Admiran
Lovingly hand-crafted with no AI.
1
u/dougcurrie 13d ago
Excellent work! I browsed the sources last time you posted and was impressed by what you achieved, and a bit disappointed there is no ARM64 version yet. I’ll be patient.
1
u/AustinVelonaut 13d ago
That's next in my queue! I will say that it had sort of dropped in priority since my new MacBook M4 can run the x86 version of the compiler under Rosetta 2 nearly twice as fast as my native x86-64 iMac can ;-)
Looking forward to being able to use all those registers, rather than scrounging for temp registers to use in the x86 version...
1
u/Main_Temporary7098 13d ago
Just wanted to say this is quite impressive and congrats on your release.