Atamagaokashii

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.
頭がおかしい
Paradigm(s) imperative, object-oriented, functional
Designed by User:RaiseAfloppaFan3925, User:Hammy
Appeared in 2025
Type system static
Memory system variable-based
Computational class Turing-complete
Reference implementation Unimplemented
Influenced by RSI0, LOLCODE, INTERCAL, 5DBFWMTT, Lua, Magpie, Ruby, Rust

Atamagaokashii, formerly RSI1, is an esolang by User:RaiseAfloppaFan3925 based on his previous esolang, RSI0, and imperative languages such as LOLCODE, INTERCAL, object-oriented/functional languages such as Ruby and Rust, and languages that can modify their own syntax at runtime such as Magpie. Users of this wiki can add extensions to Atamagaokashii as long as they follow the rules.

Etymology

Fair warning: If you're a native Japanese speaker or you understand Japanese, please feel free to correct me because I'm still an absolute beginner and I'm still learning. If I get something slightly inaccurate or COMPLETELY WRONG, please tell me about it and I will fix or remove it.

For anyone interested, here is the origin of Atamagaokashii's name.

Atamagaokashii is the romanized version of 頭がおかしい, a Japanese word which roughly means "insane" or "out of their mind" referring to a person. The usage of this word originated from my original naming ideas, "私の愚かな考えの融合" (watashi no orokana kangae no yougou, The fusion of my stupid ideas) and "私の愚かな観念の極致は頭がおかしくて愚かだ" (watashi no orokana kannen no kyokuchi ha atamagaokashikute orokata, The culmination of my stupid ideas is insane and stupid). Atamagaokashikute being the て-form of atamagaokashii, an い-adjective. However, please note that this was before I realized that 頭がおかしい is for PEOPLE, not for objects or abstract concepts. So if you're Japanese or if you understand the language, you will definitely be confused. Please note that I'm still a beginner at the language. And by "beginner", I mean ABSOLUTE beginner.

Core Entities

Atamagaokashii is held together by three entities, the Runtime, the Program, and Teto, who is referred to as 重音テトさん in code.

Program

Program (or Programさん) is the entity that holds the program code and executes most code, reaching out to Runtime if needed. Program stores variables, and executes most code, including function calls.

Runtime

Runtime (or Runtimeさん) is the entity that performs complicated tasks that Program cannot execute by themselves, such as importing libraries (and Teto) or manipulating timelines. They must be addressed with respect as they can just decide to not execute their tasks.

Kasane Teto

Teto (or 重音テトさん), pretty obviously the UTAUloid that made her way to ultimate fame in the Vocaloid community, is core to RSI1. (at least unless TwinDrill sends me a copyright notice in which I will gladly take this down) Teto will protect your program from hypnosis but must be given baguettes every now and then.

Sanity

Just like RSI0, Atamagaokashii has a sanity feature that goes down by 0.01 per instruction. Since Atamagaokashii is still unimplemented and is more "traditional" unlike the Befunge-like RSI0, it is unclear how this will work.

The lower the sanity level is, the faster your program gets hypnotized.

Politeness

Just like INTERCAL, Atamagaokashii has a politeness mechanic. The please keyword makes the program more polite. However, Atamagaokashii also has the thank you keyword which should come after a "significant" expression such as a function call or a timeline-related command. For commands involving Teto, the Japanese versions (if there are any) should be used instead.

Hypnotization

