What does AMPL mean by “syntax error”? I double-checked the offending statement in the AMPL book, and my syntax is fine

AMPL is signaling an invalid statement of some sort, but the error may not be a matter of “syntax” in the usual sense. For example, you could be trying to define a set index at a place where it is already in use:

ampl: display {i in ORIG}: 
ampl? supply[i] * sum {i in DEST} cost[i,j]; 
syntax error 
context: supply[i] * sum {i >>> in <<< DEST} cost[i,j];

The index i cannot be defined following sum , because it is within the scope of the index i that was defined following display .

If you receive a syntax error that is particularly hard to interpret, please let us know.