Error while loading Logtalk into JIProlog

Tips and tricks when running Logtalk using JIProlog as the back-end compiler

Moderator: Paulo Moura

Post Reply
Monikuta
Posts: 13
Joined: Mon May 12, 2008 9:02 am

Error while loading Logtalk into JIProlog

Post by Monikuta » Mon Jun 02, 2008 9:23 am

I tried loading Logtalk into JIProlog by calling:

Code: Select all

{roots(loader)}.
but I keep getting the following error message:

Code: Select all

<<< loading source file bintree... 
>>> compiling source file bintree...
compiling object bintree... 
  ERROR!    unknown_error
            in clause: map(_26219432, _33204885, _30747539) :- map(_26219432, _33204885, _30747539, _2087546)
Could you please help me solve this problem? I really need Logtalk combined with JIProlog for my bachelor degree thesis.
I have finished the Checkers game Java J2ME implementation and also the computer player's part in Logtalk having SWI-Prolog as the back-end Prolog compiler and they work fine.
What I have to do know is to integrate the computer player from Prolog into J2ME using JIProlog.

I would greatly appreciate your help.
Yours sincerely,
Monica Dogaru

Paulo Moura
Logtalk developer
Posts: 475
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Error while loading Logtalk into JIProlog

Post by Paulo Moura » Mon Jun 02, 2008 10:19 am

Hi Monica!

Trying to reproduce the problem you describe results in my case in a "jvm_error('Java heap space')" when compiling the object "bintree". Trying to load only the library object "bintree" results in the same error you describe above. Changing the caluse for the map/3 to:

Code: Select all

map(Pred, Old, New) :-
     map1(Pred, Old, New, _).
allows the "bintree" to be compiled without errors. You've found another JIProlog bug. I'm going to send Ugo a bug report.

Best regards,

Paulo
Paulo Moura
Logtalk developer

Monikuta
Posts: 13
Joined: Mon May 12, 2008 9:02 am

Re: Error while loading Logtalk into JIProlog

Post by Monikuta » Mon Jun 02, 2008 12:08 pm

I did the modification you suggested.
But I get the following error:

Code: Select all

compiling object bintree... 
  ERROR!    error(type_error(numeric_expression), context(','(:: ',') > 0, file(undefined, 0)))
            in clause: map(_10290053, t(_5384363, _32249502, _12647886, _5694431), t(_9068888, _16570805, _3743881, _8851935), _27681911) :- _27681911 =.. [_10290053, _5384363 - _32249502, _9068888 - _16570805], once(_27681911), map(_10290053, _12647886, _3743881, _17684228), map(_10290053, _5694431, _8851935, _27223263)
Is this an error in JIProlog?....cause in SWI-Prolog it worked fine.
Monica Dogaru

Paulo Moura
Logtalk developer
Posts: 475
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Error while loading Logtalk into JIProlog

Post by Paulo Moura » Mon Jun 02, 2008 3:47 pm

Hi Monica!

You forgot to propagate the change to the definition of predicate map/4, renaming it to map1/4.

Best regards,

Paulo
Paulo Moura
Logtalk developer

Monikuta
Posts: 13
Joined: Mon May 12, 2008 9:02 am

Re: Error while loading Logtalk into JIProlog

Post by Monikuta » Mon Jun 02, 2008 4:18 pm

I made the following modifications:

Code: Select all

:- private(map1/4).
	:- meta_predicate(map1(*, *, *, ::)).
	:- mode(map1(+atom, +tree, -tree, -callable), zero_or_one).
and

Code: Select all

map(Pred, Old, New) :-
		map1(Pred, Old, New, _).


	map1(Pred, t(Key1, Value1, Left1, Right1), t(Key2, Value2, Left2, Right2), Goal) :-
		Goal =.. [Pred, Key1-Value1, Key2-Value2],
		once(Goal),
		map1(Pred, Left1, Left2, _),
		map1(Pred, Right1, Right2, _).
        map1(_, t, t, _).   
but I still get the following error:

Code: Select all

 ERROR!    unknown_error
            in clause: map(_11831860, _14522837, _10385830) :- 'map1'(_11831860, _14522837, _10385830, _4502232)

error(error(unknown_error, clause(:-(map(_15282457, _26642894, _3240908), 'map1'(_15282457, _26642894, _3240908, _11102634)))), logtalk_load(bintree))
Can you help me please?
Monica Dogaru

Paulo Moura
Logtalk developer
Posts: 475
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Error while loading Logtalk into JIProlog

Post by Paulo Moura » Mon Jun 02, 2008 8:41 pm

Hi Monica!

The error you're getting is due to some JIProlog bug. As much I would like to help you, I cannot spend my limited developer time debugging JIProlog. The debugging features of this Prolog compiler are limited and diagnosing its bugs implies hours of work. JIProlog simply does not seem to be reliable enough for your work (at least in its current release; the previous one I tested did not have the bugs we uncover in the last weeks). My guess is that, even if this bug is found and fixed, another bug will just pop up. My advice is for you to switch, if possible, to a well maintained Prolog compiler.

Best regards,

Paulo
Paulo Moura
Logtalk developer

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest