(define eof-object (call-with-input-file "/dev/null" read))
I know, I know. It's disgusting. But it is R4RS.
You can also fetch the eof-object from some module in S48. This is not R4RS,
but it is portable away from Unix.
Unfortunately, I don't see better alternatives. I can't use #f or other value,
because they might be legitimate return values. I *could* require the user
to specify what the terminating value was, or specify a termination predicate,
but that makes the macro messier.
When one is writing parsers that actually do input, then the parser is
frequently handed an eof object by its input actions right when it needs one
as its own return value, so things tend to work out -- the eof object sort of
bubbles up through the system. But if you are doing string hacking, then
you've got a problem.
I wish I could be more helpful. I suppose we could advertise a way to access
the eof-object value from S48's internals.