Page 1 of 1

e603 The flow pattern '(o,i,o)' does not exist for 'string::frontChar/3' ....pro

Posted: 9 Jan 2014 15:20
by Miguelags
Hi, i'm a new user in Visual Prolog 7.4 PE,
and I need help to solve the error generated when I treat to implement the following code.

Code: Select all

%Mode GUI   %file .cl predicates   str_a_lista:(string, lstchar)  nondeterm  (i,o)(o,i).     %file .pro clauses     str_a_lista(Str,[H|T]):-           string::frontchar(Str,H,Str1),!,    <------- raise error here           str_a_lista(Str1,T).        str_a_lista(_,[]):-!.
I saw the solution for the topic in http://discuss.visual-prolog.com/viewtopic.php?t=9650
but my problem continues. I'm designing a parser. Please help me. Thanks.

Posted: 9 Jan 2014 15:34
by Thomas Linder Puls
You have two flows on str_a_lista.

The (i,o) looks fine.

But the (o,i) will not work. Str is free, H and T are bound.

So the call to string::frontchar has exactly the problem that the compiler complaints about. Many strings have H as the first char.

e603 The flow pattern '(o,i,o)' does not exist for 'string::frontChar/3' ....pro

Posted: 9 Jan 2014 17:06
by Miguelags
Thanks,Tomas, for answer.

I've been proved used only one flow, but it produce another error to back code,
this is the message that VIP shows.


"Type Description Filename e631 The predicate 'nq::nomenclatura/2 (i,o)', which is declared as 'determ', is actually 'nondeterm' nq.pro "

I think that my problem is with the use of string::frontChar, probably whether someone could
help me to find some examples using fronchar (VIP GUI mode V7.4) could be useful to solve my
project. My goal is to separate a string in char and then analyze them to throw more rules from
my initial parser.

Best regards,

Miguel

Posted: 9 Jan 2014 19:33
by Thomas Linder Puls
The predicate str_a_lista above, is actually a procedure (for the flow that works). You have declared it to be nondeterm.

Backtracking and predicate mode (procedure, nondeterm, etc.) is a bit difficult to deal with at first, and very few other programming languages have a backtracking. I guess, I should write a tutorial about it.

Anyways, it is clear that you problem is not a string::frontChar problem, but a more general backtrack/mode problem.

e603 The flow pattern '(o,i,o)' does not exist for 'string::frontChar/3' ....pro

Posted: 9 Jan 2014 21:45
by Miguelags
Ok, Tomas,

I'll treat to study more about backtrack/mode.
And I appreciate your effort for answer, if I find some about e603 I'll post it or
if you publish some about it, will be interesting for many people.

Thanks,

Miguel

p.d. If I post my code in a package-zip, Could you analyze it(if you have time)?

Posted: 9 Jan 2014 22:41
by Thomas Linder Puls
I can unfortunately not consider entire programs. But you can post mails like this with code snippets, errors and questions.

(Please post each problem in a separate mail.)