简体   繁体   English

扩展DCG测试案例

[英]Extensional DCG Test Cases

I am looking for extensional DCG test cases. 我正在寻找扩展的DCG测试用例。 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. 表示根据所得到的转换规则的行为检查DCG处理器的正常运行的测试用例,而不是其脱除能力。

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 http://www.sju.edu/~jhodgson/wg17/Drafts/DCGs/test_cases
(Same here: http://www.sju.edu/~jhodgson/wg17/dcgs.pdf ) (同样在这里: http//www.sju.edu/~jhodgson/wg17/dcgs.pdf

But they are only perpherically and intensional, ie 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. 他们甚至没有显示转换结果应该是什么,这不会打扰我,因为我无论如何寻找扩展的DCG测试用例。

Any pointers welcome. 欢迎任何指示。

Bye 再见

PS: This one shows the conversion, but it is still intensional and not extensional: PS:这个显示转换,但它仍然是内涵而不是扩展:
http://www.sju.edu/~jhodgson/wg17/GRIND.TXT 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. 但是许多Prolog系统在DCG中使用不同的终端,否定等方法。 So an extensional test suite would be more handy. 因此,扩展测试套件会更方便。

Just completed a couple of extensional DCG test cases . 刚刚完成了几个扩展的DCG测试用例 The test cases do cover the following: 测试用例包括以下内容:

Predicate . 谓词。 / 4: Terminals / 4:终端
Predicate (-->) / 2: Non-Terminals 谓词( - >)/ 2:非终端
Predicate (,) / 4: Conjunction 谓词(,)/ 4:连词
Predicate (;) / 4: Disjunction 谓词(;)/ 4:分离
Predicate (->) / 4: Implication 谓词( - >)/ 4:含义
Predicate (+) / 3: Negatio as Failure 谓词(+)/ 3:Negatio为失败
Predicate ! 谓词! / 2: Cut / 2:切
Predicate {} / 3: Auxiliary Conditions 谓词{} / 3:辅助条件

Some of the test cases check for steadfastness. 一些测试用例检查坚定性。 The total number of test cases is: 56. 测试用例总数为:56。

The test cases do not cover push back and meta calls inside DCG. 测试用例不包括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. 测试用例在这里使用@ / 3,这样当使用listing / [0,1]时,可以看到原始的DCG代码,而不是它的扩展。 The @/3 is defined as follows: @ / 3定义如下:

@(X) --> X.

The test cases are inspired by: Moura, P. ed. 测试案例的灵感来自:Moura,P。ed。 (2010): Prolog, Part 3: Definite Clause Grammar Rules, Draft, ISO/IEC DTR 13211 3:2006, April 1, 2010 (2010):Prolog,第3部分:明确的条款语法规则,草案,ISO / IEC DTR 13211 3:2006,2010年4月1日

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM