4 ms·
Is there a good reason to still be using Prolog? I used Prolog back in the day, but is it still the tool of choice for some projects?
by dbcurtis 10y ago
Is there a good reason to still be using Prolog? I used Prolog back in the day, but is it still the tool of choice for some projects?
- justusw 10y agoUsing DCGs (https://en.wikipedia.org/wiki/Definite_clause_grammar https://en.wikipedia.org/wiki/Definite_clause_grammar), you can easily create grammars for automated document parsing and generation. You could even write a compiler (http://comjnl.oxfordjournals.org/content/34/1/64.full.pdf http://comjnl.oxfordjournals.org/content/34/1/64.full.pdf) or disassembler (http://www.dtic.mil/dtic/tr/fulltext/u2/a242987.pdf http://www.dtic.mil/dtic/tr/fulltext/u2/a242987.pdf) in Prolog fairly easy. All thanks to the really smooth support of tree-like structures. I do wonder why all this seems to be a little forgotten. Granted, the syntax and semantics are a bit unusual, but the expressive power can hardly be matched.
- agumonkey 10y agoThanks for these links. Another DCG tutorial http://www.pathwayslms.com/swipltuts/dcg/index.html http://www.pathwayslms.com/swipltuts/dcg/index.html
- dbcurtis 10y agoYour link lightly addresses one of my questions about using DCGs for parsing. How hard is it to get a sensible error message out of a DCG parser? I've basically written off LALR parsers because getting a reasonable error message out of them is about as much fun as repeatedly poking yourself in the eye with a sharp stick. Good old recursive decent using precedence climbing for expressions seems to be more maintainable in the long run for production parsers.
- infradig 10y agoProlog is my scripting language of choice for personal projects. Like HN uses a custom Lisp, I prefer doing stuff with my custom Prolog. But then, i'm a curmudgeonly old fart.