UTC+8

From Esolang
Jump to navigation Jump to search

UTC+8 is a Pseudonatural, CJK esolang invented by User:None1. It's name comes from the timezone used by China (UTC+8).

Commands

Commands explain themselves in Chinese
Command English explaination
输入的(数字/字符串/字符) Read an integer/a line of string/a character and return it (For characters, return the integer value of its Unicode value)
输出x Output x and return 空
输出字符x If x is an integer, output x as Unicode character and return 空, otherwise return 空
xy的(和/差/积) Return the sum/difference/product of x and y
x除以y的(商/余数) Return the quotient/remainder of x÷y
重复x次[code] Repeat [code] x times and return 空
无限地[code] Repeat [code] forever
x就[code] Repeat [code] while x is not 空, and nonzero if x is an integer, nonempty if x is a string then return 空
[code1]然后[code2] Do [code1] and [code2], return 空
如果x就[code] Do [code] if x is not 空, and nonzero if x is an integer, nonempty if x is a string
如果x就[code1]否则[code2] Do [code2] if x is not 空, and nonzero if x is an integer, nonempty if x is a string, otherwise [code2]
循环次数 When not in loop, it is 空, when in a loop, it is the number of times the loop body finishes execution in current loop (like the i in C's for loops (for(int i=0;condition;i++)))
x(且/或)y Return x and/or y
x(大于/等于/小于/不等于)y Return 1 if x is greater than/equal to/less than/not equal to y, and otherwise 0
x Return not x
() Priority
Output Nope.

Types and literals

There are these types: integers (signed bignums), 空 (nil) and strings (Unicode strings), characters are integers.

An integer literal is the number.

A string literal is everything inside quotes “”.

The 空 literal is 空.

Type conversions

UTC+8 uses a JavaScript-like type conversion, and it is weak typed, so conversions are done implicitly.

When casting to a string, integers become digit strings, 空 becomes an empty string.

When casting to an integer, a string converts to an integer, and if it fails to convert, it becomes 0, 空 becomes 0.

Addition casts both operands to strings and concatenate them unless both are integers. Other arithmetic operations cast both operands to integers.

Output operation casts value to string.

Logical operation operands are true when it is not 空 and nonzero if it is an integer and nonempty if it is a string, and false otherwise

For example:

1
-1
“0”
“空”

are truthy values while:

0
“”
空

are falsy values.

Division or modulo by 0 returns 空.

Comparisons are strong-typed.

Priority

Arithmetic
Comparison
Logic
Loops and Conditonals
Command concatenation (然后's)

Syntax

  • Spaces and tabs are ignored
  • Program must be in a single line
  • Program must end with 。

Examples

Hello World

输出“Hello, World!”。

Google Translate says:

Output "Hello, World!".

Cat program

输出输入的字符串。

Google Translate says:

Output the input string.

Truth Machine

如果输入的整数等于0就输出0否则无限地输出1。

Google Translate says:

If the input integer is equal to 0, it outputs 0, otherwise it outputs 1 infinitely.

Counter

无限地(输出循环次数与1的和然后输出字符10)。

Google Translate says:

infinitely (outputs the number of loops plus 1 and then outputs the character 10).

10x10 ASCII square

重复10次(重复10次输出“*”然后输出字符10)。

Google Translate says:

Repeat 10 times (repeat 10 times to output "*" and then output the character 10).

A+B problem

输出输入与输入的和。

Google Translate says:

Outputs the sum of input and input.

FizzBuzz

重复100次(如果循环次数与1的和除以3的余数等于0就(如果循环次数与1的和除以5的余数等于0就输出“FizzBuzz”否则输出“Fizz”)否则(如果循环次数与1的和除以5的余数等于0就输出“Buzz”否则输出循环次数)然后输出字符10)。

Google Translate says:

Repeat 100 times (if the remainder of the sum of the number of loops and 1 divided by 3 is equal to 0 (if the remainder of the sum of the number of loops and 1 divided by 5 is equal to 0, output "FizzBuzz" otherwise output "Fizz") otherwise (if the number of loops is divided by 5, the remainder If the remainder of the sum of 1 divided by 5 is equal to 0, output "Buzz"; otherwise, output the number of cycles) and then output the character 10).

Rickrolling (computer generated)

That is quite simple, isn't it?

输出“We're no strangers to love”然后输出字符10然后输出“You know the rules and so do I (do I)”然后输出字符10然后输出“A full commitment's what I'm thinking of”然后输出字符10然后输出“You wouldn't get this from any other guy”然后输出字符10然后 输出“”然后输出字符10然后输出“I just wanna tell you how I'm feeling”然后输出字符10然后输出“Gotta make you understand”然后输出字符10然后输出“”然后输出字符10然后输出“Never gonna give you up”然后输出字符10然后输出“Never gonna let you down”然后 输出字符10然后输出“Never gonna run around and desert you”然后输出字符10然后输出“Never gonna make you cry”然后输出字符10 然后输出“Never gonna say goodbye”然后输出字符10然后输出“Never gonna tell a lie and hurt you”然后输出字符10然后输出“”然后输出字符10然后输出“We've known each other for so long”然后输出字符10然后输出“Your heart's been aching, but you're too shy to say it (say it)”然后输出字符10然后输出“Inside, we both know what's been going on (going on)”然后输出字符10然后输出“We know the game and we're gonna play it”然后输出字符10然后输出“”然后输出字符10然后输出“And if you ask me how I'm feeling”然后输出字符10然后输出“Don't tell me you're too blind to see”然后输出字符10然后输出“”然后输出字符10然后输出“Never gonna give you up”然后输出字符10然后输出“Never gonna let you down”然后输出字符10然后输出“Never gonna run around and desert you”然后输出字符10然后输出“Never gonna make you cry”然后输出字符10然后输出“Never gonna say goodbye”然后输出字符10然后输出“Never gonna tell a lie and hurt you”然后输出字符10然后输出“”然后输出字符10然后输出“Never gonna give you up”然后输出字符10然后输出“Never gonna let you down”然后输出字符10然后输出“Never gonna run around and desert you”然后输出字符10然后输出“Never gonna make you cry”然后输出字符10然后输出“Never gonna say goodbye”然后输出字符10然后输出“Never gonna tell a lie and hurt you”然后输出字符10然后输出“”然后输出字符10然后输出“We've known each other for so long”然后输出字符10然后输出“Your heart's been aching, but you're too shy to say it (say it)”然后输出字符10然后输出“Inside, we both know what's been going on (going on)”然后输出字符10然后输出“We know the game and we're gonna play it”然后输出字符10然后输出“”然后输出字符10然后输出“I just wanna tell you how I'm feeling”然后输出字符10然后输出“Gotta make you understand”然后输出字符10然后输出“”然后输出字符10然后输出“Never gonna give you up”然后输出字符10然后输出“Never gonna let you down”然后输出字符10然后输出“Never gonna run around and desert you”然后输出字符10然后输出“Never gonna make you cry”然后输出字符10然后输出“Never gonna say goodbye”然后输出字符10然后输出“Never gonna tell a lie and hurt you”然后输出字符10然后输出“”然后输出字符10然后输出“Never gonna give you up”然后输出字符10然后输出“Never gonna let you down”然后输出字符10然后输出“Never gonna run around and desert you”然后输出字符10然后输出“Never gonna make you cry”然后输出字符10然后输出“Never gonna say goodbye”然后输出字符10然 后输出“Never gonna tell a lie and hurt you”然后输出字符10然后输出“”然后输出字符10然后输出“Never gonna give you up”然后输出字符10然后输出“Never gonna let you down”然后输出字符10然后输出“Never gonna run around and desert you”然后输出字符10然 后输出“Never gonna make you cry”然后输出字符10然后输出“Never gonna say goodbye”然后输出字符10然后输出“Never gonna tell a lie and hurt you”然后输出字符10。

Google Translate says:

Print "We're no strangers to love" then print 10 characters then print "You know the rules and so do I (do I)" then print 10 characters then print "A full commitment's what I'm thinking of" then print characters 10 then prints "You wouldn't get this from any other guy" then prints character 10 then prints "" then prints character 10 then prints "I just wanna tell you how I'm feeling" then prints character 10 then prints "Gotta make you understand" then output character 10 then output "" then output character 10 then output "Never gonna give you up" then output character 10 then output "Never gonna let you down" then output character 10 then output "Never gonna run around and desert you" then output character 10 and then output "Never gonna make you cry" then output character 10 then output "Never gonna say goodbye" then output character 10 then output "Never gonna tell a lie and hurt you" then output character 10 then output " "Then output character 10 and then output "We've known each other for so long" Then output character 10 and then output "Your heart's been aching, but you're too shy to say it (say it)" Then output character 10 and then output "Inside, we both know what's been going on (going on)" then prints character 10 then prints "We know the game and we're gonna play it" then prints character 10 then prints "" then prints character 10 then prints "And if you ask me how I'm feeling" then output character 10 then output "Don't tell me you're too blind to see" then output character 10 then output "" then output character 10 then output "Never gonna give you up "Then output character 10 then output "Never gonna let you down" then output character 10 then output "Never gonna run around and desert you" then output character 10 then output "Never gonna make you cry" then output character 10 then output "Never gonna say goodbye" then output character 10 then output "Never gonna tell a lie and hurt you" then output character 10 then output "" then output character 10 then output "Never gonna give you up" then output character 10 then output "Never gonna let you down" then output character 10 then output "Never gonna run around and desert you" then output character 10 then output "Never gonna make you cry" then output character 10 then output "Never gonna say goodbye" then output character 10 then output "Never gonna tell a lie and hurt you" then output character 10 then output "" then output character 10 then output "We've known each other for so long" then output character 10 then output "Your heart's been aching, but you' re too shy to say it (say it)" and then output character 10 and then output "Inside, we both know what's been going on (going on)" then output character 10 and then output "We know the game and we're gonna play it "Then output character 10 and then output "" Then output character 10 Then output "I just wanna tell you how I'm feeling" Then output character 10 Then output "Gotta make you understand" Then output character 10 Then output "" Then output character 10 then output "Never gonna give you up" then output the characters 10 then output "Never gonna let you down" then output the characters 10 then output "Never gonna run around and desert you" then output the characters 10 then output "Never gonna make you cry ” Then output character 10 and then output “Never gonna say goodbye” Then output character 10 Then output “Never gonna tell a lie and hurt you” Then output character 10 Then output “” Then output character 10 Then output “Never gonna give you up” Then output character 10 and then output "Never gonna let you down" then output character 10 then output "Never gonna run around and desert you" then output character 10 then output "Never gonna make you cry" then output character 10 then output "Never gonna say goodbye" then output character 10 then output "Never gonna tell a lie and hurt you" then output character 10 then output "" then output character 10 then output "Never gonna give you up" then output character 10 then output "Never gonna let you down" then output character 10 then output "Never gonna run around and desert you" then output character 10 then output "Never gonna make you cry" then output character 10 then output "Never gonna say goodbye" then output character 10 then output " Never gonna tell a lie and hurt you" and then output character 10.

Disan Count

无限地(如果循环次数与1的和除以2的余数等于0就输出循环次数然后输出“ is even!”然后输出字符10)。

Google Translate says:

Infinitely (if the remainder of the sum of the number of loops and 1 divided by 2 is equal to 0, output the number of loops and then output "is even!" and then output the character 10).

Nope. interpreter

Google Translate says:

.

Output Nope. infinitely

无限地()。

Google Translate says:

infinitely().

Looping counter

无限地(重复循环次数次输出“*”然后输出字符10)。

Google Translate says:

Infinitely (repeats the loop a number of times to output "*" and then outputs the character 10).

Nope. interpreter 2.0

无限地(如果输入的字符串等于“114514”就(。)否则(。))。

Google Translate says:

Infinitely (if the input string equals "114514" then (.) otherwise (.)).

Translated from: [1]. The latter programs are translated from [2]