pRINT

From Esolang
Jump to navigation Jump to search
Not to be confused with Print.
pRINT
Designed by User:SpaceByte
Appeared in 2023
Computational class Finite state automaton
Major implementations Implementations
File extension(s) none

pRINT is an esolang by User:SpaceByte, designed not for any form of use, but simply to be as easy to make an interpreter for as possible. This can result in various ways of using the language.

Overview & Interpreter Requirements

In pRINT, the character "p" will print any form of text, however, officially it is used to print "print". This base function qualifies as an interpreter, however, another feature of the language is the "r" command, which will redo all code. However, this is not required in an interpreter.

The ONLY required functionality to be considered an interpreter is 'p' to print "print". However, this print should be on a newline with some exceptions, like a less capable language, something like brainfuck. If you want to, you interpreter can also contain 'w' for "write", if you would like a way to print something without a newline.

Inspiration

pRINT is inspired by many languages, such as brainfuck, ඞlang Hello, Hello++, Hello++++, Hello++++++++, Hello++++++++++++++++, and the coming soon, Hello++++++++++++++++++++++++++++++++

Interpreters

Main Interpreter

Made in C# by User:SpaceByte. Includes all official features.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Program
{
class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine ("What is your source code?");
        string cmds = Console.ReadLine();
        int index = 0;
        while (index < cmds.Length) {
            char cmd = cmds[index];
            switch (cmd) {
                case 'p':
                    Console.Write("\nprint"); 
                    break;
                case 'w':
                    Console.Write("write"); 
                    break;
                case 'r':
                    index = -1;
                    break;
            }
            index++;
        }
    }
}

Brainfuck interpreter

By User:SpaceByte
Since I am not smart, this sort of does the opposite, it print "print" only when the character, however, it does the base function, and this limitation does not mess with other functionalities, as there are no other functionalities in this interpreter. This is also pretty unoptimized.

,------------------------------------------------------------------------------------------------------[>+[------->++<]>++.++.---------.+++++.++++++.>]

Second Brainfuck Interpreter

I tried again. I messed up, and it ended up not working, however, it DOES print "print", when input is "p", and doesn't print "print", when it's not.

>+<,----------------------------------------------------------------------------------------------------------------[<-]>[>+[------->++<]>++.++.---------.+++++.++++++.>]

NOTE: This is not accurate, as it actually prints 55k+ characters, but this is just the first few characters. When it's not "p", it prints:

��������������������������������������������������������������������������
�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������
��������������������������������������������������������������������������
�����������������������������������������������������������������������������������������������������������������������������������������������������
��������������������������������������������������������������������������
���������������������������������������������������������������������������
�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
����������oqhms

There is also a brainfuck interpreter by User:None1 in here.

Batch Interpreter

By User:SpaceByte

@echo off
title pRINT Interpreter
echo What is your source code? please give it to me... i need the source code, or else I cant execute the program plsplss.
set /p inputyourcodehereplsthanksineeditrnsoicanexecutetheummmuhhhhwhatwasitcalledagainohyeahtheoutputforyourcodeintheprintlangokgotitnowimdone=
if %inputyourcodehereplsthanksineeditrnsoicanexecutetheummmuhhhhwhatwasitcalledagainohyeahtheoutputforyourcodeintheprintlangokgotitnowimdone%==p (
	echo print
)
print Program Ended.
pause>nul

Java Interpreter

By User:SpaceByte
PORT OF THE C# INTERPRETER

import java.util.Scanner;

class HelloWorld {
    public static void main(String[] args) {
       System.out.println("What is your source code?");
       Scanner scanner = new Scanner(System.in);
        char[] cmds = scanner.nextLine().toCharArray();
        int index = 0;
        while (index < cmds.length) {
            char cmd = cmds[index];
            switch (cmd) {
                case 'p':
                    System.out.print("\nprint"); 
                    break;
                case 'w':
                    System.out.print("write"); 
                    break;
                case 'r':
                    index = -1;
                    break;
            }
            index++;
        }
    }
}

C++ Interpreter

By User:SpaceByte

#include <iostream>

int runcode(std::string code) {
    for (char c : code) {
        switch (c) {
            case 'p':
                std::cout<<"\nprint";
                break;
            case 'w':
                std::cout<<"write";
                break;
            default:
                 break;
        }
    }
    return 2147000000;
}

int main()
{
    std::cout<<"Enter your source code.\n";
    std::string code;
    std::cin>>code;
    
    if (code.find("r") != std::string::npos) {
        while (true) {
            runcode(code);
        }
    } else {
        runcode(code);
    }

    return 2147000000;
}

C Interpreter

By User:SpaceByte
this was painful.
This is a ported version of the C++ interpreter.

#include <stdio.h>
#include <stdbool.h>

int runcode(char code[]) {
    for (int i = 0; i < sizeof code; i++) {
        char c = code[i];
        switch (c) {
            case 'p':
                printf("\nprint");
                break;
            default:
                 break;
        }
    }
    return 2147000000;
}

int main()
{
    printf("Enter your source code.\n");
    char code[] = "";
    scanf("%s",code);
    bool containsR = false;
    
    for (int i = 0; i < sizeof code; i++) {
        char c = code[i];
        if (c == 'r') {
            containsR = true;
        }   
    }
    
    if (containsR) {
        while (true) {
            runcode(code);
        }
    } else {
        runcode(code);
    }

    return 2147000000;
}

HTML Interpreter using inlined html.js

Interpreter

Mascarpone interpreter

Rather than interpreting through input, you must append the pRINT program to the interpreter.