A feature that was scrapped in RSI0 in favor of sanity, hypnotization starts at 0% and increases constantly. If the hypnotization meter ever exceeds 50%, then the Mesmerizer song (by Satsuki/32ki) and MV (by channel) (https://www.youtube.com/watch?v=19y8YTbvri8&pp=ygUKbWVzbWVyaXplctIHCQkDCgGHKiGM7w%3D%3D) will be opened at random. (until Satsuki and/or channel send me a copyright notice, in that case understandable) If it ever hits 100%, then the program halts.

Hypnotization Resistance

Hypnotization resistance is another feature from RSI0 that was scrapped. In Atamagaokashii, hypnotization resistance is the ability of the program to resist hypnotization. It is constantly decreasing and will decrease a lot if time travel operations are used. The only way to regain hypnotization resistance is by giving Teto a baguette.

Time travel

Atamagaokashii's time travel mechanics are very simple. The instruction pointer can travel backward in time, creating a separate timeline where the program has its current variables but is in a place before they even existed.

please import 重音テトさん 下さい
please import Food thank you

please travel 3 thank you
Programさんは重音テトさんにFoodのBaguetteのfrom_length(10km)をあげる
Programさんはmy_varに8をあげる // variable is assigned before it's declared... but TIME TRAVEL exists.
please travel 3 thank you
Programさん, please reserve my_var: int thank you
please travel -3 thank you
Command Example Action Notes
merge Merges the current timeline with the last created timeline, adding a new instruction pointer that executes in parallel. Brings over the locals and globals of the previous timeline. If a local/global from the previous timeline conflicts with a local/global in the merged timeline, then the instruction pointers will use their own versions of the local/global. I can't explain it that well, but just picture this. Timeline A has a global singer which is equal to "teto", and spawns a timeline Timeline B. Timeline B overrides its own singer variable to be "miku", then merges with Timeline A. Timeline A still sees singer to be "teto", but Timeline B's instruction pointer which is now in Timeline A still sees singer to be "miku".
reincarnate right now If the current timeline has been ended, then it will be restarted at the first command AFTER the one that ended the timeline.
travel travel N, travel function Spawns a new timeline and travels N lines forward. If N is less than zero, then travels backward N lines. If a function (not a function call, so no parentheses) is given instead of a number, then a new timeline is spawned where that function is the starting point.

Classes and Traits

RSI1 is object-oriented and uses Rust-like traits.

class Vector2
    public member x: float
    public member y: float

    public static func new(x: float, y: float) Vector2
        Programさん、please reserve vector: Vector2 thank you
        Programはvectorさんのxにxをあげる
        Programはvectorさんのyにyをあげる
        please take vector you're welcome
    end

    public func dot(self: Vector2, other: Vector2) float
        please take selfのx * otherのx + selfのy * otherのy you're welcome
    end
end

impl Add for Vector2
    func add(self: Vector2, other: Vector2) Vector2
        please take Vector2 { x: selfのx + otherのx, y: selfのy + otherのy } you're welcome
    end
end

Variables

Declaring a variable can be done with the following syntax:

Programさん、reserve var: type

With the polite version being

Programさん、please reserve var: type thank you

Assignment is done with the following syntax:

Programさんはvariableにvalueをあげる

Which if I'm not wrong, means "Program gives variable value" if you translate it as a Japanese sentence.

Conditionals and Control Flow

Atamagaokashii only has two control flow constructs (4 if you count the time travel commands end the timeline and travel), if/else/else if and match.

if

Atamagaokashii has if statements that are based on Lua's if statements, but with C-style else if chaining.

if a == b then
    // stuff
else if a > b then
    // stuff
else
    // stuff
end

match

Atamagaokashii has similar pattern matching syntax to Rust, with the match keyword.

// even is true, odd is false
func even_odd(int value) bool
    match value
        1 | 3 | 5 | 7 | 9 | 11 | 13 | 15 | 17 | 19 | 21 | 23 | 25 | 27 | 29 => false
        2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 => true
        default => yeet Exception("Value is not in range")
    end
end

Loops

Atamagaokashii doesn't have traditional loops, however they can be replicated with combinations of the time travel commands travel and end the timeline and if statements.

while loop

if !condition then
    please travel loop_end thank you
    please end the timeline thank you
end
:loop_start
    // do stuff here
    if condition then
        please travel loop_start thank you
        please end the timeline thank you
    end
:loop_end

Infinite loop

:loop
    // do stuff
    please travel loop thank you
    please end the timeline thank you

Member/Method Access

Accessing a member or method is pretty simple, just write thingのthing_you_want. An exception though is with the 重音テトさん entity module, where methods are in the form of Japanese sentences.

an alternative for both of these is . like in normal languages because User:Hammy hates copy+pasting japanese a bunch of times >:(

The . (dot) is a part of the User:Esolangist (or User:Hammy?) extension.

Core Modules

重音テトさん

重音テトさん is a special core module which is required to run long-running programs or time-travelling programs. The module's name is actually 重音テト, but the さん is necessary as it is a sign of respect. The primary purpose of 重音テトさん is to regenerate your program's hypnotization resistance and combat hypnosis. This is done by giving her a baguette.

Food

Food is a special core module which comes with exactly one class: FoodのBaguette. Baguette exists for the 重音テトさん module, since you give her baguettes to regenerate hypnosis resistance.

Miscellaneous

  • io

Examples

Infinite loop

please import 重音テトさん 下さい
please import Food thank you

Programさんは重音テトさんにFoodのBaguetteのfrom_length(1m)をあげる
please travel -1 thank you

Hello world program

// shameless intercal clone
please import io thank you
please ioのprint("Hello, world!") thank you

Here is what happens if you don't add the please before importing the io module

Output:

[Runtime] Listen, could you PLEASE learn to use the word "please"? Importing
modules is a pretty difficult job since I have to find them and repeatedly ask
them to participate in whatever you're doing, and it's pretty unrewarding too.
So I would appreciate it if you at least showed some respect.

Either thank you doesn't matter that much here since the program is short, but always thank Runtime.

Alternated

// shameless intercal clone but with string escapers
please import io thank you
please ioのprint("\⟨hw⟩) thank you

Cat program

please import 重音テトさん 下さい
please import Food thank you
please import io thank you

Programさん, please reserve my_input: string thank you
Programさんはmy_inputさんにioのinput()をあげる
Programさんは重音テトさんにFoodのBaguetteのfrom_length(10km)をあげる // 10 km baguette for Teto!
if my_input == '' then
    Runtimeさん, please end the timeline thank you
end
please ioのprint(my_input) thank you
travel -7 thank you // look i have time travel!

Here is what happens if you don't add the thank yous and the politeness meter goes down after making a couple of timelines.

[Runtime] Not even gonna thank me? How rude of you, I went through so much trying to do what you wanted me to do. I even made a new timeline JUST for you. And you're not even gonna thank me? Why don't YOU make these timelines yourself?

Truth Machine

please import 重音テトさん ください
please import io thank you

Runtimeさん, please reserve my_input: string thank you
Programさんはmy_inputさんにioのinput()をあげる
Programさんは重音テトさんにFoodのBaguetteのfrom_length(10km)をあげる
if my_input == "1" then
    please ioのprint(1) thank you
    Programさんは重音テトさんにFoodのBaguetteのfrom_length(10km)をあげる
    travel -2
end
please ioのprint(0) thank you

XKCD Random Number

please import io thank you

please ioのprint(4) thank you

Nope. Interpreter

please import 重音テトさん ください
please import io thank you

Programさん、please reserve source: string thank you
Programさんはsourceにioのinput()をあげる
Programさんは重音テトさんにFoodのBaguetteのfrom_length(10km)をあげる
if source == "Nope." then
    please ioのprint("Nope.")
else
    please ioのprint("Nope.")
end

BF Interpreter

This proves the Turing-completeness of Atamagaokashii

please import 重音テトさん ください
please import Food thank you
please import io thank you

Programさん、please reserve source: string thank you
Programさんはsourceにioのinput()をあげる
Programさんは重音テトさんにFoodのBaguetteのfrom_length(10km)をあげる

Programさん、please reserve ip: int thank you
Programさん、please reserve cells: [int, 30000] thank you
Programさん、please reserve cc: int thank you

:loop_start // labels are supported now!
    Programさんは重音テトさんにFoodのBaguetteのfrom_length(100m)をあげる
    match ip番目のsource
        '+' => Programさんはcc番目のcellsに(cc番目のcells + 1) % 256をあげる
        '-' => Programさんはcc番目のcellsに(cc番目のcells - 1) % 256をあげる
        '<' => Programさんはccに(cc - 1) % 30000をあげる
        '>' => Programさんはccに(cc + 1) % 30000をあげる
        '[' => begin
            Programさんは重音テトさんにFoodのBaguetteのfrom_length(500m)をあげる
            if cc番目cells != 0 then please travel end_search thank you end
            Programさん、please reserve lookahead: int thank you
            Programさん、please reserve level: int thank you
            :search
                Programさんは重音テトさんにFoodのBaguetteのfrom_length(500m)をあげる
                if (ip + lookahead)番目のsource == ']' then
                    Programさんはlevelにlevel - 1をあげる
                else if (ip + lookhead)番目のsource == '[' then
                    Programさんはlevelにlevel + 1をあげる
                end
                
                if level < 0 then
                    please ioのprint("Mismatched brackets") thank you
                    please end this timeline thank you
                else if level == 0 then
                    Programさんはipにip + lookaheadをあげる
                    please travel end_search thank you
                    please end this timeline thank you
                end
                
                Programさんはlookaheadにlookahead + 1をあげる
                please travel search thank you
                please end this timeline thank you
            :end_search
        end
        ']' => begin
            Programさんは重音テトさんにFoodのBaguetteのfrom_length(500m)をあげる
            if cc番目のcells == 0 then please travel end_search thank you end
            Programさん、please reserve backtrack: int thank you
            Programさん、please reserve level: int thank you
            :search
                Programさんは重音テトさんにFoodのBaguetteのfrom_length(500m)をあげる
                if (ip - lookahead)番目のsource == ']' then
                    Programさんはlevelにlevel + 1をあげる
                else if (ip - lookhead)番目のsource == '[' then
                    Programさんはlevelにlevel - 1をあげる
                end
                
                if level < 0 then
                    please ioのprint("Mismatched brackets") thank you
                    please end this timeline thank you
                else if level == 0 then
                    Programさんはipにip - backtrackをあげる
                    please travel end_search thank you
                    please end this timeline thank you
                end
                
                Programさんはbacktrackにbacktrack - 1をあげる
                please travel search thank you
                please end this timeline thank you
            :end_search
        end
        '.' => begin
            please ioのprint(stringのascii_from_u8(cc番目cells)) thank you
        end
        ',' => begin
            Programさんはcc番目cellsにcc番目please ioのinput()のto_ascii_u8() thank youをあげる
        end
        default => begin end
    end
    Programさんはipにip + 1をあげる
please travel loop_start thank you

Extending the Syntax

Extending the syntax in Atamagaokashii is very easy as it is built into the language.

All of the syntax extension blocks can have these in their syntax definition. (the thing immediately after the keyword)

Syntax Action Example Note
Plain identifier/number/symbol excluding the symbols listed here Just a part of the syntax VISIBLE, 123, ?
$ A parameter to the literal. Acts like a variable. $thing If you want a plain $ without creating a parameter, then use a $$

Since the custom syntaxes might have dependencies (modules that need to be imported for the keyword to work), the dependencies keyword can be used to specify modules that Runtime should import if they aren't already imported. It functions like a block and just contains module names. This goes at the very top of the body of the syntax block, anywhere else will cause an error.

dependencies
    io
    ExtensionsのEsolangist
    FoodのBaguette
end

Keywords

New keywords are declared with the keyword keyword, which makes a block structure like this.

keyword [KEYWORD STUFF HERE]
    keyword body
end

Literals

Literals can be defined with the literal keyword in the same way as keywords.

literal [LITERAL STUFF HERE]
    literal body
end

Operators

Operators follow the same syntax as literals and keywords, except using the operator keyword.

Examples

VISIBLE keyword example

public module lolcode_visible

public keyword VISIBLE $THING
    dependencies
        io
    end

    please ioのprint($THING)
end

A program that uses it

please import lolcode_visible thank you

VISIBLE "O HAI ATAMAGAOKASHII"

Output:

O HAI ATAMAGAOKASHII

Custom numeric literal example

public module hex_literals

please import atamagaokashiiのcompilerのtokensのinteger thank you

public literal #$[num: integer]
    intのfrom_hex(stringのnum_to_hex(num as int))
end

Program

import hex_literals
import lolcode_visible

VISIBLE "LOOK!"
VISIBLE #FFFFFF // Should be 16777215

Output

LOOK!
16777215

Factorial operator example

public module factorial

please import 重音テトさん ください
please import Food thank you

func fac[T implements Compare, Sub, Mul](T x) T
    if x < 2 then
        please take x you're welcome
    end
    Programさんは重音テトさんにFoodのBaguetteのfrom_length(250m)をあげる
    fac(x - 1) + fac(x - 2)
end

public operator $expr!
    Programさんは重音テトさんにFoodのBaguetteのfrom_length(1km)をあげる
    fac(expr)
end

Program

please import factorial thank you

Extensions

Just like RSI0, Atamagaokashii can be extended with unofficial extensions. However, they must follow these rules:

Rules

  1. Put them in a section (like == [[User:YourUser]] ==) or a subpage like Atamagaokashii/YourUser.
  2. All commands MUST be grouped into a module (for example, the User:Esolangist extension is the Esolangist module.)
  3. Do not modify other people's extensions unless it's to fix a typo.
  4. All commands MUST be computable. If the command does something like put all digits of into a string, then you must specify a caveat. For example, there is a π command in the User:Esolangist extension which outputs the digits of infinitely, it was modified to instead return a EsolangistのLazyPi instance, which supports the edge case where it is converted into a string.
  5. If the command modifies the syntax, then make sure that it is implementable with the syntax extensions. (currently undefined, so you should not add any syntax extensions outside of new operators, literals, and keywords)

User:Esolangist

wait I thought my joke thread wouldn't happen? anyway here's commands yay

ATAMAGAOKASHII COMMANDS BY ESOLANGIST
Command Meaning Example
push (n) Pushes (n) to the stack you really need an example?
get me out of here Discards the top value on the stack. MUST be after "please" just look at the meaning...
π Outputs 3.141592653589... (infinitely.) not now
baguettes yay Prints "baguette", then the top value of the stack. Then print "baguette" then the second-from-top value of the stack etc... Can be thought of as a debug command.
Esolangistさんのpush(123)
Esolangistさんのpush(456)
Esolangistさんのpush("Hi world")
Esolangistさんのbaguettes yay

The output will be:

baguetteHi world
baguette456
baguette123

here's the types yay

Types in RSI1
Type Look at it.
String "something"
Number #1 or №1
Boolean ?1 for true, ?0 for false
Lambda {λa.E}, see Lambda calculus
Mojibake/Character 『Windows-1252 mojibake for the character you are making』

and here's some string escapers or whatever they are called

THIS USES THE FULLWIDTH BACKWARDS SOLIDIUS (\) AND NOT THE BACKWARDS SOLIDIUS (\) SO IT IS PAINFUL LOL

also you can use windows-1252 mojibake inside 『』for characters so it is painful

also ALSO if you use a \ instead it outputs "Normal backslashes are for babies. You know how to type unicode characters, don't you?" and halts

String Escapers/Replacers/Whatever they are called
Replacement What it looks like
\⟨n⟩ (Newline)
\⟨o/ca⟩ ⟨/⟩
\⟨hw⟩ Hello, world!
\⟨fwbs⟩ or 『ï¼¼』

Extension Examples

User:Esolangist extensions

please import ExtensionsのEsolangistさん thank you
please import io thank you

Esolangistさんのpush(69)
Esolangistさん、please get me out of here
please ioのprint(Esolangistさんのπ) thank you // Unless Esolangist specifies otherwise, then Esolangistさんのπ is actually a hidden object of class LazyPi, which when outputted just infinitely prints the digits of pi.
Programさん、please reserve e_boolean: EsolangistさんのBoolean
Programあんはe_stringに?1をあげる // Modules can add custom literal syntaxes, further complicating any potential RSI1 compiler.
please ioのprint(e_boolean) thank you