Tsonnet, a humble beginning
I'm venturing into compiler territory this year – more specifically, writing a type system. I've never done that before and honestly have no idea how to do it, but I'll figure it out. It's gonna be fun! Sure, I've built interpreters for dynamically typed toy languages before, but never a fully featured typed language. What can I say? Sometimes I like to play in hard mode XD For the past 2 years, I've been working extensively with Jsonnet, a configuration language that augments JSON and helps eliminate repetition in our config files. It has its limits (many by design), which keeps the language simple to use. But there's one thing that keeps nagging at me when I'm deep in the code: what's the shape of the input or output of this function? And wouldn't it be great if we could type objects and completely ditch those validators checking value types? Having a compiler handle all that would be sweet. I'm not alone here – I've talked to plenty of folks who'd love this feature too. There have been some attempts to add types to Jsonnet, but nothing has materialized yet. So, I figured, why not implement Tsonnet myself and scratch my own itch? What’s the goal? I want to re-implement the Jsonnet specification following its design rationale while adding minimal, optional type definition features. The aim is to stay as compatible with Jsonnet as possible, without compromising type soundness. Ideally, Tsonnet and Jsonnet could be used interchangeably, as long as the Jsonnet code can be fully parsed into a valid Tsonnet AST. Adding types to Jsonnet, one compiler error at a time. Books about compilers that I’m currently reading I’m enjoying reading the book Modern Compiler Implementation in ML by Andrew W. Appel: Can't wait to hit the type system chapter – that's the stuff I'm most excited about right now! Planning to apply these techniques to Tsonnet soon. It's been my main learning source so far. As another option, I also have the book Engineering a Compiler, 2nd Edition by Keith D. Cooper, Linda Torczon on my radar: It's always good to have different perspectives, especially when you hit those inevitable roadblocks. Wish me luck! We’ll see how it goes. Expect to see more content about it here. Stay tuned! Thanks for reading Bit Maybe Wise! Subscribe for more Tsonnet-related posts in the future.
I'm venturing into compiler territory this year – more specifically, writing a type system. I've never done that before and honestly have no idea how to do it, but I'll figure it out. It's gonna be fun! Sure, I've built interpreters for dynamically typed toy languages before, but never a fully featured typed language. What can I say? Sometimes I like to play in hard mode XD
For the past 2 years, I've been working extensively with Jsonnet, a configuration language that augments JSON and helps eliminate repetition in our config files. It has its limits (many by design), which keeps the language simple to use. But there's one thing that keeps nagging at me when I'm deep in the code: what's the shape of the input or output of this function? And wouldn't it be great if we could type objects and completely ditch those validators checking value types? Having a compiler handle all that would be sweet. I'm not alone here – I've talked to plenty of folks who'd love this feature too.
There have been some attempts to add types to Jsonnet, but nothing has materialized yet. So, I figured, why not implement Tsonnet myself and scratch my own itch?
What’s the goal?
I want to re-implement the Jsonnet specification following its design rationale while adding minimal, optional type definition features. The aim is to stay as compatible with Jsonnet as possible, without compromising type soundness. Ideally, Tsonnet and Jsonnet could be used interchangeably, as long as the Jsonnet code can be fully parsed into a valid Tsonnet AST.
Adding types to Jsonnet, one compiler error at a time.
Books about compilers that I’m currently reading
I’m enjoying reading the book Modern Compiler Implementation in ML by Andrew W. Appel:
Can't wait to hit the type system chapter – that's the stuff I'm most excited about right now! Planning to apply these techniques to Tsonnet soon. It's been my main learning source so far.
As another option, I also have the book Engineering a Compiler, 2nd Edition by Keith D. Cooper, Linda Torczon on my radar:
It's always good to have different perspectives, especially when you hit those inevitable roadblocks.
Wish me luck!
We’ll see how it goes. Expect to see more content about it here. Stay tuned!
Thanks for reading Bit Maybe Wise! Subscribe for more Tsonnet-related posts in the future.
What's Your Reaction?