A Simple Language With A Console Except There Is No Console

From Esolang
Jump to navigation Jump to search

Introduction

A Simple Language With A Console Except There Is No Console, is an esoteric programming language created by Fly and it's just, as the name suggests, A Simple Language With A Console but with no console(basically the same exact thing).

Instructions

Instruction Description!
say it can output text, numbers and values from the memory
tell it can input text or numbers and store those values in the memory
store it stores any value in the memory
label it can name the values of the mamory
forget it can remove the last value in memory and label or everything
all(forget) (if used with the command forget) deletes every value in the memory and label
remember(say) (if used with the command say) by giving the index of an element in the memory it can output it
recall(say) (if used with the command say) by giving a label name it can output the value in the memory at the index of the label
last(say) (if used with the command say) it outputs the last avlue of the memory

Examples

Hello World

 >> say Hello, World! 

A simple program

>> store test
>> label example
>> say recall example

OUTPUT: test

Computational Class

It's still not finished but for now, due to the absence of loops or conditional statements, this language is not in any way turing complete.

Implementations

you can try this project with this python code.

import sys

file = open(sys.argv[1],"r")
memory=[]
labels=[]

for code in file:
    if code.startswith("say"):
        if "remember" in code:
            if "last" in code:
                print(memory[len(memory)-1])
            else:
                index = int(code.replace("remember","").replace("say","").strip())
                print(memory[index])
        elif "recall" in code:
            index = labels.index(code.replace("say","").replace("recall","").strip())
            print(memory[index])
        else:
            print(code.replace("say","").strip())

    if code.startswith("tell"):
        memory.append(input(code.replace("tell","").strip()))

    if code.startswith("store"):
        memory.append(code.replace("store","").strip())

    if code.startswith("label"):
        labels.append(code.replace("label","").strip())

    if code.startswith("forget"):
        if "all" in code:
            memory.clear()
            labels.clear()
        else:
            memory = memory[:-1]
            labels = labels[:-1]