Kitanai

From Esolang
Jump to: navigation, search

Kitanai is an interpreted esoteric language.

The original interpreter is made with C++.

(By the way, Kitanai means "dirty" in Japanese (Obviously refering to the language's syntax))

Full language Syntax :

  • ( : Begin Instruction Bloc
    Usage : (Any code goes here)
  • ) : Stop Instruction Bloc
  • [ : Begin Memory Access
    Usage : [Any code goes here]
  • ] : Stop Memory Access
  •  ? : Condition
    Usage : ?(condition code)(code executed if condition code returns anything except 0)(code executed if condition code returns 0).
  • $ : AccessMemoryPosition
    Usage : $"position" OR $366 
    Description : "position" is the name of the "variable" you want to access and "366" is the sub-case of your variable).
  • @ : CurrentMemoryValue
    Usage : @ 
    Description : Returns the current value pointed in the Memory.
  • # : Flag
    Usage : #
    Description : Creates a new flag.
  • & : Goto
    Usage : &(x)
    Description : Jump to the (x) flag (Where x is the number of the flag).
  • * : GotoNoOrigin
    Usage : *(x)
    Description : Jump to the (x) flag (Where x is the number of the flag) without adding the origin to the pile.
  • ~ : Origin
    Usage : &~
    Description : Jump to the DynamicFlag created just after the previous Goto.
  •  ! : ToggleExecution
    Usage : !
    Description : Pause code execution until encountering a new ToggleExecution.
  •  % : End
    Usage : %
    Description : Ends the program.

Standard Library

Here are the available functions :

  • add (string) (string) :
    Description : Returns the concatenation of the two strings given as parameters.
  • add (number) (number) :
    Description : Returns the sum of the two numbers given as parameters.
  • sub (number) (number) :
    Description : Returns the subtraction of the two numbers given as parameters.
  • mul (number) (number) :
    Description : Returns the multiplication of the two numbers given as parameters.
  • div (number) (number) :
    Description : Returns the division of the two numbers given as parameters.
  • eq (string) (string)  :
    Description : Returns the Number(1) is the two strings are equal else it returns Number(0).
  • eq (number) (number)  :
    Description : Returns the Number(1) is the two numbers are equal else it returns Number(0).
  • neq (string) (string) :
    Description : Returns the Number(0) is the two strings are equal else it returns Number(1).
  • neq (number) (number) :
    Description : Returns the Number(0) is the two numbers are equal else it returns Number(1).
  • gt (string) (string)  :
    Description : Returns the Number(1) is the first string has a greater length than the second string else it returns Number(0).
  • gt (number) (number)  :
    Description : Returns the Number(1) is the first number is greater than the second one else it returns Number(0).
  • ge (string) (string)  :
    Description : Returns the Number(1) is the first string has a greater or equivalent length than the second string else it returns Number(0).
  • ge (number) (number)  :
    Description : Returns the Number(1) is the first number is greater or equal than the second one else it returns Number(0).
  • lt (string) (string)  :
    Description : Returns the Number(1) is the second string has a greater length than the first string else it returns Number(0).
  • lt (number) (number)  :
    Returns the Number(1) is the second number is greater than the first one else it returns Number(0).
  • le (string) (string)  :
    Description : Returns the Number(1) is the second string has a greater or equivalent length than the first string else it returns Number(0).
  • le (number) (number)  :
    Returns the Number(1) is the second number is greater or equal than the first one else it returns Number(0).
  • print (string)  :
    Description :  Prints the (string).
  • input (string)  :
    Description : Returns the string entered by the user and displays the (string) as a prompt.
  • string (string)  :
    Description : Does nothing.
  • string (number)  :
    Description : Converts an int to a string.
  • int (string)  :
    Description : Converts a string to an int.
  • int (number)  :
    Description : Does nothing.
  • random  :
    Description : Returns a random Number from 0 to 1.
  • substr (string) (number) (number) :
    Description : Returns the substring of (string) between the first and the second number.
  • bsf (string)  :
    Description : Returns the (string) encoded with base64. (Base Sixty Four = bsf)
  • ubsf (string)  :
    Description : Returns the (string) decoded with base64 (Base Sixty Four = bsf)

Examples

  • Hello World

(All of the following versions works)

print "Hello, world!"
print("Hello, world!")
print"Hello, world!"
["Hello, world!"] print @
["Hello, world!"] print(@)
["Hello, world!"]print@
  • Cat
print(input(""))
  • Fibonacci
$0[int(input "Fib : ")]
$1[1]$2[1]
#
    $3[$1@]
    $1[$2@]
    $2[add @ ($3@)]
    $0[sub @ 1]
?(neq ($0@) 1) (&1)
print($1@)
  • 99 bottles of beer
$"quant"[99]
#
    ?(gt @ 1) (
        print((add(add(add (string @) " bottles of beer on the wall, ")(string @)) " bottles of beer."))
        ?(gt @ 2) (
            $"suffix"[add (string(sub ($"quant"@) 1)) " bottles of beer on the wall."]
        ) (
            $"suffix"["1 bottle of beer on the wall."]
        )
    ) (
        ?(eq ($"quant"@) 1) (
            print "1 bottle of beer on the wall, 1 bottle of beer."
            $"suffix"["no more beer on the wall!"]
        )
    )
    print (add "Take one down, pass it around, " ($"suffix"@))
    print ""
    $"quant"[sub @ 1]
    ?(neq @ 0) (&1)
%
  • Compact Deadfish Interpreter :
$0[0]#$1[input">> "]?(add(eq($0@)256)
(eq($0@)-1))([0])?(eq($1@)"i")($0[add@1])?
(eq($1@)"d")($0[sub@1])?(eq($1@)"o")
(print($0@))?(eq($1@)"s")($0[mul@@])&1
  • Clean Deadfish Interpreter :
