在SML/NJ中增加打印深度

17

我想让SML/NJ在顶层打印结果,而不是到处放置#号。

根据一些旧文档(以及2001年在该新闻组发布的帖子),可以使用Compiler.Control.Print.printDepth来实现。

然而,在SML / NJ版本110.7上,这只会导致错误:

- Compiler.Control.Print.printDepth := 100;
stdIn:1.1-30.8 Error: unbound structure: Control in path Compiler.Control.Print.printDepth
1个回答

18

您可能希望在未来更加精确。例如,您可以提供一些示例输出和上述信息的链接。

如果我正确理解了您的问题,那么下面的最后一行就是您的问题?(代码片段)

- datatype tree = leaf | node of int * tree * tree;
datatype tree = leaf | node of int * tree * tree 

- val t = node (1, node (2, node (3, leaf, leaf), leaf), leaf);
val t = node (1,node (2,node #,leaf),leaf) : tree 

那么您需要的是 Control.Print 模块。只需删除 Compiler 部分并使用即可。
Control.Print.printDepth := 100;

请注意,这是针对SML/NJ的特定内容,而不是针对ml-yacc本身。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接