I am looking for extensional DCG test cases. Means test cases that check the right functioning of a DCG processor in terms of the behaviour of the resulting converted rules, and not in terms of its desugaring capability.
I think I saw some such test cases once on the net. But I lost track of them. Now I only find the following test cases:
http://www.sju.edu/~jhodgson/wg17/Drafts/DCGs/test_cases
(Same here: http://www.sju.edu/~jhodgson/wg17/dcgs.pdf)
But they are only perpherically and intensional, i.e. they test whether desugaring, the conversion, succeeds or gives an error. They even don't show what the conversion result should be, which doesn't bother me since I am anyway looking for extensional DCG test cases.
Any pointers welcome.
Bye
P.S:
This one shows the conversion, but it is still intensional
and not extensional:
http://www.sju.edu/~jhodgson/wg17/GRIND.TXT
And it has for example:
expand(( a(4)-->[98] ),
(a(4, S0, S1):- 'C'( S0,98, S1))).
expand(( a(28)--> \+b,c ),
(a(28,_608,_609):-(b(_608,_619)->fail;_617=_608),c(_617,_609))).
But many Prolog systems use a different approach for terminals, negation, etc.. in DCG. So an extensional test suite would be more handy.
Just completed a couple of extensional DCG test cases. The test cases do cover the following:
Predicate . / 4: Terminals
Predicate (-->) / 2: Non-Terminals
Predicate (,) / 4: Conjunction
Predicate (;) / 4: Disjunction
Predicate (->) / 4: Implication
Predicate (+) / 3: Negatio as Failure
Predicate ! / 2: Cut
Predicate {} / 3: Auxiliary Conditions
Some of the test cases check for steadfastness. The total number of test cases is: 56.
The test cases do not cover push back and meta calls inside DCG. The test cases make use of @/3 here and then, so that when using listing/[0,1] the original DCG code is seen and not the expansion of it. The @/3 is defined as follows:
@(X) --> X.
The test cases are inspired by: Moura, P. ed. (2010): Prolog, Part 3: Definite Clause Grammar Rules, Draft, ISO/IEC DTR 13211 3:2006, April 1, 2010