Control Character

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

Control Character is a stack-based esoteric language by enilKoder that is inspired by Whitespace, which was created by Edwin Brady and Chris Morris.

Syntax

Usually, characters that would make the Java function isISOControl() == false are ignored. This table explains what each control character does:

Name (ABR) U+#### What it does Example*
Null (NUL) 0000 Null value, of course! This is the default value for nops and functions that don't return other values
Start of Heading (SOH) 0001 Open expression grouping
Start of Text (STX) 0002 Begin mini-quine; the interpreter will start recording whatever code it will be evaluating
End of Text (ETX) 0003 End mini-quine; the interpreter will push, as a text string, the code that it recorded since STX
End of Transmission (EOT) 0004 Terminate the program; the interpreter may return the stack
Enquiry (ENQ) 0005 Ask the user for a Boolean input, then push it onto the stack
Acknowlege (ACK) 0006 True Boolean
Bell (BEL) 0007 Print the following value to the output log
Backspace (BS) 0008 Pop and return the first value in the stack
Horizontal Tabulation (HT) 0009 Push the following value onto the stack
Line Feed (LF) 000A Separate lines of code
Vertical Tabulation (VT) 000B Jump to the line specified by the following value (nop if invalid value, e.g. negative, decimal, >= number of lines, not a number)
Form Feed (FF) 000C Return true (ACK) if the first two values in the stack are equivelent, else false (NAK)
Carriage Return (CR) 000D
Shift Out (SO) 000E
Type of first value of stack Do Then
Number Get second value as a number Push their difference (first minus second) onto the stack
Text string Get second value as a text string Push the result of removing all instances of the second string from the first string onto the stack
Boolean True: Push null False: Push the second value
Null Do the same process with the next two values in the stack If the bottom is reached, push null
Shift In (SI) 000F
Type of first value of stack Do Then
Number Get second value as a number Push their sum onto the stack
Text string Get second value as a text string Push their concatenation (top first) onto the stack
Boolean True: Push second value False: Push null
Null Do the same process with the next two values in the stack If the bottom is reached, push null
Data Link Escape (DLE) 0010 Return the top value of the stack without popping it
Device Control 1 (DC1) 0011 If statement
Device Control 2 (DC2) 0012 Else statement (immediately follow with DC1 for an elseif statement)
Device Control 3 (DC3) 0013 While loop
Device Control 4 (DC4) 0014 Number loop (argument is a loop specifying how many times to run the code block)
Negative Acknowledge (NAK) 0015 False Boolean
Synchronous Idle (SYN) 0016 Continue to next iteration of loop or reevaluate if argument
End of Transmission Block (ETB) 0017 Break out of the current code block or loop (nop if not in a code block)
Cancel (CAN) 0018
End of Medium (EM) 0019 Close expression grouping
Substitute (SUB) 001A Replace the first value in the stack with the following value
Escape (ESC) 001B Use in a text string to include the next character in the string
File Separator (FS) 001C Separate different commands on one line
Group Separator (GS) 001D Separate expression to test in if or loop from code block or statement to run
Record Separator (RS) 001E
Unit Separator (US) 001F Separate digits in a number
Delete (DEL) 007F
Padding (PAD) 0080 Decimal point (must not be adjacent to US; use in place of US)
High Octet Preset (HOP) 0081 Create a number; repeat 0 to 9 times for each digit
Break Permitted Here (BPH) 0082
No Break Here (NBH) 0083
Index (IND) 0084 How many values that are in the stack
Next Line (NEL) 0085 Skip the rest of this line of code and move to the next line
Start of Selected Area (SSA) 0086 Open a code block
End of Selected Area (ESA) 0087 Close a code block
Horizontal Tabulation Set (HTS) 0088
Horizontal Tabulation with Justification (HTJ) 0089
Vertical Tabulation Set (VTS) 008A
Partial Line Down (PLD) 008B Move the bottom value of the stack to the top, then move all values down one
Partial Line Up (PLU) 008C Move the top value of the stack to the bottom, then move all values up one
Reverse Index (RI) 008D Flip the stack over
Single Shift 2 (SS2) 008E
Single Shift 3 (SS3) 008F
Device Control String (DCS) 0090
Private Use 1 (PU1) 0091
Private Use 2 (PU2) 0092
Set Transmit State (STS) 0093
Cancel Character (CCH) 0094
Message Waiting (MW) 0095 Ask the user for a text input, then push it onto the stack
Start of Protected Area (SPA) 0096 Open a comment
End of Protected Area (EPA) 0097 Close a comment
Start of String (SOS) 0098 Open a text string
Single Graphic Character Introducer (SGC) 0099
Single Character Introducer (SCI) 009A One-character text string that consists of the next character
Control Sequence Introducer (CSI) 009B Interpolate an expression into a text string if it is followed by SPA (the expression will end with EPA) and it is not preceded by ESC
String Terminator (ST) 009C Close a text string if not preceded by ESC
Operating System Command (OSC) 009D
Privacy Message (PM) 009E
Application Program Command (APC) 009F

*Abbreviations are used because some of the control characters get replaced with the replacement character (U+FFFD) and the characters in the examples can very easily be determined.