105
\$\begingroup\$

The challenge is to find a string of characters that cannot appear in any legal program in your programming language of choice. That includes comments, strings, or other "non-executable" parts.

Challenge

  • Your program may be specific to a particular version or implementation of your language's compiler/interpreter/runtime environment. If so, please specify the particulars.
  • Only standard compiler/interpreter/runtime options are permitted. You cannot pass some weird flag to your compiler to get a specific result (e.g. passing a flag to convert warnings into errors).
  • If your programming language requires a specific encoding (e.g. UTF-8), your string must also be correctly encoded (i.e. strings which fail solely due to character decoding errors are not allowed).
  • Every individual character in your submission must be admissible in a legal program; that is, you can't just use a character which is always rejected.
  • The compiler/interpreter/runtime must give an error when given any source code that contains your string as a substring. The error does not have to be the same across programs - one embedding of your string might cause a syntax error, while another might cause a runtime error.

Scoring

  • Shortest illegal string for each language wins.
  • You should explain why your string is illegal (why it cannot appear anywhere in a legal program).
  • Dispute incorrect solutions in the comments. More specifically, you should provide a link to TIO or equivalent demonstrating a legal program (i.e. one that doesn't produce any errors) that contains the proposed substring.
  • Some languages (e.g. Bash, Batch, Perl) allow arbitrary binary data to be appended to a program without affecting validity (e.g. using __DATA__ in Perl). For such languages, you may submit a solution that can appear only in such a trailing section. Make sure to make a note of that in your answer. (The definition of this "trailing section" is language-dependent, but generally means any text after the parser has entirely stopped reading the script).

Example

In Python, I might submit

x
"""
'''

but this can be embedded into the larger program

"""
x
"""
'''
y
'''

so it isn't admissible.

\$\endgroup\$
17
  • 3
    \$\begingroup\$ Can a counter-example rely on input from STDIN? \$\endgroup\$
    – Adalynn
    Jul 20, 2017 at 14:17
  • 8
    \$\begingroup\$ Would this make a good CnR? \$\endgroup\$ Jul 20, 2017 at 16:59
  • 10
    \$\begingroup\$ My condolences to the Perl attempts. :) \$\endgroup\$
    – Kaz
    Jul 23, 2017 at 15:40
  • 6
    \$\begingroup\$ I'm pretty sure it's completely impossible in non-literate Haskell, thanks to nested comments. \$\endgroup\$
    – dfeuer
    Mar 19, 2019 at 1:50
  • 6
    \$\begingroup\$ @dfeuer That was my conclusion too. I even looked through GHC's lexer code to see if there was a loophole, but it seems very diligent about allowing absolutely every byte sequence inside sufficiently nested {- -} brackets. \$\endgroup\$ Apr 4, 2019 at 1:32

65 Answers 65

3
\$\begingroup\$

Ruby, 58 23 27 bytes AND proof of impossibility at bottom

This snippet is valid in any Ruby version prior to Ruby 2.3 (when heredocs were added):


=end
)}end/;[}'"\//;[}#{]}

Old version (invalid):


=end
)}end/;kill(Process.pid,-9)'"\//;kill Process.pid,-9

This cannot be used anywhere in a Ruby program except after __END__.

Proof of impossibility

This solution is impossible in any Ruby version after and including Ruby 2.3.

Any Ruby solution can be inserted into this snippet and function as a valid program:

<<'string'

# Insert code here

string

With this particular snippet, you can add (note leading newline)


string

to your solution in order to invalidate the program. However, changing the "name" of the heredoc will again invalidate your solution. Heredocs can have infinite placeholders, meaning a solution accounting for all of them would be infinitely long. Thus an answer in Ruby 2.3+ is impossible.

Thanks to histocrat for pointing this out.

\$\endgroup\$
8
  • \$\begingroup\$ Invalid, cannot appear. Needing a kill command means it can be put in a program that still runs \$\endgroup\$
    – ASCII-only
    Jan 24, 2019 at 6:14
  • \$\begingroup\$ Can kill be redefined to not work properly? For example define kill to do nothing with the input? \$\endgroup\$
    – Wheat Wizard
    Jan 24, 2019 at 13:40
  • \$\begingroup\$ @ASCII-only--yes, that's true. I thought that the question was to raise an error, not disallow a valid program. Sorry about that. Will remove. \$\endgroup\$ Jan 25, 2019 at 0:05
  • 1
    \$\begingroup\$ Not quite--If you put single quotes around the heredoc terminator like so, it won't interpolate with #{. I don't think this is solvable in Ruby due to this feature. \$\endgroup\$
    – histocrat
    Sep 6, 2019 at 17:11
  • 3
    \$\begingroup\$ Proof of impossibility is still a valid answer. Though I think the proof might need to be a little more strict \$\endgroup\$
    – Jo King
    Sep 11, 2019 at 1:43
3
\$\begingroup\$

JavaScript, 7 bytes

 */
#`#
  • Adding a // at the beginning will still not work because of the leading newline, leaving the second line uncommented.

  • Adding a /* will not uncomment the string completely because of the closing */ that completes it, leaving the # exposed.

  • Adding ` will not quote the string completely, because of ` that completes a string, leaving the # exposed.

  • Regular expressions won't work because of # following / character.

  • / following * cannot be parsed as a regular expression, as regular expressions cannot have newlines

Try it!

clicky.onclick=a=>{console.clear();console.log(eval(before.value+" */\n#`#"+after.value));}
textarea {
  font-family: monospace;
}
<button onclick="console.clear();">Clear console</button>
<br>
<textarea id=before placeholder="before string"></textarea>
<pre><code> */
#`#</code></pre>
<textarea id=after placeholder="after string"></textarea>
<br>
<button id=clicky>Evaluate</button>

\$\endgroup\$
0
3
\$\begingroup\$

JavaScript, 11 characters

`
`*/}'"`\u)

The backticks make sure to kill template strings, the quotes get rid of strings, the newline avoid commented lines, the end of comment avoids block comments, and the last backtick and escape (with a ) to avoid appending numbers or /) try to start a invalid string.

Try it online!

\$\endgroup\$
0
3
\$\begingroup\$

Scratch (1.x, except 1.2 beta), scratchblocks syntax, 26 bytes


when gf clicked
say(()/()

Leading new line ensures that "when gf clicked" will not be in a comment, so that what's below it will run.

This errors when run in the Stage, because the Stage cannot use the say block.

This errors when run in a sprite by itself, because a divide by zero is attempted. (When a number argument is blank, it is read as 0.)

This errors when run in a sprite when ) or a new line is added after it, because it doesn't change what the existing code does.

This errors when run in a sprite when something else is added after it, because it creates an undefined block which causes an error when run.


1.2 beta is excluded because it featured comment blocks (different from modern comments), which supported multiline, which this could be put into.

Versions past 1.4, including the Experimental Viewer, are excluded because dividing by zero does not cause an error.

\$\endgroup\$
3
\$\begingroup\$

Dis, 2 bytes.

))

How it works

  • ( to the nearest ) is a comment.
  • But nothing can match the second ) above in this syntax.
  • Thus it is syntax error.
\$\endgroup\$
2
  • \$\begingroup\$ What about (())? Does Dis not support parentheses inside comments? \$\endgroup\$
    – Mayube
    Nov 5, 2021 at 15:01
  • \$\begingroup\$ @mayube Comments may be used, enclosed in parentheses. They can't be nested. \$\endgroup\$
    – user100411
    Nov 6, 2021 at 3:27
3
\$\begingroup\$

Pip Classic, 10 bytes


;\"
;`
*;

Try it online!

I think this should be solid, but I welcome anyone to prove me wrong.

How?

A semicolon at the start of a line begins a single-line comment, so our code is effectively

*;

and Pip complains because * is a binary operator and needs a left operand.

If we add any expression before the snippet, we still get an error because * needs a right operand. No operand can be supplied because * is followed by the expression terminator ;.

We can't wrap the snippet in a string, because every possible string delimiter (", \", and `) is matched by a delimiter in the snippet. (In a regular "-delimited string, the backslash is not an escape character, so it doesn't mess anything up.)

Finally, we can't comment out the last line of the snippet because Pip Classic doesn't have block comments.

\$\endgroup\$
3
\$\begingroup\$

Knight, 7 bytes

Technically, knight programs aren't allowed to contain anything outside of \r, \n ,\t, or <space>-~, so you could just submit <NUL> for a one byte solution.

Additionally, each knight program is exactly a single expression; handling things after that experssion is up to the implementation. So, you could prefix any program with TRUE—a valid expression—after which anythign afterwards would be undefined behaviour. However, that kind of defeats the spirit of the question as well IMO, so let's assume that we're actually in some arbitrary expression:

#"'#'
$

The idea is since $ is not a legal function, it cannot appear outside of strings.

  • If there's no leading code, then the comment removes the rest of the first line.
  • If we're embedded in a comment, our entire first line will be commented out, leaivng a lone $, which is illegal.
  • If we're inside a " string, then the first " will close it, which is then followed by the legal '#' string
  • If we're inside a ' string, then the first ' will close it, with the remaining ' being commented out by the #, leaving $ by itself.
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Each character needs to be admissible on it's own according to the challenge rules so the the 1 byte solutions are not admissible anyway \$\endgroup\$
    – mousetail
    Aug 23, 2022 at 8:58
2
\$\begingroup\$

Fortran, 14 bytes


end program
e

No multiline comments or preprocessor directives in Fortran.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Is there a good way to test this online? Also, which version/compiler of Fortran? \$\endgroup\$ Jul 23, 2017 at 15:21
2
\$\begingroup\$

Scratch (scratchblocks2), 3 bytes

There's no such thing as an error in scratchblocks2 - just red-colored blocks - but this can't be expressed in actual Scratch, so I think it's OK.


<?

Leading newline to avoid this just being commented or ::ed out.

Then a predicate block with it's label starting with ? - there's no such block.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Can't test it (I'm not going to install scratchblocks2), but I don't see why say [\n<?] breaks. The [] seem to support parsing \n (like for drop-down menus). \$\endgroup\$ Nov 22, 2018 at 17:27
  • 1
    \$\begingroup\$ There's a leading newline. \$\endgroup\$
    – W. K.
    Nov 22, 2018 at 21:15
  • \$\begingroup\$ I think define\n<? defines the <?> block as a custom block, here \$\endgroup\$
    – Bo_Tie
    Jun 1, 2021 at 14:49
2
\$\begingroup\$

Powershell, 10 8 12 14 13 14 16 bytes

-2 byte thanks to Mazzy finding a better way to break it
+4 -1 bytes thanks to IsItGreyOrGray

$#>
'@';
"@";
@=

I hope this works. ' and " to guard against quotes, #> to break the block-comment, new lines to stop the single-line comment, both '@ and "@ to catch another style of strings, and then starts an improper array to throw a syntax error.

The logic being they can't use either set of quotes to get in, they can't block-comment it out, If @" is used, it'll create a here-string which can't have a token afterwards, and if they leave it alone, it'll try to make a broken array. This statement wants to live so hard, I keep finding even more holes in the armor.

\$\endgroup\$
9
  • 1
    \$\begingroup\$ Or protectors + @= \$\endgroup\$
    – mazzy
    Nov 19, 2018 at 22:26
  • 1
    \$\begingroup\$ @IsItGreyOrGray AAAAAAAAAAAw heck. \$\endgroup\$
    – Veskah
    Jan 25, 2019 at 21:12
  • 2
    \$\begingroup\$ It looks like changing #> to $#> will break it as "not recognized as the name of a cmdlet..." It might be made legal again somehow, but I don't have a way. Yet. :) \$\endgroup\$
    – GreyOrGray
    Jan 25, 2019 at 21:38
  • 1
    \$\begingroup\$ @IsItGreyOrGray Sonofagun. Now featuring semi-colon armor? \$\endgroup\$
    – Veskah
    Jan 25, 2019 at 23:06
  • 1
    \$\begingroup\$ Nice! I've got nothing. Everything I've tried has failed. \$\endgroup\$
    – GreyOrGray
    Jan 28, 2019 at 14:31
2
\$\begingroup\$

ECMAScript Regex, 4 bytes

]](+

Try it on regex101

This is a quite a bit easier than PCRE. There's no \Q...\E, no free-spacing mode, and no comments. But if we used just ](+ we could still be inside a character class and have our ] escaped, as [\](+] which would be treated as a character class of ](+. So we still need the double ] to make sure we exit any character class we may have been in, which works even if a range was started, e.g. [!-]](+.

(+ is illegal in any context other than a character class, and will give an error message such as "Nothing to repeat" or "Incomplete group structure" / "The preceding token is not quantifiable".

\$\endgroup\$
2
\$\begingroup\$

PCRE Regex, 6 7 bytes

\E
)](+

Try it on regex101

Any string not containing \E would be legal inside a \Q...\E literal sequence. By starting this one with \E, we break out of such a sequence if we were in one. And if we weren't in one, but are preceded by a \, then it will be treated as a literal \E, and we'll still be guaranteed not to be inside a \Q...\E.

(+ is not part of any legal group structure, and will generate a compile-time error ("Incomplete group structure" and/or "The preceding token is not quantifiable" / "quantifier does not follow a repeatable item") anywhere other than:

  1. Within a \Q...\E. We've handled this. We can't be inside one thanks to the \E.
  2. Immediately after a \. But since we have it immediately after a \E, it can't be immediately after a \. Note that \E alone is valid, even if there was no \Q before it.
  3. Inside a #... style comment. This can only happen in free-spacing mode, but this can be turned on by (?x) anywhere in a regex, so we need to handle it.
  4. Inside a (?#...) style comment.
  5. Inside a character class, e.g. [(+] or [\Q\E(+] – or even [\Q\E](+], which will be treated as [](+], which, since an empty character class is not part of PCRE syntax (except in PCRE2 with the PCRE2_ALLOW_EMPTY_CLASS option enabled), is treated as a character class consisting of ](+ (the beginning of a character class is the only place where ] does not need to be escaped).

Because of #3, we need a newline, to break out of any #... comment we may be in.

Because of #4, we need a ), to break out of any (?#...) comment we may be in.

And it is because of #5 that we need to put ] in front of the (+. This closes any character class we might have been in. If we hadn't already put a newline and/or a ) to close a potential comment, we'd need this to be ]], because a character class can't be empty and ] is allowed to be the first character in a class without being escaped. In any case, thanks to having a character before our ], it even works if a range was started, e.g. [!-\E)](+.

Edit: Silly me, didn't protect it from being inside comments. Fixed.

\$\endgroup\$
2
\$\begingroup\$

Runic Enchantments, 3 bytes

One of many possible variations.

Try it online!

Runic utilizes unicode combining characters in a "M modifies the behavior of C" (where C is a command). As such, no two modifiers are allowed to modify the same command and the parser will throw an error if such an occurrence is found.

Similarly, certain commands that redirect the IP cannot be modified in any way, due to the existence of direction modifying modifier characters (and both in the same cell makes no sense).

There is no way to escape or literal-ize the string to make it valid. Tio link contains a ; in order to bypass the higher-priority "no terminator" error.

\$\endgroup\$
2
\$\begingroup\$

NDBall 2 bytes

specificly in NDBallSim V1.0.1

##

a hashtag is a memory cell instructor and requires a direction, two of them anywhere will cause the error

NDBall Parse ERROR @ LINE (whatever line): Memory cell requires a direction ex: #>12

this double character trick can actually be done with many more chars, to be exact all of these )(,}{|><+-pP$%Y][E and newline

This is actually all (discounting digits) of the useable chars in the lang itself because it never has a case where you use the same char twice

\$\endgroup\$
2
\$\begingroup\$

C#, 6 bytes


"*/#


# is only used in C# to specify a preprocessor directive. Preprocessor directives are only valid if the # is the first non-whitespace character on its line. As a result, it doesn't even matter if the specified directive exists or not (so the shortest solution is to not specify any directive name).

The only way to prevent # being interpreted as a directive is to put it in a comment or string.

It is not possible to comment out # because // is prevented by preceeding newline and /* is prevented by */. It is not possible to enclose it in a string because multiline strings must start with @", but there is no way to put @ in front of a string that would capture # (@\n" is not valid).

\$\endgroup\$
1
\$\begingroup\$

S.I.L.O.S, 4 bytes

Silos is competitive \o/


x+

S.I.L.O.S runs on a two pass interpreter / compiler. Before execution a "compiler" attempts to simplify the source into an array describing the sourc Each line is treated separately. x+a is an assignment operator that will add ea to the value of x and store it into x. However the "compiler" will break. Therefore, we take this string and add a new line before and after ensuring it's on its own line and breaks the compiler.

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Why doesn't ax+ error out? \$\endgroup\$ Jul 20, 2017 at 18:40
  • \$\begingroup\$ undefined compiler behavior @EriktheOutgolfer \$\endgroup\$ Jul 20, 2017 at 19:27
1
\$\begingroup\$

AutoHotkey, 5 bytes

` is the escape character. You can only escape a " when assigning it to a variable.

\n*/ prevents it from being commented out or assigned to a variable.


*/`"
\$\endgroup\$
1
\$\begingroup\$

Husk1, 3 bytes

Try it online!

Explanation

The newlines force to be parsed as a supposed built-in, however since it's not (yet) implemented the parsing fails with unexpected "\9674" or an error because of empty lines.

Note: Initially I tried to force an inference failure, but the type-checking is done lazily and one can easily "un-break" programs with adding a valid main function.


1: The code might work at some point in the future. So to be precise any version of Husk as of before the date of this post (ie. at least up to commit 0806b9d).

\$\endgroup\$
1
  • \$\begingroup\$ An inference failure would have been fun, but this is probably shorter than that would be anyhow. \$\endgroup\$ Apr 4, 2019 at 2:28
1
\$\begingroup\$

Keg, 3 4 bytes

Fixed a for loop bug noted by @Jono2906


)ø.

Try it online!

Explanation

\n    Terminate a line-comment
)     End a for loop
 ø    Clear the stack
  .   Try to print the TOS item, which will create an error to the program.
\$\endgroup\$
2
  • \$\begingroup\$ 3 bytes using strings \$\endgroup\$
    – lyxal
    Nov 26, 2019 at 20:51
  • \$\begingroup\$ But this is valid. \$\endgroup\$
    – user85052
    Nov 27, 2019 at 4:06
1
\$\begingroup\$

Unreadable, 2 bytes

''

Try it online!

All Unreadable commands must be of the form '""…", with one ' followed by 1 to 10 "s. Having two successive 's anywhere in the program leads to error: parser failed: invalid command (0): '.

\$\endgroup\$
1
\$\begingroup\$

Add++, 6 3 bytes


";

Try it online!

\$\endgroup\$
4
  • \$\begingroup\$ This can be commented out \$\endgroup\$
    – Mayube
    Nov 16, 2021 at 18:08
  • \$\begingroup\$ @Mayube Fixed. Thx. \$\endgroup\$
    – Fmbalbuena
    Nov 16, 2021 at 18:11
  • 1
    \$\begingroup\$ Add++ doesn't seem to support multi-line strings or comments so 2 bytes \$\endgroup\$
    – Mayube
    Nov 16, 2021 at 18:28
  • 1
    \$\begingroup\$ @Mayube Nope Try it online! \$\endgroup\$
    – Fmbalbuena
    Nov 16, 2021 at 18:32
1
\$\begingroup\$

Lean Mean Bean Machine, 8 bytes

OO
0/
&

Try it online!

Begins with a leading newline.

Unfortunately this is basically an entire invalid program, but it can be inserted into larger programs, and there's no way to my knowledge to prevent the runtime error.

LMBM creates a 'marble' (aka instruction pointer) at every O in the code, and there is no way to prevent this (which now that I think about it causes some issues if you need an O in a string). & is the division operator in LMBM.

In short, this snippet causes a ZeroDivisionError: division by zero runtime error.

\$\endgroup\$
2
  • \$\begingroup\$ Needs a leading newline, otherwise you can just add some dummy leading characters so that the marbles dont land in the division by zero \$\endgroup\$ Aug 18, 2022 at 13:48
  • \$\begingroup\$ @thejonymyster good catch! \$\endgroup\$
    – Mayube
    Aug 19, 2022 at 16:12
1
\$\begingroup\$

PowerPC for XBox 360, 19 bytes

~
J,e~
J,e~
J,e~
J,

The operative sequence is ~␊J,, in which the linefeed may be replaced with any byte less than 32 and the J with any byte congruent to 2 mod 8.

If this sequence appears on a four-byte boundary (which it will, in the above string) on an executable page, it codes an xdcbt (prefetch to L1 cache, skipping L2); any (even speculative) jump to it will then break cache coherency, probably leading to a crash soon after. Since the branch predictor even predicts computed jump destinations, this will happen sooner or later, see here.

I wish I had been able to force an all-printable version, but LF is pretty close.

\$\endgroup\$
1
\$\begingroup\$

Chicken, 2 bytes

ih

Thanks to jimmy23013

\$\endgroup\$
4
  • \$\begingroup\$ Can you make comments in Chicken? \$\endgroup\$ Mar 8, 2022 at 20:28
  • \$\begingroup\$ @BgilMidol Nope \$\endgroup\$
    – Fmbalbuena
    Mar 9, 2022 at 0:54
  • 1
    \$\begingroup\$ Every individual character in your submission must be admissible in a legal program; that is, you can't just use a character which is always rejected. So maybe ih is better. \$\endgroup\$
    – jimmy23013
    Aug 19, 2022 at 19:33
  • \$\begingroup\$ @jimmy23013 okay \$\endgroup\$
    – Fmbalbuena
    Aug 20, 2022 at 14:42
1
\$\begingroup\$

Pyt, 2 bytes

ɬĹ

Just one amongst many.

Try it online!

It's pretty simple, actually: Pyt has no comment markers, so every valid character when using Pyt's proprietary encoding (not UTF-8) does something.

ɬ pushes the string "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" Ĺ returns the least common multiple of the top two elements on the stack You can replace ɬ with either ɫ or ʊ (only the lowercase and uppercase letters, respectively), and you can replace Ĺ with the vast majority of the functions in Pyt, as most of them only work on numbers.

There is another 2-byte family of solutions:

do

where d is any digit (0-9), and o is either ҏ or Ƒ. ҏ palindromizes a string or array and does not work on numbers, and Ƒ flattens the array at the top of the stack, but errors if the top of the stack isn't an array.

And there is a singleton (not in a family of solutions):

ɔŕ

ɔ clears the stack, and then ŕ pops the top of the stack (and errors out if it is empty).

\$\endgroup\$
1
\$\begingroup\$

Perl, 12 bytes 25 bytes

Tried to cut all strings. Not really short.


.
"'/%+)}]>#
=pod
=cut
.
  • First newline to exit comments (there are no multiline comments)
  • then . in first column to exit format sections
  • end strings (there are strings like "...", '...' and like qw/.../ but instead of '/' other chars can be used
  • start a POD section (=pod at the beginning of the line)
  • end the POD section (=cut at the beginning of the line)
  • . is not in any comment and is invalid.

After __DATA__ or __END__ there is no code. There starts a data section.

Hope this is correct (my first step on code golf ...)

\$\endgroup\$
5
  • 2
    \$\begingroup\$ Unfortunately this doesn't work: ato.pxeger.com/… \$\endgroup\$
    – pxeger
    Jan 9, 2023 at 16:22
  • \$\begingroup\$ @pxeger Thanks! I have to exit all types of strings first... \$\endgroup\$
    – Andy A.
    Jan 9, 2023 at 17:23
  • \$\begingroup\$ Welcome to Code Golf! \$\endgroup\$ Jan 9, 2023 at 19:11
  • 1
    \$\begingroup\$ Also, this challenge is impossible in Perl due to __END__ \$\endgroup\$
    – emanresu A
    Jan 9, 2023 at 19:22
  • \$\begingroup\$ @emanresuA - I don't think so, because all after __END__ or __DATA__ isn't code. \$\endgroup\$
    – Andy A.
    Jan 9, 2023 at 21:35
1
\$\begingroup\$

Grass, 3 bytes

wWv

Try it online!

Grass programs are written using only w, W, and v; all other characters are ignored.

w is necessary because any characters placed before the program's first w are ignored.

W is expected to be followed by a sequence of w characters to form a function application; however, it is instead followed by a v, which causes a parse error.

\$\endgroup\$
0
\$\begingroup\$

Gaia, 3 bytes


#“

Try it online!

Each line in Gaia is a separate function, so the newline ensures that the code starts at the beginning of a function. Even putting a newline in a string literal will start a new function, since Gaia allows omitting closing quotes. In addition, all functions are parsed before execution, so adding additional functions below won't help.

The # is a meta, which has to directly follow an operator. At the start of the function, there is no operator, so it's a syntax error.

The is an opening quote for string literals. It's there because Gaia also allows omitting the opening quote of strings at the start of a function. If this opening quote wasn't here, you could write #” which is entirely legal.

\$\endgroup\$
0
\$\begingroup\$

Ly, 6 bytes


\""{)

(note the leading newline)

The newline prevents line comments, Ly doesn't have block comments, the \"" ensures that all open string literals will close, and the unmatched brackets raise the error.

\$\endgroup\$
0
\$\begingroup\$

FRACTRAN, 2 bytes

()

Try it online!

Since FRACTRAN doesn't have any way of including comments or literals (AFAICT), this will always error any valid program, since all valid programs must be a valid fraction, and this string can never be part of a valid fraction.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.