Make a slow error quine maker!

Bash, 9223372036854775810

Inspired by Doorknob's answer.

a='"2>/dev/null;if(((i=$((i-1)))>0));then $(declare -p a);$a;else 1;fi #"'
i=2**63
eval $a

It should be run with bash < file.sh, or use the same file name for each program, to get rid of the different file names in the error messages.

The first few errors are (with LANG=C):

bash: line 3: 2>/dev/null;if(((i=9223372036854775807)>0));then declare -- a="\"2>/dev/null;if(((i=\$((i-1)))>0));then \$(declare -p a);\$a;else 1;fi #\"";"2>/dev/null;if(((i=$((i-1)))>0));then $(declare -p a);$a;else 1;fi #";else 1;fi #: No such file or directory
bash: line 1: 2>/dev/null;if(((i=9223372036854775806)>0));then declare -- a="\"2>/dev/null;if(((i=\$((i-1)))>0));then \$(declare -p a);\$a;else 1;fi #\"";"2>/dev/null;if(((i=$((i-1)))>0));then $(declare -p a);$a;else 1;fi #";else 1;fi #: No such file or directory
bash: line 1: 2>/dev/null;if(((i=9223372036854775805)>0));then declare -- a="\"2>/dev/null;if(((i=\$((i-1)))>0));then \$(declare -p a);\$a;else 1;fi #\"";"2>/dev/null;if(((i=$((i-1)))>0));then $(declare -p a);$a;else 1;fi #";else 1;fi #: No such file or directory

And finally:

bash: line 1: 2>/dev/null;if(((i=0)>0));then declare -- a="\"2>/dev/null;if(((i=\$((i-1)))>0));then \$(declare -p a);\$a;else 1;fi #\"";"2>/dev/null;if(((i=$((i-1)))>0));then $(declare -p a);$a;else 1;fi #";else 1;fi #: No such file or directory
bash: line 1: 1: command not found
bash: line 1: bash:: command not found

which is an error quine.


Pip 0.15.05.29, over 10100,000

Technically not valid because it requires the -w flag for warning output. That being said, Pip by design doesn't display any runtime errors unless they actually crash the program (infinite recursion, e.g.); the problems with this code are things that other languages would definitely complain about.

i:5**6**7d:"i:1d: Ssi?dRo--iRsRPda"Ssi?dRo--iRsRPda

The exact number of steps depends only on the value assigned to i, so it could be arbitrarily large (until the Python interpreter runs out of memory). Also, it would take longer than the age of the universe to complete the above sequence. (The question did specify "slow"!)

Explanation:

It took some combing through the interpreter before I found an error that would let me put arbitrary code into the warning message. After that, it was essentially modifying standard quine techniques. Example here uses an i-value of 5 for purposes of explanation.

i:5d:"i:1d: Ssi?dRo--iRsRPda"Ssi?dRo--iRsRPda

After setting i, store a string in d and then attempt to execute the Swap statement. Swap expects two variables (more accurately, lvalues). s is fine, but the second expression is i?dRo--iRsRPda. If i is true (nonzero, for our purposes), the ternary evaluates to dRo--iRsRPd, which uses d from earlier to form a near-quine--only with i decremented. This expression is not an lvalue, so Pip complains:

Attempting to swap non-lvalue i:4d:"i:1d: Ssi?dRo--iRsRPda"Ssi?dRo--iRsRPda

... which then starts the whole thing over again. (Attempting to swap non-lvalue is a bunch of no-ops: At calculates the ASCII value of t = 10, n-l subtracts newline minus each value of an empty list, and all the lowercase letters are just variables.)

The process continues in like fashion all the way down to:

Attempting to swap non-lvalue i:0d:"i:1d: Ssi?dRo--iRsRPda"Ssi?dRo--iRsRPda

When this is run, i is now false. The ternary expression evaluates to the else branch a--which is an lvalue. Thus, swap doesn't complain anymore. Instead, we get:

Referencing uninitialized variable a

And upon running this, at last, we have an actual syntax error:

R is not a unary operator
Fatal error while parsing, execution aborted.

... at which point, since the "program" starts with R, Pip will continue complaining that R is not a unary operator forever.


The best solution that doesn't use -w is of length 3:

$~

While scanning, ignored unrecognized character: '~'
Missing operator for $ meta-operator? Got None instead
Fatal error while parsing, execution aborted.

Missing operator for $ meta-operator? Got m instead
Fatal error while parsing, execution aborted.

M is not a unary operator
Fatal error while parsing, execution aborted.

Julia, 3

A simple one just to get the ball rolling...

Initial program:

inquisition

Error 1:

inquisition not defined

It may not be defined, but if it's Spanish, it's also unexpected. Nobody expects the Spanish Inquisition.

Error 2:

syntax: extra token "not" after end of expression

Error 3:

syntax: extra token "token" after end of expression

The third error message, when submitted as a program, produces that same error, hence the score of 3.

Work in progress! Surely I can do better than 3.