Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prolog DCGs Multiple Features?

From what I understand, in Prolog you capture features while parsing like so:

 foo(feature(X)) --> [X], bar.

Is this common when designing DCGs ?

 foo(featureA(X), featureB(Y)) --> [X], [Y], bar.
like image 202
dnolen Avatar asked Jun 30 '11 00:06

dnolen


1 Answers

DCGs describe relations between lists and the non-terminals' arguments. However, these arguments are just terms. They can be used to represent features but do not represent them directly. To see the difference, imagine you want to associate a feature numerus to each node. In DCGs you have now to decide, case by case, how to represent that feature. In one node it is feature(X, singular) and in another node it might look different. Or you might decide to represent all features uniformly with a list, thus [nodename=idx,..., numerus=singular,...].

like image 165
false Avatar answered Sep 30 '22 19:09

false