[mercury-users] lisp macros
Manuel Hermenegildo
herme at clip.dia.fi.upm.es
Tue May 28 03:17:36 AEST 2002
> But for an example of the *kind* of thing that might be done this way,
> consider Definite Clause Grammar rules, which are precisely the kind of
> "hide the plumbing" technique I was describing. Come to think of it,
> the functional sublanguage is also an example. (I and many other people
> have term_expansion/2-based plugins that let you use functional syntax
> in Prolog.)
This is what I meant in my previous message: term_expansion-like
predicates allow you to hide away details and plumbing and raise
the level of abstraction of your programs. Examples are:
- functional (and higher-order) syntax,
- feature terms (i.e., records with named arguments),
- writing constraints in a nice syntax when the underlying plumbing
uses attributed variables and other nasty stuff,
- other control rules (the possible meta-interpretation is hidden
under the plumbing),
- expert system rules, fuzzy logic, ...
- etc.
These things can be done by the term_expansion predicate in
traditional Prologs. However, as I pointed out in the previous
message, since the first definition of term_expansion in Dec-10 Prolog
(late 70's, right Richard?) improved designs are available that are
more flexible and easier to use, and which allow you to define syntax
extensions on a per-module basis (this is the way in which Ciao Prolog
implements the extensions pointed out above).
The paper I pointed out explains in some detail (with code examples),
among other things, how to write expansions for feature terms and
fucntional syntax. The TR corresponding roughly to this paper:
@InProceedings{ciao-modules-cl2000,
author = {D.~Cabeza and M.~Hermenegildo},
title = {{A} {N}ew {M}odule {S}ystem for {P}rolog},
booktitle = {International Conference on Computational Logic, CL2000},
publisher = {Springer-Verlag},
series = {LNAI},
number = {1861},
year = 2000,
month = {July},
pages= {131--148}
}
can be downloaded from http://www.clip.dia.fi.upm.es if anybody is
curious enough. I think this would also be a good approach for
Mercury. It would not hurt to have some kind of standard for this
among logic languages, whatever it is...
Manuel
--
-----------------------------------------------------------------------------
herme at fi.upm.es | Manuel Hermenegildo
+34-91-336-7435 (Work) | Facultad de Informatica, UPM
+34-91-352-4819 or 336-7412 (FAX) | Universidad Politecnica de Madrid
http://www.clip.dia.fi.upm.es/~herme | 28660-Boadilla del Monte, MADRID SPAIN
-----------------------------------------------------------------------------
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list