Hi everyone! I’m currently building a custom programming language called Swiq using C++.
Most modern languages rely entirely on standard garbage collection or strict block scoping. When I designed Swiq, I wanted to give developers first-class semantic keywords to handle state management natively at the language level.
What makes Swiq unique?
Swiq tracks both the current state and the instantiation state of your data. Here are a few unique features I've built into the memory management system:
- Native Archiving: You can stash a variable away into a hidden memory space and safely pull it back whenever you need it.
- Instant Resetting: Swiq remembers the initial value used when a variable was first created, allowing you to instantly reset it to its default state.
- Explicit Closures: Functions allow explicit variable closure capturing, much like C++ lambdas.
A Quick Look at the Syntax
Here is a quick look at how clean it is to handle variable states, archiving, and resetting in Swiq:
set var score = 100;
// Modify it
set score = 150;
// Need a backup state? Archive it!
archive score;
// Score is now safely stashed away. Bring it back natively:
restore score;
// Want to revert to the very first value?
reset score; // score is now back to 100
Check out the project!
Swiq is an open-source project and is still actively under development. I built the custom interpreter and Abstract Syntax Tree (AST) completely from scratch in C++.
You can check out the source code, read the documentation, or contribute here:
👉 github.com/bananakitssu/Swiq
I would love to hear your thoughts on this approach to state management. What features or use cases would you like to see next?





