$"accumulator"[0]
#
    $"userInput"[input">> "]
    ?(eq ($"accumulator" @) 256)
        ($"accumulator"[0])
    ?(eq ($"accumulator" @) -1)
        ($"accumulator"[0])
    ?(eq ($"userInput" @) "i")
        ($"accumulator"[add @ 1])
    ?(eq ($"userInput" @) "d")
        ($"accumulator"[sub @ 1])
    ?(eq ($"userInput" @) "o")
        (print($"accumulator" @))
    ?(eq ($"userInput" @) "s")
        ($"accumulator"[mul @ @])
&1
  • Compact More or Less Game
#$(add ?1)[$"x"$0@]#print($"a"@)$"x"[ubsf"QmllbnZlbnVlIHN1ciBsZSBqZXUgZHUgcGx1cyBvdSBtb2lucw=="]
&0[ubsf"RW50cmV6IHVuIG5vbWJyZSAo"]&0[ubsf"IGVzc2FpcykgOiA="]&0[ubsf"Qydlc3QgcGx1cyAh"]&0
[ubsf"Qydlc3QgbW9pbnMgIQ=="]&0[ubsf"TG9vc2Vy"]&0[ubsf"V2lubmVyIGVuIA=="]&0[ubsf"IGVzc2Fpcw=="]
&0$"a"[0]&2$"s"[int(mul random 100)]$"t"[6]$"k"[0]#$"u"[int(input(add(add"a"[1]&2($"t"@))"a"[2]&2$"u"))]
&2?(eq($"t"@)0)(&3)?(eq($"k"@)1)(&4)&1#?(eq($"s"@)($"u"@))($"k"[1]&~)($"t"[sub @1]?(gt($"s"@)
($"u"@))(print"a"[3]&2)(print"a"[4]&2)&~)#print"a"[5]&2%#print(add(add"a"[6]&2(sub 6($"t"@)))"a"[7]&2)%
  • Clean More or less Game
print "Bienvenue sur le jeu du plus ou moins"
$"secretNumber" [int(mul random 100)]
$"try" [6]
$"numberFound" [0]

#
    $"userInput" [int(input(add(add "Entrez un nombre (" ($"try"@)) " essais) : "$"userInput"))]
    &2
    ?(eq ($"try"@) 0) (
        &3
    )
    ?(eq ($"numberFound"@) 1) (
        &4
    )
    &1
#
    ?(eq ($"secretNumber"@) ($"userInput"@)) (
        $"numberFound" [1]
        &~
    ) (
        $"try" [sub @ 1]
        ?(gt ($"secretNumber"@) ($"userInput"@)) (
            print "C'est plus !"
        ) (
            print "C'est moins !"
        )
        &~
    )
#
    print "Looser"
    %
#
    print(add(add "Winner en " (sub 6 ($"try"@))) " essais")
%