Re: [eclipse-clp-users] Consult failure

From: Alexandre Saidi <Alexandre.Saidi_at_...37...>
Date: Wed, 24 Aug 2011 16:28:36 +0200
Hi all,
Juste one "grammatical" remark. Kish and Joachim replied on ECLIPE part.
 To Jan Burse : When you put (I dropped parameters to focus on the grammatical aspects)

	Expr : "-" , Term , Expr_rest.
	Expr : Term , Expr_rest.
	Expr_rest : 


You'll not be able to validate expressions like "a + - b".
Put the unary '-' (or '+') at the Term level.
	
cheers
Alex

	

Le 19 août 2011 à 15:50, Joachim Schimpf a écrit :

> Kish Shen wrote:
>> Hi Jan,
>> 
>> On 18/08/2011 17:23, Jan Burse wrote:
>>> 
>>> expr(Z) -->  "-", !, term(X), {Y is -X}, expr_rest(Y,Z).
>>> expr(Y) -->  term(X), expr_rest(X,Y).
>>> 
>>> expr_rest(X,T) -->  "+", !, term(Y), {Z is X+Y}, expr_rest(Z,T).
>>> expr_rest(X,T) -->  "-", !, term(Y), {Z is X-Y}, expr_rest(Z,T).
>>> expr_rest(X,X) -->  [].
>>> 
> ...
>> 
>> So the error is because the grammar rule you wrote is not valid for 
>> ECLiPSe -- this is because ECLiPSe have proper strings (as an atomic 
>> type), so the strings such as "." are real strings, and not list of 
>> ASCII code, and this is causing the error.
> 
> 
> To be more concrete: to make your rules work with ECLiPSe,
> you can either
> 
> (1) use one of the compatibility libraries, i.e. prefix a directive like
> 
> :- lib(iso).	% alternatively cprolog,quintus,swi,...
> 
> 
> (2) or change the meaning of the quotes explicitly, using
> 
> :- local chtab(0'`, string_quote).
> :- local chtab(0'", list_quote).
> 
> 
> (3) or rewrite your rules using list syntax, e.g. [0'-] instead of "-".
> 
> 
> -- Joachim
> 
> 
> 
> ------------------------------------------------------------------------------
> Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
> user administration capabilities and model configuration. Take 
> the hassle out of deploying and managing Subversion and the 
> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users

 -------------------------------
Alexandre Saidi
Maitre de Conférences
Ecole Centrale de Lyon-Dép. MI
LIRIS-CNRS UMR 5205
Tél : 0472186530, Fax : 0472186443
Received on Wed Aug 24 2011 - 14:44:10 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST