10
2
It's simple, simply output text to STDERR containing the string EOF
.
Input/Output
Your input will be none; however, you should output the message to STDERR.
Rules
- Since this is code-golf, the shortest answer wins.
- No standard loopholes please.
- Any method approved by Standard I/O is allowed.
- Your code may not contain the "EOF" that you will output as-is in your error.
- Outputting "EOI" is technically allowed, because the input can also be considered as a separate file.
Not a duplicate of this one because the TypeError challenge is only defined for one specific language.
– None – 2019-10-04T08:58:32.3632What are compiled languages supposed to do? Do we have to write a program that makes the compiler output "EOF" among other things? – my pronoun is monicareinstate – 2019-10-04T09:16:12.657
@someone output text to STDERR containing the string
EOF
(…), you should also exit the program with a 1 value. – Adám – 2019-10-04T09:27:46.723Error messages are usually a feature of the compiler, not the language itself. The given example
id(
throws a syntax error when using PyPy instead of CPython. I suggest to include the compiler/interpreter in the answer header, e.g. "Python using CPython". – nimi – 2019-10-04T09:32:22.8037Is this valid? – nimi – 2019-10-04T09:35:46.757
1@nimi Invalidated. – None – 2019-10-04T10:00:01.300
1
This feels like a more boring version of https://codegolf.stackexchange.com/questions/70045/helloworld-error with built-in easier to be applied.
– user202729 – 2019-10-04T10:32:02.1171btw there are some answers that have "end of input" instead of "EOF" in the output. – user202729 – 2019-10-04T10:32:31.863
I don't think it's a duplicate. The "HelloWorld error" challenge asks to output a specific string to stderr, this one asks to trigger a specific compiler/interpreter condition. Theses are different tasks, even if some programs may work in both scenarios. – nimi – 2019-10-04T11:05:24.633
3Seeing as several answers output
end of input
orend of file
instead ofEOF
, you should clarify explicitly whether this is allowed. – Grimmy – 2019-10-04T11:14:02.027Is there a requirement for it to be a valid program? Several answers here assume there is not. – Grzegorz Oledzki – 2019-10-05T05:32:52.827
@A_ wait, what? How can a program be syntactically valid if some part is missing and EOF is thrown? – Eric Duminil – 2019-10-05T10:29:20.093
3voting to close as unclear. First sentence says to raise an EOF error. Next sentence says to output text to stderr containing EOF. I/O section says you should output a message to STDERR that proves that the program generates an EOFError. All three are asking different things. – qwr – 2019-10-06T03:02:48.470
Can we include 'FOE' in our program? – S.S. Anne – 2019-10-06T14:07:56.060
Yes, because the program outputs 'EOF' but not 'FOE'. – None – 2019-10-06T14:16:25.860