bug-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accented letters.


From: Eduardo Costa
Subject: Accented letters.
Date: Sun, 27 Jul 2008 08:33:27 -0700 (PDT)

If source code has certain accented letters [ 'ê', 'ô'],  Gnu-Prolog (MinGW distribution, gcc 3.4.5) fails to compile once in every  five trials. It is interesting that the compiler sometimes works fine, but sometimes claims that it cannot  unify_atom(Ý); as one can see, this atom is not among the accented letters that I am trying to recognize.  Work around: One can keep trying; the compiler will accept the source code eventually; once compiled, the program works perfectly well. Another work-around is avoidance of characters (use codes instead).


% Culprit:
accents(['á', 'é', 'í','ú', 'â', 'ê', 'ô']).

%Error message:
/*
D:\nogui>gplc --no-top-level --min-size  tokenizer
.pl -o tokenizer
line 195: atom expected
    unify_atom(Ý),
               Ý^ here
Translation aborted
compilation failed
*/
accented(W) :- accents(As), run_member(W, As).

run_member([X|_], As) :- member(X, As), !.
run_member([_|Xs], As) :- run_member(Xs, As).

alpha('-') :- !.
alpha(X) :- X @>= 'a', X @=< 'z', !.
alpha(X) :- accents(As),  member(X, As), !.

check(X) :- alpha(X), !, write('Yes!'), nl.
check(X) :- write('No!'), nl.

isalphap :-
        argument_counter(ACount), ACount=2,
        argument_value(1, Symbol),
        check(Symbol).
isalphap :- write('Usage: isalphap <char>'), nl.

:- initialization(isalphap).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]