Re:Annotated implementation of microKanren: an embeddable lo...
by giraffe_lady on Wednesday May 25, 2022 @05:42PM
(#31510986)
Ahhhh this is extremely helpful, thank you. I've been puzzling at the mud parsing thing because while it's in the shape of natural language (and somewhat annotated in it eg there is spurious "decorative" information), it does represent a 1:1 mapping with computation already.
This feels like a much better path than trying to get it into an AST with like yacc or whatever. But since it isn't actually natural language NLP didn't seem right either. I've got a lot of reading to do but this is very interesting.
Re:Annotated implementation of microKanren: an embeddable lo...
by YeGoblynQueenne on Wednesday May 25, 2022 @07:26PM
(#31512203)
I started a comment about DCGs also before seeing rscho's and mncharity's comments above which covered it. If you're going to do any parsing, I don't think there's any better tool than DCGs. It blows my mind that everyone is still trying to kludge their way around regexes instead, when there is such a better tool around.
Your mud language is probably a "Controlled Natural Language", btw:
https://en.wikipedia.org/wiki/Controlled_natural_language
Game languages often are.
Re:Annotated implementation of microKanren: an embeddable lo...
by mncharity on Wednesday May 25, 2022 @06:16PM
(#31511393)
> you have to check out eDCGs.
https://github.com/kamahen/edcg , https://occasionallycogent.com/prolog_edcgs/index.html
Re:Annotated implementation of microKanren: an embeddable lo...
by mncharity on Wednesday May 25, 2022 @06:18PM
(#31511415)
> You probably won't use them,
Curious - I fuzzily recall usually ending up manually threading state (eg, doing a Perl-Compatible Regular Expression engine (apropos "why LP?" - it was just a page of code, with good performance)), but I don't recall what drove that decision...
Generally speaking, you'll see the same pattern for any problem involving searching a space of potential solutions. In a word, the strength of LP is flexibility when facing the unkown (future feature requirement).
EDIT: you mention parsing. If you're planning anything context-sensitive, you have to check out eDCGs. You probably won't use them, but they'll give you an idea of what's possible.