DeadPig

From Esolang
Jump to navigation Jump to search

DeadPig is a version of the language Pig, where the pig has unfortunately died.

Usage

DeadPig follows the same syntax rules as Pig, You write the title of the text file you want to make, write PIG, then write the contents of the text file. However, the pig has died, so the program will ignore your desired contents and write "Your pig has unfortunately died. Please try again."

Various Programs in DeadPig

Cat Program

DeadPig cannot create the Cat program because it is output only.

Quine

DeadPig cannot create a Quine either. However, if one ignores case, then DeadPig can create a Quine-by-error, or a false Quine, with the code

Your PIG has unfortunately died. Please try again.

This creates a file named "Your " with the text "Your pig has unfortunately died. Please try again.".

Interpreter

Written in Python.

def deadpig(code):
    assert type(code) is str, "ERROR: Code must be a string."
    assert "PIG" in code, 'ERROR: Code must contain "PIG".'
    file_name, _ = code.split("PIG", 1)
    file = open(file_name, "w")
    file.write("Your pig has unfortunately died. Please try again.")
    file.close()

The Pig Series

The Pig series is a a series of programming languages that are all based on Pig.

The languages are Pig, SickPig, DeadPig, and QuinePig.

Other languages based on Pig are DeafPig and ExtendedPig.