[]v*1[v{^]v*'|<v/}^

Made by: BoundedBeans
Commands supported: p, w, i, h
Append your pRINT program to this program.
This program isn't an interpreter itself,
but the interpreter executing it BECOMES a pRINT interpreter

Also, I'm trying out a weird sort of comment style here.
Pretty much it redefines every character of the current interpreter
to a no-op except one that means "restore the original interpreter".

Fun fact: This is my first Mascarpone program that does anything useful other than
testing features.

      -----------------------------------------------
      !    Remove everything up to and including    !
      ! this vertical bar character and the program !
      !               will work fine                !
      -----------------------------------------------
                            !
                            V
                            |[]v*1[[tnirp
]$......$]v*'p<[[etirw]$.....$]v*'w<[,$]v*'i<[[!dlrow ,olleH]$.............$]v*'h<^

Thue interpreter

_p::=print_
::=
_ppp

_ followed by the program is in the third line, in this case, the program is ppp. p doesn't print a line feed. The output, followed by an underscore, is stored in the state string. When it encounters a character that isn't p, execution stops, for example, if the program is pqp the output is print_qp.

Semi-Golfed Perl implementation

This implementation was made by BoundedBeans, who is not experienced at Perl or golfing it. So, this could probably be improved.

sub{$_[0]->($_[0],$_[1])}->(sub{@c=split//m,$_[1];for$d(@c){$d eq'r'?$_[0]->($_[0],$_[1]):print{'p',"\nprint",'w',"write"}->{$d}}},<STDIN>)

(139 bytes)

FerNANDo implementation

By BoundedBeans. This was actually really tricky to program, because FerNANDo has no way to jump forward, and thus no way to conditionally print or not print, and "\nprint" has one more character than "write". The way I came up with was to make a section of code (in between the one word "fine" lines) that either runs once or twice, with a different configuration of two variables for "\n", "p", and "w" so that gates could modify the variables containing the bits to be printed.

As stated in the code, this does not support the r command (it only supports p and w).

pRINT in ferNANDo does not work with r command
pRINT
fine command command
fine fine fine
fine
fancy fine fine
like command command
like like fine
such fine fine fine fancy command like command
fine fine fine
fine
but command command
one one one
fine one one
and one one one and also one too
and one one and one and also one
and one one command but one but zero
and one one but also one and command
one one one
pRINT in ferNANDo does not work with r command
pRINT

Examples

p


print

w

write

pw


printwrite

wp

write
print

pr


print
print
print
print

(infinite)

Command Concepts

Although pRINT only required the 'p' command, to be considered a true interpreter, here are some concepts, not officially implemented.

These commands are implemented at pRINT/Concept Interpreter

i

Take input, however, does nothing with said input.

h

Hello, World!

b

Bye. End the program.

t

Print the chemical composition of titin. This might print

methionyl­threonyl­threonyl­glutaminyl­alanyl­prolyl­threonyl­phenylalanyl­threonyl­glutaminyl­prolyl­leucyl­glutaminyl­seryl­valyl­valyl­valyl­leucyl­glutamyl­glycyl­seryl­threonyl­alanyl­threonyl­phenylalanyl­glutamyl­alanyl­histidyl­isoleucyl­seryl­glycyl­phenylalanyl­prolyl­valyl­prolyl­glutamyl­valyl­seryl­tryptophyl­phenylalanyl­arginyl­aspartyl­glycyl­glutaminyl­valyl­isoleucyl­seryl­threonyl­seryl­threonyl­leucyl­prolyl­glycyl­valyl­glutaminyl­isoleucyl­seryl­phenylalanyl­seryl­aspartyl­glycyl­arginyl­alanyl­lysyl­leucyl­threonyl­isoleucyl­prolyl­alanyl­valyl­threonyl­lysyl­alanyl­asparaginyl­seryl­glycyl­arginyl­tyrosyl­seryl­leucyl­lysyl­alanyl­threonyl­asparaginyl­glycyl­seryl­glycyl­glutaminyl­alanyl­threonyl­seryl­threonyl­alanyl­glutamyl­leucyl­leucyl­valyl­lysyl­alanyl­glutamyl­threonyl­alanyl­prolyl­prolyl­asparaginyl­phenylalanyl­valyl­glutaminyl­arginyl­leucyl­glutaminyl­seryl­methionyl­threonyl­valyl­arginyl­glutaminyl­glycyl­seryl­glutaminyl­valyl­arginyl­leucyl­glutaminyl­valyl­arginyl­valyl­threonyl­glycyl­isoleucyl­prolyl­asparaginyl­prolyl­valyl­valyl­lysyl­phenylalanyl­tyrosyl­arginyl­aspartyl­glycyl­alanyl­glutamyl­isoleucyl­glutaminyl­seryl­seryl­leucyl­aspartyl­phenylalanyl­glutaminyl­isoleucyl­seryl­glutaminyl­glutamyl­glycyl­aspartyl­leucyl­tyrosyl­seryl­leucyl­leucyl­isoleucyl­alanyl­glutamyl­alanyl­tyrosyl­prolyl­glutamyl­aspartyl­seryl­glycyl­threonyl­tyrosyl­seryl­valyl­asparaginyl­alanyl­threonyl­asparaginyl­seryl­valyl­glycyl­arginyl­alanyl­threonyl­seryl­threonyl­alanyl­glutamyl­leucyl­leucyl­valyl­glutaminyl­glycyl­glutamyl­glutamyl­glutamyl­valyl­prolyl­alanyl­lysyl­lysyl­threonyl­lysyl­threonyl­isoleucyl­valyl­seryl­threonyl­alanyl­glutaminyl­isoleucyl­seryl­glutamyl­seryl­arginyl­glutaminyl­threonyl­arginyl­isoleucyl­glutamyl­lysyl­lysyl­isoleucyl­glutamyl­alanyl­histidyl­phenylalanyl­aspartyl­alanyl­arginyl­seryl­isoleucyl­alanyl­threonyl­valyl­glutamyl­methionyl­valyl­isoleucyl­aspartyl­glycyl­alanyl­alanyl­glycyl­glutaminyl­glutaminyl­leucyl­prolyl­histidyl­lysyl­threonyl­prolyl­prolyl­arginyl­isoleucyl­prolyl­prolyl­lysyl­prolyl­lysyl­seryl­arginyl­seryl­prolyl­threonyl­prolyl­prolyl­seryl­isoleucyl­alanyl­alanyl­lysyl­alanyl­glutaminyl­leucyl­alanyl­arginyl­glutaminyl­glutaminyl­seryl­prolyl­seryl­prolyl­isoleucyl­arginyl­histidyl­seryl­prolyl­seryl­prolyl­valyl­arginyl­histidyl­valyl­arginyl­alanyl­prolyl­threonyl­prolyl­seryl­prolyl­valyl­arginyl­seryl­valyl­seryl­prolyl­alanyl­alanyl­arginyl­isoleucyl­seryl­threonyl­seryl­prolyl­isoleucyl­arginyl­seryl­valyl­arginyl­seryl­prolyl­leucyl­leucyl­methionyl­arginyl­lysyl­threonyl­glutaminyl­alanyl­seryl­threonyl­valyl­alanyl­threonyl­glycyl­prolyl­glutamyl­valyl­prolyl­prolyl­prolyl­tryptophyl­lysyl­glutaminyl­glutamyl­glycyl­tyrosyl­valyl­alanyl­seryl­seryl­seryl­glutamyl­alanyl­glutamyl­methionyl­arginyl­glutamyl­threonyl­threonyl­leucyl­threonyl­threonyl­seryl­threonyl­glutaminyl­isoleucyl­arginyl­threonyl­glutamyl­glutamyl­arginyl­tryptophyl­glutamyl­glycyl­arginyl­tyrosyl­glycyl­valyl­glutaminyl­glutamyl­glutaminyl­valyl­threonyl­isoleucyl­seryl­glycyl­alanyl­alanyl­glycyl­alanyl­alanyl­alanyl­seryl­valyl­seryl­alanyl­seryl­alanyl­seryl­tyrosyl­alanyl­alanyl­glutamyl­alanyl­valyl­alanyl­threonyl­glycyl­alanyl­lysyl­glutamyl­valyl­lysyl­glutaminyl­aspartyl­alanyl­aspartyl­lysyl­seryl­alanyl­alanyl­valyl­alanyl­threonyl­valyl­valyl­alanyl­alanyl­valyl­aspartyl­methionyl­alanyl­arginyl­valyl­arginyl­glutamyl­prolyl­valyl­isoleucyl­seryl­alanyl­valyl­glutamyl­glutaminyl­threonyl­alanyl­glutaminyl­arginyl­threonyl­threonyl­threonyl­threonyl­alanyl­valyl­histidyl­isoleucyl­glutaminyl­prolyl­alanyl­glutaminyl­glutamyl­glutaminyl­valyl­arginyl­lysyl­glutamyl­alanyl­glutamyl­lysyl­threonyl­alanyl­valyl­threonyl­lysyl­valyl­valyl­valyl­alanyl­alanyl­aspartyl­lysyl­alanyl­lysyl­glutamyl­glutaminyl­glutamyl­leucyl­lysyl­seryl­arginyl­threonyl­lysyl­glutamyl­isoleucyl­isoleucyl­threonyl­threonyl­lysyl­glutaminyl­glutamyl­glutaminyl­methionyl­histidyl­valyl­threonyl­histidyl­glutamyl­glutaminyl­isoleucyl­arginyl­lysyl­glutamyl­threonyl­glutamyl­lysyl­threonyl­phenylalanyl­valyl­prolyl­lysyl­valyl­valyl­isoleucyl­seryl­alanyl­alanyl­lysyl­alanyl­lysyl­glutamyl­glutaminyl­glutamyl­threonyl­arginyl­isoleucyl­seryl­glutamyl­glutamyl­isoleucyl­threonyl­lysyl­lysyl­glutaminyl­lysyl­glutaminyl­valyl­threonyl­glutaminyl­glutamyl­alanyl­isoleucyl­methionyl­lysyl­glutamyl­threonyl­arginyl­lysyl­threonyl­valyl­valyl­prolyl­lysyl­valyl­isoleucyl­valyl­alanyl­threonyl­prolyl­lysyl­valyl­lysyl­glutamyl­glutaminyl­aspartyl­leucyl­valyl­seryl­arginyl­glycyl­arginyl­glutamyl­glycyl­isoleucyl­threonyl­threonyl­lysyl­arginyl­glutamyl­glutaminyl­valyl­glutaminyl­isoleucyl­threonyl­glutaminyl­glutamyl­lysyl­methionyl­arginyl­lysyl­glutamyl­alanyl­glutamyl­lysyl­threonyl­alanyl­leucyl­seryl­threonyl­isoleucyl­alanyl­valyl­alanyl­threonyl­alanyl­lysyl­alanyl­lysyl­glutamyl­glutaminyl­glutamyl­threonyl­isoleucyl­leucyl­arginyl­threonyl­arginyl­glutamyl­threonyl­methionyl­alanyl­threonyl­arginyl­glutaminyl­glutamyl­glutaminyl­isoleucyl­glutaminyl­valyl­threonyl­histidyl­glycyl­lysyl­valyl­aspartyl­valyl­glycyl­lysyl­lysyl­alanyl­glutamyl­alanyl­valyl­alanyl­threonyl­valyl­valyl­alanyl­alanyl­valyl­aspartyl­glutaminyl­alanyl­arginyl­valyl­arginyl­glutamyl­prolyl­arginyl­glutamyl­prolyl­glycyl­histidyl­leucyl­glutamyl­glutamyl­seryl­tyrosyl­alanyl­glutaminyl­glutaminyl­threonyl­threonyl­leucyl­glutamyl­tyrosyl­glycyl­tyrosyl­lysyl­glutamyl­arginyl­isoleucyl­seryl­alanyl­alanyl­lysyl­valyl­alanyl­glutamyl­prolyl­prolyl­glutaminyl­arginyl­prolyl­alanyl­seryl­glutamyl­prolyl­histidyl­valyl­valyl­prolyl­lysyl­alanyl­valyl­lysyl­prolyl­arginyl­valyl­isoleucyl­glutaminyl­alanyl­prolyl­seryl­glutamyl­threonyl­histidyl­isoleucyl­lysyl­threonyl­threonyl­aspartyl­glutaminyl­lysyl­glycyl­methionyl­histidyl­isoleucyl­seryl­seryl­glutaminyl­isoleucyl­lysyl­lysyl­threonyl­threonyl­aspartyl­leucyl­threonyl­threonyl­glutamyl­arginyl­leucyl­valyl­histidyl­valyl­aspartyl­lysyl­arginyl­prolyl­arginyl­threonyl­alanyl­seryl­prolyl­histidyl­phenylalanyl­threonyl­valyl­seryl­lysyl­isoleucyl­seryl­valyl­prolyl­lysyl­threonyl­glutamyl­histidyl­glycyl­tyrosyl­glutamyl­alanyl­seryl­isoleucyl­alanyl­glycyl­seryl­alanyl­isoleucyl­alanyl­threonyl­leucyl­glutaminyl­lysyl­glutamyl­leucyl­seryl­alanyl­threonyl­seryl­seryl­alanyl­glutaminyl­lysyl­isoleucyl­threonyl­lysyl­seryl­valyl­lysyl­alanyl­prolyl­threonyl­valyl­lysyl­prolyl­seryl­glutamyl­threonyl­arginyl­valyl­arginyl­alanyl­glutamyl­

Except it would go on for 100,000 characters.

Human Impact

Although pRINT, even with the w command, AND concept commands, is very useful, the impacts of it are still heavily debated by many (nobody). However, pRINT has incredible impacts on our human society. For example, it is a great gateway into beginner programming, and allows programs to be created with ease. It also revolutionizes programming, by showing the concept of how such a high level, and useful function can be executed in such little bytes, and with such little effort an requirement. This proof, ultimately prooves the practical use of a language like pRINT, and how it can benefit beginner, and senior developers alike. ​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​