Skip to main content


Practicing writing games entirely using string rewriting for the first time. It's rewiring my brain, I've never seen a computing paradigm as powerful as that before. I'm at a loss for words-

The runtime is 200 lines, the game source reads like english, it's fast as hell, it vitrifies whatever examples is on rosetta code, even Prolog(You had one job?!).

tictactoe: https://git.sr.ht/~rabbits/modal/tree/master/item/examples/tictactoe.modal
runtime: https://git.sr.ht/~rabbits/modal/tree/master/item/src/modal.c
docs: https://wiki.xxiivv.com/site/modal
weep: https://rosettacode.org/wiki/Tic-tac-toe#Prolog

This entry was edited (7 months ago)
in reply to Devine Lu Linvega

I think I once commented on such a thing as one example of pattern matching, not necessarily in Modal, but in Feather, another language by wryl

either way, I really like it, reminds me of Puzzlescript and other rule-based systems

in reply to ThaCuber

@thacuber2a03 yeah! Feather is @wryl's more focused language, a bit further out of the tarpit.
in reply to Devine Lu Linvega

@wryl and I just realized this looks a lot like a functional programming language LOL
Unknown parent

Devine Lu Linvega
@datarama I agree with the Ur-Language, it feels very much like a primordial computering system, but with a slightly better UX than most of its genre. I haven't started to look into using this to output opcodes yet, but I'm hoping to dive into that soon. I might just make one or two more games in plain rewrite first ;)
Unknown parent

datarama

...as the main way you're encouraged to *think* about computation in it.

For example: What if an error report, rather than a line number and an error type, was a partially-reduced tree, where you can see exactly where the irritant went and its entire context, with runtime values? You could make a pretty sweet debugger in a rewrite-based language, I think.

(And many other programming tools, for that matter.)

Unknown parent

datarama

The reason I stopped my own experiments with it was mostly that if I wanted a rewrite system to have properties I could use for eg. compiling and optimizing (since rewrites are an expensive operation), then I'd have to restrict it ... and what I restricted it *to* would pretty much invariably end up being just another lambda calculus variant; just another functional language.

That said: I still think there's real value in rewrites as *part* of a language implementation, and perhaps...

in reply to Devine Lu Linvega

no shade on your code, i think it is fascinating and i love it

but to be fair to the prolog version, it implements a computer player, using the minmax algorithm to compute the best next move

not that you couldn't do it in modal! i'd love to see it in fact. betting it will still be way more concise and readable than the prolog version

in reply to a very weeny construct 💀

@pho4cexa I'd like to add a cpu, I started on it, but got caught up doing boat projects yesterday, I'll try to revisit that over the weekend. I'm curious to see what that would look like as well.
in reply to Devine Lu Linvega

ah, modal! Jeez. Fun. (looks for time behind bush at ground level).
in reply to Devine Lu Linvega

jeez. This all seems so meta to someone just chuffed to get pio statemachines to throw simple assembly at. To read pin states. I feel like a miner with a pickaxe.

Lo, thar be cookies on this site to keep track of your login. By clicking 'okay', you are CONSENTING to this.