← Back to context

Comment by z500

1 month ago

I've been taking a look at my sound change applier again. I've been trying to add syllable detection to it so that I can match directly on syllable boundaries instead of having to match on them explicitly in my sound change rules.

So I started by adding the ability to define syllable structure in the rules file, then I tried running the syllable rule through the same compiler I used for the regular sound change rules. It ended up being even slower than I was anticipating, so I decided to skip the NFA to DFA conversion step and wrote a backtracking NFA runner. This worked _okay_, but if the syllable rule isn't able to fully match a word it ends up backtracking forever, and I never managed to figure out how to fix that.

Last year I read a post about parser combinators and I decided to rewrite the syllable detector. I finished the rewrite and then ran into an error and gave up. This last weekend I revisited it and it turned out it was just user error again; my syllable definition rule had a mistake, but thankfully the error was a lot easier to fix with the new design. Now it emits a warning, and I'm rewriting my sample sound changes rules to use the new boundary markers and hammering out any issues, which are a lot less than I was afraid of.

I'm thinking about rewriting the sound change rule compiler to use the same combinators I did for the syllable rules, but it would be kind of a shame after all the work I put into the DFA compiler lol

https://github.com/marriola/Transmute