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.
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,...]
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With