KanjiCode

From Esolang
Jump to navigation Jump to search

Introduction

KanjiCode (漢字コード) is a language created by ACVC in 7/1/2012. It has similarities to FALSE and Underload. As the very own name suggests, it's a language that aims to use as much Kanji as possible. There are currently no compilers for the language, only one interpreter, written in C#. It is very similar to FALSE in almost all aspects. For example, it's possible to create lambda expressions and store then into user-defined variables. Also, it's stack oriented : just like FALSE.

Instructions

" <string> " -> When the program finds a string, it just prints it.

足 -> Sums the two topmost elements of the stack and pushes the result onto the top of the stack.

掛 -> Multiplies the two topmost elements of the stack and pushes the result onto the top of the stack.

実 -> Executes a lambda expression located at the top of the stack. If no lambda expression is found, nothing is done.

0,1,2... n -> When the program finds a number, it's simply pushed onto the top of the stack.

引 -> Performs a subtraction operation between the second and the first members of the stack (Second - First) and pushes the result onto the top of the stack.

割 -> (Division operator) Works the same way as the subtraction operator.

倍 -> Multiplies the value at the top of the stack by two.

読<variable> -> Reads the value of a named variable and pushes the result onto the top of the stack, remembering that a variable name may only be composed of a single character.

[ <statements> ] -> Pushes a lambda expression onto the top of the stack.

→<var_name> -> Assigns the value at the top of the stack to a named variable. It can be either a number or a lambda expression.

止 -> Halts the program and waits for a keystroke to continue.

若[<Condition>]<var_name><var_name2> -> Performs a conditional check. If the condition is true, then the lambda expression contained within <var_name> is executed, otherwise the lambda expression executed is the one contained within <var_name2>.

繰<var_name><var_name2> -> The lambda expression in <var_name2> will be executed until the value of <var_name> is 0.

替 -> Switches the two topmost elements of the stack.

行 -> Prints the line terminator.

除 -> Clears the stack.

逆 -> Reverses the stack's order.

数 -> Prints the topmost element of the stack as an integer. Does not remove it from the top.

字 -> Prints the topmost element of the stack as an ASCII character. Does not remove it from the top.

外 -> Removes the topmost element of the stack.

Code samples

(The "Hello, world!" program.)

1倍倍倍倍倍倍1倍倍倍足字
29足字7足字字3足字1足2割12引字
12引字3掛23足字8引字3足字6引字
8引字3割字止

or even

"Hello, world!"止

(This example prints 'Hello, world!' 10 times.)

0→下10→上1→制
[0→制]→変
[読下1足→下]→増
["Hello, world!"行]→λ
[読λ実読増実若[下>=上]変無]→体
繰制体止

(This example prints a number of the Fibonacci's sequence everytime the user presses 'Enter')

1 1 数行数行
[足数行止]→λ 1→制
繰制λ

(99 bottles of beer)

1→制99→御[0→制]→変
[読御数 " bottles of beer on the wall, "数" bottles of beer."行"Take one down pass it around, " 1引数 " bottles of beer on the wall."
行行]→★[読御1引→御]→下
[読下読★実外実若[御<<制]変無 ]→体
繰制体"No more bottles of beer on the wall, no more bottles of beer. 
Go to the store and buy some more, 99 bottles of beer on the wall."止

Computational class

替外[]実 seem to correspond to Underload ~!()^. KanjiCode lacks Underload :, but it can still be achieved by using the construction →<variable>読<variable>読<variable> or even [→<variable>読<variable>読<variable>]→<variable'> (Construction which would have to be called through usage of the 実 and 読 operators : <variable'>読実) . KanjiCode can, therefore, emulate a Turing complete subset of Underload.

External resources

  • The interpreter can be downloaded here: KCInterpreter (binary only, no source.)