Scryer-prolog: Strategies for implementing `term_expansion` and `goal_expansion`

Created on 30 Aug 2018  路  9Comments  路  Source: mthom/scryer-prolog

I'm now debating how to go about implementing support for Definite Clause Grammars. One way is to use term_expansion and goal_expansion, once I have them.. but that seems messy. I have the impression that systems like SICStus implement them from scratch. Any thoughts on this?

Most helpful comment

BTW, what about joining ISO/IEC JTC1 SC22 WG17 officially? As far as I understood CAS, there are no fees involved!

All 9 comments

SICStus is quite traditional in this respect. To my understanding this is only about term_expansion. However, SICStus 4 has term_expansion/6 and not term_expansion/2. What is quite essential is that properties like steadfastness are respected.

I'll be in Toronto from Sep 6th to Wed 19th.

I do sometimes go to Toronto, but unfortunately I won't be in Toronto then. I'm usually in Fredericton.

... just realized we are currently about 1500km apart...

BTW, what about joining ISO/IEC JTC1 SC22 WG17 officially? As far as I understood CAS, there are no fees involved!

Mark, do you have an e-mail I can send you further informations to?

I see that implementing DCGs with term rewriting is completely straightforward now. term_expansion is much trickier to implement in that I don't understand what's expected from a user standpoint.

What I now have will expand all terms that match the set of term_expansion/2 clauses defined so far, whether they appear at the user level or in a module. I don't understand why SISCstus bothers to distinguish between term_expansion and user:term_expansion. The docs don't imply user:term_expansion is used for anything other than expanding query terms, unlike term_expansion, which is not applied to query terms at all. goal_expansion and user:goal_expansion are unclear to me as well.

From a user's perspective, it is convenient to define expansions that are local to a module.

See for instance CLP(Z) for a Prolog module that uses term expansions both internally within the module, and also defines global expansion rules in user that affect "external" application code.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

notoria picture notoria  路  3Comments

notoria picture notoria  路  4Comments

UWN picture UWN  路  3Comments

dcnorris picture dcnorris  路  3Comments

XVilka picture XVilka  路  3Comments