Re:Turning the IDE Inside Out with Datalog
by tannhaeuser on Sunday July 19, 2020 @06:56AM
(#23888494)
There's a proposal due to the prolog-commons initiative for a dictionary-like object (that is also implemented in SWI Prolog, I believe).
And in Prolog you can, of course, just trivially use your own term structure for item-values:
p([ item : "value", ... ])
You could even use JSON-like terms in Prolog (with maybe a little help by the op/3 directive to sort out parsing priorities): A_Prolog_Term = {
x: y,
z: [a, b, {1, d} ]
}
But the more fundamental approach IMHO would be to use nested knowledge-base terms: p(
q(whatever).
r(X) :- q(X).
).
As pioneered in the 1980s for attribute grammars, using ^^ and other special graph tokens as nested "implies" operator, though (see "definite-clause translation grammars").
Re:Turning the IDE Inside Out with Datalog
by tom_mellior on Sunday July 19, 2020 @05:54AM
(#23888233)
Agreed on the niceness of the keyword syntax, I would very much like to have than in Prolog too. SWI-Prolog has record-like data structured called dicts (IIRC) but you can't use them directly as clause heads the way the article does.
I noticed you (assuming you're the author) used what looks like a non-traditional Datalog syntax – which makes sense to me as, IMO, Datalog/Prolog desperately need first-class support for a record-like syntax to finally break into mainstream. Is there any prior work to this syntax, or did you just develop it as you needed it?