0
votes

Hi im trying to compile a .pl file using swi prolog (on a windows machine).

Now i can understand that this first i am supposed to give the file like this:

['Users\Ask\Documents\Prolog\firstpro.pl']

And then compile

.

But when i do this i get this error:

ERROR: Syntax error: Undefined character escape in quoted atom or string: `\A'
ERROR: ['Users
ERROR: ** here **
ERROR: \Ask\Documents\Prolog\firstpro.pl'] 

It seems like swi interprets my forwardslash with a escape sequence, and therefore stops. But how else should I find my file?

thanks a lot

1
That's actually a backward slash and is interpreted as an escape character. Try using / instead? - David Tonhofer
nice, this actually works when i also inculde C:/ thanks - s3j80

1 Answers

0
votes

The character \inside an atom is used for escape sequences (as the error message hints). Thus, to represent a backslash, you need to write two bsckslashes. Write instead:

['Users\\Ask\\Documents\\Prolog\\firstpro.pl']

That said, you can use forward slashes for paths with SWI-Prolog running on Windows. But note that the permissible representation of paths on Windows systems depend on the Prolog compiler.