Hello everyone,
I’m excited to introduce the alpha release of kcats, a fresh take on stack-based programming languages, inspired by the language Joy, designed with simplicity, learnability, and functionality in mind.
Our aim with kcats is to make it easier for anyone to write short programs for personal automation tasks. We believe that existing languages require learning too many specialized functions and concepts. Kcats addresses these issues by offering a streamlined alternative. Originally conceived as a scripting language for a forthcoming messaging protocol, it’s useful for general programming as well.
Key features of kcats:
Simplicity: kcats emphasizes fewer, general-purpose tools instead of a complex array of specialized ones. Its syntax uses words and bracket quotation marks [ and ], and no other symbols. It uses a few simple programming concepts including stacks, lists, functions, and pipes.
Introspective: The documentation, examples, and even the entire state of a running program, are data that can be queried and processed with the language itself. Kcats is its own debugger.
Powerful and Versatile: Despite its simplicity, kcats is designed to be a powerful tool capable of handling a wide range of programming tasks. The tools programmers use in other languages are there, and built from simple primitives - closures, error handling, metaprogramming, multithreading, channels, generators, i/o, and serialization.
A Focus on Tooling: kcats intends to make tool development, including IDEs and debuggers, as easy as possible.
As this is the alpha release, we eagerly welcome all feedback, contributions, and constructive criticisms from the community. We’re especially interested in improving the documentation and learning experience.
Join us in exploring this new language and contribute to making programming more accessible to everyone. Your feedback is essential to making it intuitive and easy to use!
Please check out our docs and alpha release here: https://github.com/skyrod-vactai/kcats
Happy coding!
Best, Skyrod
Hi! I created a stack-based language called kcats that is meant to be a simple and powerful language and good for small programs like this one. You can read more about it here: https://skyrod-vactai.github.io/kcats/book-of-kcats.html
Here's the solution in kcats (assumes the input is on the stack):
A bit of explanation: First place a mapping of opening bracket to its matching closing bracket on the stack. Then place the empty result which will be modified as we go. Float the input to the top of stack. Then an if statement. The first part of the if statement is the condition: look up the matching close bracket to the last item in the result, see if it equals the current character. If the condition is true, drop the current character and the last item in the result. If not, put the item into the result. Then 'step' runs that if statement on each character of the input. Finally, when we're done we don't need the mapping of matching brackets anymore, and we drop it.