3.4 Sinflarni bog’lash
Endi biz uchta yaratgan sinfimizni bir biriga bog’laymiz. Bu uchun biz Main sinfini yasab olamiz. Main sinfiga quyidagi dasturni kiritamiz.
/***********************************
Project Name: tratactus
UI Strategy: console
************************************/
implement main
open core, console, semantic
class predicates
test:().
clauses
classInfo("main", "tratactus").
test() :-
german::phr(T, ["die", "Welt", "ist", "alles"], _X),
write(T), nl, english::phr(T, Translation), !,
write(Translation), nl.
test().
run():- console::init(), test().
end implement main
goal mainExe::run(main::run).
Dasturimizni ishlatib ko’ramiz xatoligi bo’lmasa, bizga quyidagicha oyna hosil bo’ladi.
(3.5 rasm) Prologda semantic dasturini ishga tushgandan so’ng natijasi
Do'stlaringiz bilan baham: |