We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

SMISC

From Esolang
Jump to navigation Jump to search
SMISC
Paradigm(s) imperative
Designed by User:Obuqwe
Appeared in 2026
Dimensions one-dimensional
Computational class Category:Unknown computational class
Reference implementation Unimplemented
File extension(s) .sm

SMISC (or Smisc) is a self-modifying esolang created by User:Obuqwe in 2026. The main principle of this language is that the code is both memory and code. Using just 4 base instructions swap, copy, input, output to manage logic and control flow.

Language description

Smisc code is ran line by line. It runs until it reaches the end of the file, at which it may loop back to the first line. The program will loop if any of the 4 base instructions have been hit at least once in this cycle. Meaning the only way for the program to halt is to effectively erase itself. The program cannot alter how many lines it has.

The only type of variable are positive integers. The user may write character literals in the code itself which will be converted to the character's corresponding value whenever it is used. Valid quote characters are `, ', and ".

Instructions

Instruction Description
swap n a b Swap n amount of lines from line a to line b
copy n a b Swap n amount of lines from line a to line b
input a Take a single character input from the user and put it on line a
output n a Outputs n amount of lines starting from line a. Each line will be evaluated and it's
number value will be outputted as it's corresponding character value. All instruction
calls evaluate to 0

Expressions & Literals

Expressions are allowed both in the main function body and as an argument inside an instruction call. They are written use polish notation and allow the use of brackets to nest expressions inside other expressions. Expressions that are an argument to an instruction call must be inside brackets. When they're evaluated inside the main program body, the line it's on is overwritten by the value it evaluated to.

There are 5 self-explanatory maths operations that are available to the user: +, -, *, /, and >. These are written using polish notation. Meaning the symbol is written first, and then it's two parameters are written after it.

 -- a bunch of different expressions
 + 1 4
 + (> 2 5134) 12
 - "?" 48
 * (/ 2 412) (> "f" "b")
 
 -- an expression inside an instruction call
 swap (+ (> 32 10) 100) (- 42 1) 0

Literals are any value that is written that doesn't need Evaluation. Any number or string literal on it's own line or inside an expression. String literals longer then one character be expanded onto multiple lines when the program is first run. This is the only way for a program to grow in amount of lines once it is ran.

 "abc"
 -- will become ->
 "a"
 "b"
 "c"

Labels

Labels are a way to reference certain lines of code without having to directly point to them with numbers. They are indicated by a period followed by a name, without any space between. The label refers to the line immediately after it

 .my-label
 1942 -- the label points to this value
 9812
 4294

Labels can be used inside expressions. If you write the label name with a period infront of it, it will evaluate to the line it's labeling. If not, it will evaluate and return the value of the line it refers to.

Comments

Comments are indicated with two minus symbols (--). All text proceeding this will be ignored until then next newline. While comments themselves are ignored, the line they're on is still a valid place to swap, copy, or refer to.

Etymology

SMISC (or Smisc) is an acronym for Self-Modifying Instruction Set Computer. It's a play on other similar acronyms, namely RISC (Reduced Instruction Set Computer) and OISC (One Instruction Set Computer).

Computational class & Use

It's creator User:Obuqwe believes that it is likely Turing complete. However not enough testing has been done to confirm this.

Integer width

There is currently no standardised width for integers in Smisc. Though no matter the size, overflowing and underflowing integers is an explicit behaviour of this language.

Truth machine

This program works by clearing itself if the input is zero, after already having printed it once. If it doesn't clear itself, it'll simply repeat.

 -- truth machine ----------------
 ---------------------------------
 ---------------------------------
 ---------------------------------
 .n
 input .n
 output 1 .n
 copy (* 4 (> 1 (- n 48))) 0 5

Hello, World!

 -- blank space ----------------------
 -------------------------------------
 -------------------------------------
 -------------------------------------
 -------------------------------------
 -------------------------------------
 -------------------------------------
 -------------------------------------
 -------------------------------------
 -------------------------------------
 -------------------------------------
 -------------------------------------
 -------------------------------------
 -------------------------------------
 -------------------------------------
 output 13 2
 "Hello, World!"
 copy 15 0 16