DCGs and threads

William Pippin pippin at cis.ohio-state.edu
Fri Mar 27 02:16:15 AEDT 1998


About special syntax for threads:

> Better still, I think there should be a specialized syntax for
> declaring DCG predicates, ideally some variation on the EDCG
> notation.  There should also be a special syntax for calling DCG
> predicates from non-DCG code; maybe something like phrase/2,3 in Prolog.
> Then the current practice of declaring and calling DCG predicates with
> 2 extra arguments should be phased out.

Would it be as convenient as Van Roy's threads package is for Sicstus prolog?
Or can such a package be made to work with Mercury?

I have some Prolog with _lots_ of accumulator pairs, and have been
considering trying to port it to Mercury, but don't want to go back
to manually threading acc-pairs in term traversals.

By the way, the threads package allows threads, thread methods, and
thread-using predicates to be declared; the threads are named accumulator
pairs, the thread methods are goals applied to the pairs, and of course
the thread predicates are expanded by term_expansion/2 to thread the
acc-pairs.  Since the acc-pairs are referred to by name in goals, the {}
escape mechanism (my least favorite part of DCGs, after the limit to one
pair, of one type, with two methods, i.e. lists with cons and list difference
append) is rarely needed.

Thanks,

Bill Pippin




More information about the users mailing list