{"id":13440964,"url":"https://github.com/flaneur2020/pua-lang","last_synced_at":"2025-10-08T12:14:07.608Z","repository":{"id":41281986,"uuid":"359153756","full_name":"flaneur2020/pua-lang","owner":"flaneur2020","description":"a dialect of The Monkey Programming Language","archived":false,"fork":false,"pushed_at":"2024-12-02T03:56:26.000Z","size":1232,"stargazers_count":3286,"open_issues_count":35,"forks_count":126,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-05-21T01:10:35.190Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flaneur2020.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-18T13:40:46.000Z","updated_at":"2025-05-15T02:09:06.000Z","dependencies_parsed_at":"2022-07-06T11:21:04.602Z","dependency_job_id":"868be575-c103-4970-8342-87d362010ed9","html_url":"https://github.com/flaneur2020/pua-lang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/flaneur2020/pua-lang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaneur2020%2Fpua-lang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaneur2020%2Fpua-lang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaneur2020%2Fpua-lang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaneur2020%2Fpua-lang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flaneur2020","download_url":"https://codeload.github.com/flaneur2020/pua-lang/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaneur2020%2Fpua-lang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278940901,"owners_count":26072600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:28.344Z","updated_at":"2025-10-08T12:14:07.579Z","avatar_url":"https://github.com/flaneur2020.png","language":"Rust","funding_links":[],"categories":["HarmonyOS","Rust","库"],"sub_categories":["Windows Manager"],"readme":"# pua-lang\n\n\u003e PUA Programming Language written in Rust.\n\n## What's pua-lang?\n\npua-lang is a dialect of The Monkey Programming Language, intended to mirror the inspirational babble of Alibaba managers (\"Aba-aba\").\nThe name \"pua\" refers to the manipulative way Alibaba treats its employees -- much like how pickup artists treat their trophies.\n\nThis implementation is a fork of [rs-monkey-lang](https://github.com/wadackel/rs-monkey-lang).\n`Monkey` is a programming language designed to learn interpreters.\nIt comes from [Writing An Interpreter In Go](https://compilerbook.com/).\n\n## Try pua-lang!\n\n### with wasm playground\nhttps://flaneur2020.github.io/pua-lang/\n\nWe are aware that the output streams don't quite work.  Rust doesn't really\nhave I/O redirection and `wasm32-unknown-unknown` has no I/O by default.\n\n### with REPL\n\n```bash\n$ git clone https://github.com/flaneur2020/pua-lang.git\n$ make repl\n```\n\n## Documentation\n\n:warning: **Please note that there may be some mistakes.**\n\n### Summary\n\n- Everything Monkey has:\n  - C-like syntax\n  - variable bindings\n  - integers and booleans\n  - a string data structure\n  - an array data structure\n  - a hash data structure\n  - arithmetic expressions\n  - built-in functions\n  - first-class and higher-order functions • closures\n- Unicode identifiers (UAX #31, XID) plus monetary extensions (`[¥$_]`) and an overly-lax definition of Emojis.\n- Rust-compatible double-quoted string syntax.\n- Ridiculous naming for the Aba-aba. Comparison with Monkey:\n\n|Monkey|pua-lang|Explanation|\n|---|---|---|\n|if|细分|\"specialization\"|\n|else|路径|\"pathway\"|\n|while|闭环|\"closed loop\"|\n|break|破圈|\"break the circle\"|\n|true|三七五|\"3.75\", a passing performance evalulation result|\n|false|三二五|\"3.25\", a failing performance evalulation result|\n|let|赋能|\"empower\"|\n|fn|抓手|\"handle\", as in getting a handle on things|\n|return|反哺|\"repay\", used in Alibaba as a general term for feedback in systems|\n|Array|组合拳|\"combo move\"; not yet a word in the language|\n|Hash|载体|\"carrier\"; not yet a word in the language|\n|=|对齐|\"align\"|\n|+|联动|\"linkage\"|\n|-|差异|\"difference\"|\n|/|倾斜|\"tilt\"|\n|puts|输出|\"output\"|\n|quit|淘汰|\"eliminate\"|\n|(atoi)|量化|quantify\n\nThe precise set of renames may change from time to time as we explore new ~~avanues of profit~~ pathways to the full enablement of our ~~shareholders~~ customers. You are encouraged to (ahem) carefully study the spirit of `src/lexer/mod.rs` and `src/evaluator/builtins.rs` in order to align yourself with Ali-speak and maximize your output.\n\n### Syntax overview\n\nAn example of Fibonacci function.\n\n```\n赋能 fib = 抓手(x) {\n  细分 (x 对齐 0) {\n    反哺 0;\n  }\n  细分 (x 对齐 1) {\n    反哺 1;\n  } 路径 {\n    反哺 fib(x - 1) 联动 fib(x - 2);\n  }\n};\n\nfib(10);\n```\n\n#### 细分\n\n细分 supports the general `细分`. `路径` exists, but` 细分 路径` does not exist yet.\n\n```\n细分 (三七五) {\n  10;\n} 路径 {\n  5;\n}\n```\n\n#### 闭环\n\nWith the 闭环 we can execute a set of statements as long as a condition is 三七五.\n\n```\n闭环 (三七五) {\n    输出(\"年年有抓手\");\n}\n```\n\n\n#### Operators\n\nIt supports the general operations.\n\n```\n1 + 2 + (3 * 4) - (10 / 5);\n!三七五;\n!三二五;\n+10;\n-5;\n\"年年有抓手\" + \" \" + \"岁岁有闭环\";\n```\n\n#### 反哺\n\nIt returns the value immediately. No further processing will be executed.\n\n```\n细分 (三七五) {\n  反哺;\n}\n```\n\n```\n赋能 不变 = 抓手(工资p6) {\n  反哺 工资p6;\n};\n\n不变(\"👨‍💻🐒烧酒\");\n```\n\n### 赋能\n\n赋能, such as those supported by many programming languages, is implemented. Variables can be defined using the `赋能` keyword.\n\n**Format:**\n\n```\n赋能 \u003cidentifier\u003e = \u003cexpression\u003e;\n```\n\n**Example:**\n\n```\n赋能 x = 0;\n赋能 y = 10;\n赋能 福报 = add(5, 5);\n赋能 alias = 福报;\n赋能 identity = 抓手(x) { x };\n```\n\n### Literals\n\nFive types of literals are implemented.\n\n#### Integer\n\n`Integer` represents an integer value. Floating point numbers can not be handled.\n\n**Format:**\n\n```\n[-+]?[1-9][0-9]*;\n```\n\n**Example:**\n\n```\n10;\n1234;\n```\n\n#### Boolean\n\n`Boolean` represents a general boolean type.\n\n**Format:**\n\n```\n三七五 | 三二五;\n```\n\n**Example:**\n\n```\n三七五;\n三二五;\n\n赋能 truthy = !三二五;\n赋能 falsy = !三七五;\n```\n\n#### String\n\n`String` represents a string. Only double quotes can be used.\n\n**Format:**\n\n```\n\"\u003cvalue\u003e\";\n```\n\n**Example:**\n\n```\n\"Monkey Programming Language\";\n\"Hello\" + \" \" + \"World\";\n```\n\n#### 组合拳\n\n`组合拳` represents an ordered contiguous element. Each element can contain different data types.\n\n**Format:**\n\n```\n[\u003cexpression\u003e, \u003cexpression\u003e, ...];\n```\n\n**Example:**\n\n```\n[1, 2, 3 + 3, fn(x) { x }, add(2, 2), 三七五];\n```\n\n```\n赋能 组合拳 = [1, 三七五, 抓手(x) { x }];\n\n组合拳[0];\n组合拳[1];\n组合拳[2](10);\n组合拳[1 + 1](10);\n```\n\n#### 载体\n\n`载体` expresses data associating keys with values.\n\n**Format:**\n\n```\n{ \u003cexpression\u003e: \u003cexpression\u003e, \u003cexpression\u003e: \u003cexpression\u003e, ... };\n```\n\n**Example:**\n\n```\n赋能 载体 = {\n  \"name\": \"Jimmy\",\n  \"age\": 72,\n  三七五: \"a boolean\",\n  99: \"an integer\"\n};\n\n载体[\"name\"];\n载体.name;\n载体[\"a\" + \"ge\"];\n载体[三七五];\n载体[99];\n载体[100 - 1];\n```\n\n#### 抓手\n\n`抓手` supports functions like those supported by other programming languages.\n\n**Format:**\n\n```\n抓手 (\u003cparameter one\u003e, \u003cparameter two\u003e, ...) { \u003cblock statement\u003e };\n```\n\n**Example:**\n\n```\n赋能 add = 抓手(x, y) {\n  反哺 x 联动 y;\n};\n\nadd(10, 20);\n```\n\n```\n赋能 add = 抓手(x, y) {\n  x 联动 y;\n};\n\nadd(10, 20);\n```\n\nIf `反哺` does not exist, it returns the result of the last evaluated expression.\n\n```\n赋能 addThree = 抓手(x) { x + 3 };\n赋能 callTwoTimes = 抓手(x, f) { f(f(x)) };\n\ncallTwoTimes(3, addThree);\n```\n\nPassing around functions, higher-order functions and closures will also work.\n\n### Built-in Functions\n\nYou can use 1 built-in function :rocket:\n\n#### `输出(\u003carg1\u003e, \u003carg2\u003e, ...): void`\n\nIt outputs the specified value to `stdout`. In the case of Playground, it outputs to `console`.\n\n```\n输出(\"年年有抓手\");\n输出(\"岁岁有闭环!\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaneur2020%2Fpua-lang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflaneur2020%2Fpua-lang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaneur2020%2Fpua-lang/lists"}