4 ms·
This is cool but I never understand most DSLs, looks like most of them can just be defined as some functions in your host language. The example on the main page
by slmjkdbtl 2y ago
This is cool but I never understand most DSLs, looks like most of them can just be defined as some functions in your host language. The example on the main page just looks like JavaScript and you define the parallel(), radial() functions yourself to return some data, and a run() function to deal with these data / run the game. Writing a compiler and VM for this is a huge overkill imo, if it aims to be productive and not just a programming practice. Am I missing something?
- anonymoushn 2y agoA run() function to deal with the data is an interpreter (the data has stuff like calls to the wait function and subroutines in it) or at least a command-replayer, if the control flow all runs before any gameplay happens. The behavior might also be dynamic such that the command-replayer approach doesn't work. One reason BulletML is useful compared to a general-purpose language is that you could arbitrarily recombine BulletML ASTs to produce valid bullet patterns, which Kenta Cho did for rRootage[0]. I think another reason that people implement VMs for these languages is that the host language lacks coroutines, so it cannot express the wait() function, and they don't want to turn their bullet pattern code inside-out. Even if the host language has coroutines, they may not be serializable, so saving your game in the middle of a level may not be possible if you build on top of coroutines, whereas it is definitely possible if you control the interpreter state of your DSL. [0]: https://www.asahi-net.or.jp/~cs8k-cyu/windows/rr_e.html https://www.asahi-net.or.jp/~cs8k-cyu/windows/rr_e.html
- jayd16 2y agoI find that a lot of DSLs are essentially "I need these N languages features in a serializable and dynamically runnable language." If you're already in a scripting language its not all that interesting but if you're in a compiled language, a small embedded DSL can scratch an itch. Even in JavaScript, you might not want the full power of eval() exposed and instead you want something with less power that can be parsed and sanitized.
- fitsumbelay 2y ago> Writing a compiler and VM for this is a huge overkill imo Personally, that's what attracts the artist side of me to this, like it's the ultimate creative product. There seems to be a lot of blogging and tweeting recently around the subject has also created a bit of an itch.
- slmjkdbtl 2y agoI understand where you're coming from. I also value a lot on the artistic side of a project, but if you compare to a project like 100r's uxn, a lot of custom language / vm projects fall a bit short on both the creative and utility sides. But still, I'm all for creating things just for oneself or just for the pleasure of creating it.
- fitsumbelay 2y agofair I'm curious how you feel uxn fails as a utility (eg. missed stated goals? or unstable and therefore not practical? ) and as a creative product tho it'll be hard to take comments on the latter as objective.
- slmjkdbtl 2y agoOh I'm using uxn as an example for great creativity and utility (but I guess the utility is mostly for the creator and dedicated fans)
- fitsumbelay 2y agoI totally misread your reply, thanks I see what you mean