We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Chinese (PSTF)

From Esolang
Jump to navigation Jump to search

Chinese is a variant of English. At least a billion people know this programming language without knowing any other programming languages.

You might saw some detail of this programming language at !中文.

Example Programs

Cat Program

这个程序原样输出用户输入的东西。如果用户没有任何输入,则停止程序。

Quine

这个程序输出它的源代码。

Self-interpreter

这个程序接受一段程序的描述然后运行对应的程序。

Turing-Completeness Proof

这个程序接受一串字符,然后将其解释为Brainfuck。

Since brainfuck is Turing-complete, this programming language is also Turing-complete.

Computational Class

这个程序将解决停机问题。

Obviously uncomputable.

Errors

听不懂

When the language you provide isn’t Chinese, this error will be thrown. For example,

ይህ ፕሮግራም ቁጥር 4 ን ያወጣል.

But the language accepts the use of dialects, for example:

个斑马的

Even though the program does nothing and it's in the Hubei dialect, it's still a valid program.

语病

This error will be thrown when the program doesn’t follow Chinese grammar. For example,

通过这个程序使停机问题被解决。

Here, the simultaneous use of 通过 and 使 causes the sentence to lack a subject, so this sentence clearly has a grammatical problem.

Compilers

Like English, the compilers of this language are mainly humans, especially Chinese people.

Machine Learning

With the development of AI technology, we can now have machines recognize what we say. The following programs were all generated by the DeepSeek R1 671b web version.

Examples

Quine (Python)

s = 's = %r; print(s %% s)'
print(s % s)

Open or Create (Linux Bash)

#!/bin/bash
filename="$1"
if [ -f "$filename" ]; then
    # file exists – open it (e.g., with less, cat, or your editor)
    cat "$filename"
else
    # file doesn't exist – create it
    touch "$filename"
    echo "File created: $filename"
fi

Self-interpreter through input (Node.js)

#!/usr/bin/env node
const fs = require('fs');

let input = fs.readFileSync(0, 'utf-8'); // Read from stdin

if (!input.trim()) {
    console.error("Error: No input received to execute.");
    process.exit(1);
}

try {
    // 'eval' evaluates expressions, but for statements we can use 'vm' module or Function constructor
    // Using the Function constructor is safer than eval for strict mode, but still dangerous.
    const result = new Function(input)();
    if (result !== undefined) console.log(result);
} catch (e) {
    console.error(`Execution error: ${e.message}`);
    process.exit(1);
}

Nope. interpreter (C/C++)

#include <stdio.h>

int main() {
    int c = getchar();  // Attempt to read the very first byte

    if (c == EOF) {
        // No input at all – halt silently
        return 0;
    }

    // We received at least one byte
    printf("Nope.\n");
    return 0;
}

See Also

English

Categories