我如何运行序言文件

时间:2018-10-19 02:20:28

标签: prolog dcg

这是我第一次使用prolog编程,所以我不知道如何解决,我已经编写了代码,但是如何在prolog中执行代码:

id --> letter, digitsLetters.
digitsLetters --> digit, digitsLetters.
digitsLetters --> letter, digitsLetters.
digitsLetters --> [].

positive_digits --> sign, digits.
sign --> "+"; [].
digits --> digit; digit, digits.

letter --> "A"; "B"; "C"; "D"; "E"; "F"; "G"; "H"; "I"; "J"; "K"; "L"; "M".
letter --> "N"; "O"; "P"; "Q"; "R"; "S"; "T"; "U"; "V"; "W"; "X"; "Y"; "Z".
letter --> "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j"; "k"; "l"; "m".
letter --> "n"; "o"; "p"; "q"; "r"; "s"; "t"; "u"; "v"; "w"; "x"; "y"; "z".
letter -->  "_".

digit --> "0".
digit --> "1".
digit --> "2".
digit --> "3".
digit --> "4".
digit --> "5".
digit --> "6".
digit --> "7".
digit --> "8".
digit --> "9".

1 个答案:

答案 0 :(得分:0)

编译标签中

1。制作并保存

2。打开SWI-Prolog> File> Consult>现在打开上面保存的代码文件名将     像FileName.Pl

3。现在,键入您的方法名称及其参数,然后> Enter,