Segmentation Fault

From Esolang
Jump to navigation Jump to search
Segmentation Fault
Designed by Not_applicable
Appeared in 2020
Memory system none
Dimensions zero-dimensional
Computational class unable to perform computation
Reference implementation see page
File extension(s) unknown

Segmentation Fault is a programming language made by Not_applicable. It has only one valid program:

Segmentation fault

And that prints "Hello, World!". Any other program throws a syntax error:

Syntax eror

and it immediately destroys both the interpreter and the file containing the program.

Sample programs

Hello, World!

Segmentation fault

Quine

Syntax eror

Interpreter

There is an interpreter written in bash:

if [ $# = "1" ]
then
read Program < "$1"
if [ "$Program" = "Segmentation fault" ]
then
echo "Hello, World!"
exit
fi
fi
echo "Syntax eror"
rm "$0"
rm "$1"

Another interpreter in Python:

import sys,os
program=sys.argv[1]
with open(program,'r') as f:
    code=f.read()
if code=='Segmentation fault':
    print("Hello World!")
else:
    print("Syntax eror")
    os.remove(sys.argv[0])
    os.remove(program)

See also