Re: [eclipse-clp-users] Syntax error in source transformation

From: Joachim Schimpf (Independent Contractor) <jschimpf_at_cisco.com>
Date: Thu, 10 Apr 2008 12:39:25 +0100
Valerio wrote:
> Hi,
> I am using ECLiPSe to describe a large EFSM (Extended Finite State
> Machine) which consists of 62 states and 141 transitions.
> In the script there are two versions of the same machine, one is the
> fault free version, the other is the faulty version.
> I am using ECLiPSe to define the EFSM behaviour in terms of
> constraints, in order to find a given input sequence which leads to
> observe a difference between the outputs of the two versions.
> However when I compile the ECLiPSe script I get the following error:
> 
> *** syntax error: illegal head: do__0(_2257878, _2257878, DATABUS_I,
...
> E136_F, E137_F, E138_F, E139_F, E140_F, E141_F) :- true, !
>        before line 3432 in the file prawn-pc-4235-s34-s0.ecl
> 
> out of range in set_flag(do__0 / 460, auxiliary, on) in module eclipse
> syntax error : in source transformation in efsm(T, DATABUS_I,
> INTERRUPT) :- ...

You are exceeding the limit of 255 arguments for any predicate.

Do-loops are implemented by generating an auxiliary predicate do__xxx,
and every for/foreach/fromto/param etc gives rise to one or two
arguments for this predicate, so you have too many of those.  Admittedly,
the do-loop implementation could be improved to work around that itself.
But if you show me a sample source of your loop, i can suggest a way
to rewrite it - generally, you will have to pack several arguments
into one compound term, and pass that term instead of many arguments.


However, let me make a more general point:  I assume your complex
code is generated, and there is probably no need to do that at all.

So instead of:

1. generate symbolic constraints from the automaton description
2. write them to a file
3. compile the file
4. run the compiled code to set up the constraints

you should just do

1. generate symbolic constraints from the automaton description,
    and call each one immediately to set it up.


For example, instead of generating a file that contains

generated_sorted_list_of_5([A,B,C,D,E]) :-
	A #< B,
	B #< C,
	C #< D,
	D #< E.

you modify your generator to set up the constaints directly, i.e.

generic_sorted_list_of_N(N, List) :-
	length(List, N),
	( fromto(List, [X1,X2|Xs], Xs, [_]) do
		X1 #< X2
	).


-- Joachim
Received on Thu Apr 10 2008 - 04:39:45 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET