QuinePig

From Esolang
Jump to navigation Jump to search

QuinePig is a version of the language Pig, where every program is a quine.

Usage

QuinePig follows nearly the same syntax rules as Pig. You write the name of the text file you want to create, write PIG, then write the rest of the contents of the text file.

The difference is that QuinePig takes ALL of the code you wrote and puts it in the text file. Therefore, every QuinePig program is a Quine.

Various Programs in QuinePig

Text File Named "Hello, World!"

The following code creates a text file named "Hello, World!" and writes "Hello, World!PIG" to it:

Hello, World!PIG

Cat Program

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

Quine

Every QuinePig program is a Quine.

Interpreter

Written in Python.

def quinepig(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(code)
    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.