I wrote a translator that can convert some simple PHP programs to Prolog.
This is a possible input program:
function is_greater_than($a,$b){
return $a > $b;
}
function is_an_animal($a){
return in_array($a,["dog","cat"]);
}
... and this is the output program:
is_greater_than(A,B) :-
A>B.
is_an_animal(A) :-
in_array(A,[1]).
This translator is just a proof of concept, but it can still simplify the conversion of some simple PHP programs to Prolog.
source
share