SyntaxError: invalid syntax

From Esolang
Jump to navigation Jump to search

SyntaxError: invalid syntax is an esolang created by User:None1 and inspired by foo : The term 'foo' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. which is inspired by bash: foo: No such file or directory. It imitates a Python error which is common for beginners - Syntax error.


Every command is valid, and prints:

  File "<stdin>", line 1

SyntaxError: invalid syntax



print('\n'.join([f'  File "<stdin>", line 1\n    {i}\n\nSyntaxError: invalid syntax' for i in __import__('sys')'\n')]))


The program implements a REPL, and uses the insecure function gets to read the program.

char _[1000000];int main(){while(!feof(stdin)){printf(">>> ");gets(_);printf("  File \"<stdin>\", line 1\n    %s\n\nSyntaxError: invalid syntax\n",_);}}


@echo off
set /p x=^>^>^> 
echo   File "<stdin>", line 1
echo     %x%
echo SyntaxError: invalid syntax
goto bad