EDIT: changed "Forth" to "ConcatenativeLangauge"
-
I am a big fan of Rust's type system (struct, enum traits, borrow checker)
-
There are times I also like the succintness of ConcatenativeLanguage's stack based system.
-
Has anyone managed to implement a ConcatenativeLanguage-dsl as Rust macros?/////
Note: I am not asking for ConcatenativeLanguage interpreter in Rust or ConcatenativeLanguage VM in Rust. I want the "ConcatenativeLanguage" to be operating directly on Rust primitives and to go through Rust's type checker.
I an mentally thinking that we can abuse Rust's tuple support as a "typed stack" (since most ConcatenativeLanguage words tend to not use too many stack elements anyway).
Ideas / thoughts?
Please no comments of "why the $&@( would you want to do that" -- those are not particularly useful. What I am interested in is -- if we tried to do this, what can we achieve by abusing Rust's macros and what interesting DSLs can we get?