I’m a 14-year-old developer from China, and today I want to share a crazy journey: I just finished designing and building a completely new programming language from scratch.
But I didn't do it alone. I used Tencent WorkBuddy(It also has an international version you can use), an AI coding assistant, to help me push through the heavy coding tasks. Today, I want to talk about the language's unique philosophy, the brutal bugs I faced, and how AI helped me build this.
🧠** The Core Philosophy: Immutability & Behavioral Contracts**
Instead of traditional weak typing, I wanted to see what would happen if a language strictly enforced immutable class templates and behavioral contracts. In this language, once an object is instantiated, its state cannot be arbitrarily modified. The goal was to achieve state safety without relying on a heavy Garbage Collector.
🐛** The Biggest Headache: Infinite Recursion**
The most painful bug I encountered was during method dispatch. I initially modeled closures as part of the class behavior (std::Behavior). However, when invoking a method, the dispatch mechanism tried to evaluate the closure object, which triggered another dispatch... leading to infinite recursion! 😅
After days of debugging, I finally solved it by separating closures and classes into two distinct object types. Closures now have their own execution path that bypasses the standard class method dispatch. It was a massive "Aha!" moment.
🤖** Enter WorkBuddy: My AI Co-Pilot**
Building a custom "philosophical interpreter" from scratch is incredibly complex. While the core architecture, type system, and the closure separation logic were entirely my own design, I used WorkBuddy to handle the heavy lifting.
WorkBuddy helped me:
Rapidly generate boilerplate code for the AST nodes.
Debug complex memory management issues in the interpreter.
Write test cases to ensure the behavioral contracts were actually enforced.
AI didn't design the language for me, but it acted as a senior pair-programmer, helping a 14-year-old turn a theoretical concept into a working reality.
It can even communicate with you while it is working to do things better. And its new built-in HY4-preview model is completely free to use these two weeks. It requires no credits and operates at a 0.00x consumption rate, so student friendly YIPPY!!!
🚀** What's Next?**
I have a working MVP, but I know there are edge cases and performance bottlenecks I might have missed. I would absolutely love to get feedback from experienced language designers and compiler engineers here!
🔗 Check out the GitHub Repo: Here is the LINK
If you've ever tried building a language, or if you have thoughts on separating closures from classes, please drop a comment below. Let's discuss!
(P.S. Feel free to roast my code in the comments. I'm here to learn!)
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (2)
求求你们这帮小孩哥小孩姐别卷了,不是12就是14岁,哈哈哈🤣加油,干的不错,未来是你们的
ty for 夸ing.