Char

From Esolang
Jump to navigation Jump to search

Char is an esoteric programming language that only uses the Arch data structure (without any other data structure, such as the stack, the queue, the deque, and dynamic variables (although the cursor is indeed a dynamic variable, but that was mandatory in the Arch specification)) and is still close to being Turing-complete(via adding as few features as possible).

Commands

Char has an arch that has a length that was set to 64 cells and has 64b memory each; therefore, there are issues like reaching the boundaries of memory; look at the Arch page in this wiki for more information of this occasion.

-- l()        Split the current cell at position pointed to by pointer.
-- s(...) 	  Pushes element onto position of pointer.
-- p() 	      Returns a popped element off of position under pointer after the pointer.
-- o(...)     Points to a specified cell and(without parameters) returns the current cell.
-- g(...)     Jumps to position ...
-- e(..a)     If ..a is equal to 2 then set next jump as available; otherwise set as false.
-- -          Subtraction and negation symbol

-- These are additional features that make programming easier:
-- --         One-line comments used to explain a program

A really long print function in Char; not using this function is recommended:

-- OutputTheValueOfTheCurrentCellUnderTheArchDataStructureOfCharsPointerToTheConsoleIEToStandardOutputOrToTheComputerScreenInTheUserOfCharsComputerWhetherItIsALaptopAPCOrEtceteraAndThenExecuteTheSubsequentCommandSlashDetailedInformationOnHowToDoOrUseSthWhichTellTheComputerWhatToDoAsSpecifiedByAHumanUserInTheCommandSlashDetailedInformationOnHowToDoOrUseSthWhichTellTheComputerWhatToDoSequenceThatWasPreliminarilyPreservedInsideADataStructureEGATextDocumentOrFromStandardInputEtceteraAfterThisDetailedInformationOnHowToDoOrUseSthWhichTellTheComputerWhatToDoHasFinishedProcessingOrDoingThisJobToBeMorePrecise() Output the value of the current cell under the arch pointer. The reason that this function is so verbose is to make people avoid using it.

An example (as-is in the Arch page)

o(512)
s(3)
p

Computational class

Char is a bounded-storage machine, as it can be reducted from the Minsky machine with bounded storage.

Preliminary jobs(Pushing a 2 to split 2 accumulators)

s(2)

Commands in the Minsky Machine to reduct from:

INC a, b
JZDEC a, b, c

Now here are the commands created for compiling to the Minsky machine:

INC a(a is after):

s(1)

INC b(b is before):

s(1)o(o--1)

JMP b

g(b)

DEC a:

p()

DEC b:

o(o-1)p()

JZ a, b

e(o(o--1))
g(b)

JZ b, c

e(o(o-1))
g(b)


Now these commands can be used to simulate the Minsky Machine instruction set:

INC a, b =
INC a
JMP b

JZDEC a, b, c =
DEC a
JZ a, b
JMP c