dicts and feature structures
"Abdallah, Samer" <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Hello all,
I've just been looking at Michael Covington's GULP library for SWI
http://www.ai.uga.edu/mc/gulp/
which compiles feature structures, of the sort found in unification
based grammars, into ordinary Prolog terms, and enables you to
write DCGs with named features instead of positional arguments
very neatly, for example, like this while reading Knuth's paper about
attribute grammars, "Semantics of Context-Free Languages" :
:- use_module(library(gulp4)).
bit(val~0) --> "0".
bit(val~1) --> "1".
bits(val~V..len~1) -->
bit(val~V).
bits(val~V..len~L) -->
bit(val~B),
bits(len~L1..val~V1),
{succ(L1,L), V is V1 + B*2^L1}.
It occurred to me that these feature structures are rather like
extensible records and SWI's new dict type, except for (crucially)
their behaviour on unification: unifying two feature structures
yields a structure with the union of the attribute names:
?- X=val~1, Y=len~2, X=Y.
X = Y, Y = val~1..len~2
This is what is useful in grammar processing, but for dicts, the
field names have to match exactly for unification to occur:
?- X=p{val:1}, Y=p{len:Z}, X=Y.
false.
Now that we have the dict type, would it make any sense to allow
a variant which unifies like a feature structure? Would there be
any advantage to baking it into SWI in some way or is Covington's
GULP library already good enough for those who want feature
structures?
cheers,
Samer
-------------- next part --------------
HTML attachment scrubbed and removed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.iai.uni-bonn.de/pipermail/swi-prolog/attachments/20140130/3967f0ec/attachment.bin>