Hacker News new | ask | show | jobs
by bluejekyll 1862 days ago
Could you achieve that with a language that has a sufficiently decent meta-programming option, like a macro system? It sounds like what you want is a compile time validated state machine.
2 comments

Writing a language from scratch is not that different from writing a DSL using powerful macro systems. Does such a DSL already exist?
It depends on what you're looking for. Based on my usage of Rust, I would say that it's proc_macro system is more than capable enough for use-cases like this, and macro_rules migth even be enough.

But lots of languages offer similar capabilities, Nim, Racket, Scala, Julia, Lisp, etc.

in C++ it's simple enough that you can build one accidentally https://philippegroarke.com/posts/2020/constexpr_fsm/ :p