0
我想了解在關於Prolog DCG規則的這種特殊情況下會發生什麼。規則是:Prolog DCG短語錯誤
fizz_buzz(Msg) --> anything, fizz(Msg), anything, buzz, anything.
anything --> [].
anything --> [_], anything.
fizz(Msg) -->
"fizz",
{
format('At fizz we have Msg=~w~n', [Msg])
}.
buzz -->
"buzz".
run :-
atom_codes("blah blah fizz blah buzz", Codes),
phrase(fiz_buzz(Msg), Codes),
write(Msg).
,並得到:
ERROR: phrase/3: Undefined procedure: fiz_buzz/3
ERROR: However, there are definitions for:
ERROR: fizz_buzz/3
我只是無法找到正確的「這句話」來運行該語法。 我犯了什麼錯誤?
我怎麼能錯過呢?坦克再次。 – RRBaldi