SyntaxError: invalid syntax

From Esolang
Jump to navigation Jump to search

SyntaxError: invalid syntax is an esolang create 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.

Command

Every command is valid, and prints:

  File "<stdin>", line 1
    [command]

SyntaxError: invalid syntax

Interpreter

Python

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

C

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

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