有没有办法在ECLiPSe Prolog中使用module/2? [英] Is there a way to use module/2 in ECLiPSe Prolog?

查看:104
本文介绍了有没有办法在ECLiPSe Prolog中使用module/2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在SWI-Prolog中,我正在使用诸如开头的代码 模块文本文件:

In SWI-Prolog, I am using code such as at the beginning of a module text file:

:- module(foo, [bar/2]).
:- use_module(library(jack)).

我不想更改我的代码.我怎么能没用 ECLiPSe序言(*).是否有一些库定义了 ECLiPSe Prolog中的module/2指令?

I don't want to change my code. How can I neverthelss use ECLiPSe Prolog (*). Is there some library that defines a module/2 directive in ECLiPSe Prolog?

最好的问候

(*) http://eclipseclp.org/

推荐答案

以下代码定义了一个宏,该宏将module/2映射为module/3指令:

The following code defines a macro that maps module/2 into module/3 directives:

:- export macro((:-)/1, translate_directive/2, [top_only]).
translate_directive(
    (:- module(Module, Exports)),
    (:- module(Module, Exports, [swi]))
).

在编译为SWI编写的模块之前编译(或导入)此文件.请注意,模块/3的第三个参数必须包含一个语言模块,与您的模块所写的方言相对应.我在这里使用了swi,其他选择是quintus或ECLiPSe的本机eclipse_language.

Compile (or import) this before compiling the module written for SWI. Note that the 3rd argument of module/3 must contain a language module, corresponding to the dialect your module is written in. I have used swi here, other choices would be quintus, iso or ECLiPSe's native eclipse_language.

这篇关于有没有办法在ECLiPSe Prolog中使用module/2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