I am writing in Prolog and keep getting the error;
syntax error: current or previous operator needs brackets
When referring to te=he following code:
convert_to_tokens([Word|Rest], [Token|RestTokens]) :-
atom_string(Atom, Word),
( Atom == '+' -> Token = pl
; Atom == '-' -> Token = mi
; Atom == '*' -> Token = ti
; Atom == '/' -> Token = di
; number_string(Number, Word) -> Token = Number
; atom_chars(Word, [H|T]), char_type(H, alpha) -> Token = id(Word)
; Token = Atom
),
convert_to_tokens(Rest, RestTokens).
I have tried using actual brackets, curly brackets, removing the brackets, etc. But I cannot seem to find a solution. Can anyone figure out what it is asking for? Thank you!