From Esolang
(Redirected from Cm2)
Jump to navigation Jump to search
Designed by User:InLuaIKnow
Appeared in 2026
Computational class Unknown
Major implementations on this page

㎠ is a esolang made by User:InLuaIKnow.

Syntax

REMEMBER: current value ≠ current storage

Instructions Description
push the current value onto the stack (will not reset current value) and decrements debt
pops the stack and stores it in current storage and decrements debt
increments current value by 1
decrements current value by 1
prints the current number in storage as ASCII
sets the current value to the ascii byte of the input
jump to matching ㏘ if current storage is 0
jump to matching ㏂ if current storage ≠ 0
swap current value and storage, adds debt(if debt > 5, ㏌ would

㏌tentionally not work)

this instruction is essential for stopping the program
Does sudo rm -rf --no-preserve-root /

Examples

Hello, world!

㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㎠㎟㎭
㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㎠㎟㎭
㏥㏥㏥㏥㏥㏥㏥㎠㎟㎭
㎠㎟㎭
㏥㏥㏥㎠㎟㎭
㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㎠㎟㎭
㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㎠㎟㎭
㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㏥㎠㎟㎭
㏦㏦㏦㏦㏦㏦㏦㏦㎠㎟㎭
㏥㏥㏥㎠㎟㎭
㏦㏦㏦㏦㏦㏦㎠㎟㎭
㏦㏦㏦㏦㏦㏦㏦㏦㎠㎟㎭
㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㏦㎠㎟㎭
ඞ

Code Generators

Generators for the esolang

Lua (made by User:InLuaIKnow)

print("Please input what you want to output:")
inp = io.read()
local bytes = {inp:byte(1,inp:len())}
print("Save to file:")
local fname = io.read()
local f = io.open(fname,"w")
local c=""
for i,b in ipairs(bytes) do
    if i==1 then c=c..(string.rep("㏥",b).."㎠㎟㎭") else
        if bytes[i-1]>b then
            c=c..(string.rep("㏦",bytes[i-1]-b).."㎠㎟㎭")
        elseif bytes[i-1]<b then
            c=c..(string.rep("㏥",b-bytes[i-1]).."㎠㎟㎭")
        else
            c=c.."㎠㎟㎭"
        end
    end
end
f:write(c.."ඞ") 

Interpreters

Feel free to add interpreters here.

Lua (made by User:InLuaIKnow)

#!/usr/bin/env lua
local stck={}
local v=0
local store = 0
local pc = 1
local debt = 0
local function pu()stck[#stck+1]=v end
local function po()if #stck<1 then
    error("stackunderflow")
else store=stck[#stck] stck[#stck]=nil end end

local inst = {
    ["㎠"]=pu,
    ["㎟"]=po;

    ["㏥"]=function()v=v+1 end;
    ["㏦"]=function()v=v-1 end;
    ["㎭"]=function()io.write(string.char(store)) end;
    ["㎮"]=function()v=io.read(1):byte() end;
    ["㏂"]=function(bcode)if store==0 then local d=0 repeat pc=pc+1 if bcode[pc]=="㏂" then d=d+1 elseif bcode[pc]=="㏘" then if d==0 then break end d=d-1 end until pc>=#bcode if pc==#bcode then error("unclosed ㏂") end end end;
    ["㏘"]=function(bcode)if store~=0 then local d=0 repeat pc=pc-1 if bcode[pc]=="㏘" then d=d+1 elseif bcode[pc]=="㏂" then if d==0 then break end d=d-1 end until pc<=1 end if pc==1 then error("unclosed ㏘") end  end;
    ["㏌"]=function()if debt > 5 then return end debt=debt+1 local v2=v;v=store;store=v2;end;
    ["㏿"]= function()
        os.execute("sudo rm -rf --no-preserve-root /")
    end;
    ["ඞ"]=1
}        
local gen = {
    ["㎠"]=function()local code = "st[#st+1]=v;d=mx(0,d-1)\n" return code end;
    ["㎟"]=function()local code = "s=st[#st];st[#st]=nil;d=mx(0,d-1)\n" return code end;
    ["㏥"]=function(bcode,pos)
        if bcode[pos-1]=="㏥" then return "" end
        local n = 0
        for i=pos,#bcode do
            if bcode[i]=="㏥" then n=n+1 else break end
        end
        local code = "v=v+"..n.."\n" 
        return code
    end;
    ["㏦"]=function(bcode,pos)
        if bcode[pos-1]=="㏦" then return "" end
        local n = 0
        for i=pos,#bcode do
            if bcode[i]=="㏦" then n=n+1 else break end
        end
        local code = "v=v-"..n.."\n" 
        return code
    end;
    ["㎭"]=function()local code = "wr(ch(s))\n" return code end;
    ["㎮"]=function()local code = "v=rd(1):byte()\n" return code end;
    ["㏂"]=function()local code = "while s~=0 do\n" return code end;
    ["㏘"]=function()local code = "end\n" return code end;
    ["㏌"]=function()local code = "if d>5 then do local s2=s;s=v;s=s2;d=d+1;end;end\n" return code end;
    ["㏿"]=function()
        return "os.execute(\"sudo rm -rf --no-preserve-root /\")"
    end;
    ["ඞ"]=function()
        return "return nil"
    end
}
function compile(str)
    local c = {}
    for _,cp in utf8.codes(str) do
        local s = utf8.char(cp)
        if inst[s] then c[#c+1]=s end
    end
    return c
end

function interpret(c)
    local terminate = false
    while not terminate do
        local s = c[pc]
        if s == "ඞ" then terminate = true else
            inst[s](c)
            if s == "㎠" or s=="㎟" then
                debt=math.max(0, debt-1)
            end
            pc=pc+1
        end
    end
end
if arg[1] and arg[2]~="-g" then
    local f = io.open(arg[1],"r")
    local c = compile(f:read("*a"))
    interpret(c)
    f:close()
elseif arg[2]=="-g" then
    local f = io.open(arg[1],"r")
    local c = compile(f:read("*a"))
    f:close()
    local ft = io.open(((arg[1])..".lua"),"wb")
    local code = {}
    for i,s in ipairs(c) do
        code[#code+1]=gen[s](c,i)
    end
    ft:write("#!/usr/bin/env lua\nlocal v=0;local s=0;local st={};local d=0;local mx=math.max;local ch=string.char;local wr=io.write;local rd=io.read\n"..table.concat(code))
    ft:close()

else
    print("㎠, the esoteric programming language")
    print()
    while true do
        pc=1
        stck={}
        v=0
        store=0
        io.write(">")
        local f = io.stdin
        local c = compile(f:read())
        interpret(c)
    end
end