Question

I've received some code as an example for a task at uni. I'm trying to get their example to run so I can then look at a working example to make the similar stuff that I need to. I fixed most of the errors in there (they had "-- >" instead of "-->") but it still gives me an error message.

example.pl:4:0: Syntax error: Operator expected
% example.pl compiled 0.00 sec, 240 bytes
true.

expr --> num.
expr --> num, "+", expr.
expr --> num, "-", expr.
num --> [D] { D >= "0", "9" >= D}.

I've never used anything like the last line before, so I don't know what the error is. I googled stuff about the "-->" operator, because I also haven't used that before so thought there could be a link, but I didn't turn up anything useful about it. I'm using swi-prolog.

Was it helpful?

Solution

You are missing a comma in the last clause: [D], ...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top