Repository: wenyan-lang/wenyan Branch: master Commit: 97f0a4b8c5a8 Files: 151 Total size: 1.2 MB Directory structure: gitextract_52x0jwqd/ ├── .eslintrc.js ├── .gitattributes ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ └── issue.md │ └── workflows/ │ ├── cdn.yml │ ├── publish.yml │ └── test.yml ├── .gitignore ├── .npmrc ├── CHANGELOG.md ├── CNAME ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── README.md ├── README.zh-Hans.md ├── README.zh-Hant.md ├── documentation/ │ ├── Compiler-API.md │ ├── Importing.md │ ├── Macros.md │ ├── Nested-Function-Calls.md │ ├── PREFACE.md │ ├── Runtime.md │ ├── Standard-Lib.md │ ├── TODO.md │ ├── Testing.md │ ├── Try-Catch.md │ └── wenyan.g4 ├── examples/ │ ├── README.md │ ├── beer.wy │ ├── breadth_first_search.wy │ ├── clock.wy │ ├── collatz.wy │ ├── collatz2.wy │ ├── crt.wy │ ├── divination.wy │ ├── draw_heart.wy │ ├── eightqueens.wy │ ├── euclidean.wy │ ├── factorial.wy │ ├── fibonacci.wy │ ├── fibonacci2.wy │ ├── fibonacci_array.wy │ ├── fizzbuzz.wy │ ├── hanoi.wy │ ├── hanoi_stack.wy │ ├── helloworld+.wy │ ├── helloworld.wy │ ├── import.wy │ ├── linglong_tower.wy │ ├── macro.wy │ ├── mandelbrot.wy │ ├── mergesort.wy │ ├── misc.wy │ ├── modinv.wy │ ├── multiplication_table.wy │ ├── nested_fun.wy │ ├── obj.wy │ ├── pascal_triangle.wy │ ├── pi_leibniz.wy │ ├── pi_liuhui.wy │ ├── quicksort.wy │ ├── quicksort_inplace.wy │ ├── quine.wy │ ├── quine2.wy │ ├── selectionsort.wy │ ├── serialization.wy │ ├── sieve.wy │ ├── sqrt_newton.wy │ ├── tree.wy │ ├── tree2.wy │ ├── try.wy │ ├── turing.wy │ └── zh_sqrt.wy ├── jest.config.js ├── lib/ │ ├── js/ │ │ ├── 位經.wy │ │ ├── 天地經.wy │ │ ├── 格物.wy │ │ ├── 畫譜.wy │ │ └── 西曆法.wy │ ├── py/ │ │ ├── 位經.wy │ │ ├── 天地經.wy │ │ └── 西曆法.wy │ ├── rb/ │ │ └── 天地經.wy │ ├── 列經.wy │ ├── 易經.wy │ ├── 曆法.wy │ ├── 曆表.wy │ ├── 渾沌經.wy │ ├── 算經.wy │ └── 籌經.wy ├── netlify.toml ├── package.json ├── site/ │ ├── CNAME │ ├── ide.html │ └── index.html ├── src/ │ ├── browser_runtime.ts │ ├── cli.ts │ ├── converts/ │ │ ├── hanzi2num.ts │ │ ├── hanzi2pinyin.ts │ │ ├── hanzi2roman-map-baxter.json │ │ └── hanzi2roman-map-pinyin.json │ ├── execute.ts │ ├── highlight.js │ ├── keywords.ts │ ├── macro.ts │ ├── parser.ts │ ├── reader.ts │ ├── render.ts │ ├── stdlib.ts │ ├── transpilers/ │ │ ├── base.ts │ │ ├── index.ts │ │ ├── js.ts │ │ ├── py.ts │ │ └── rb.ts │ ├── typecheck.ts │ ├── types.ts │ ├── utils.ts │ └── version.ts ├── static/ │ ├── __migrate__.html │ ├── _redirects │ ├── assets/ │ │ ├── css/ │ │ │ └── site.css │ │ └── js/ │ │ └── site.js │ ├── index.html │ └── spec.html ├── test/ │ ├── __snapshots__/ │ │ └── examples.test.ts.snap │ ├── examples.test.ts │ ├── fixture/ │ │ └── nested-import/ │ │ └── 四庫全書/ │ │ ├── 序.wy │ │ └── 本草綱目/ │ │ ├── 序.wy │ │ └── 草部.wy │ ├── import.test.ts │ ├── numbers.test.ts │ ├── reader.test.ts │ ├── setup.js │ ├── stdlib.calendar.test.ts │ ├── stdlib.math.test.cases.ts │ ├── stdlib.math.test.ts │ ├── stdlib.wonton.test.ts │ └── utils.ts ├── tools/ │ ├── examples.js │ ├── make_calendar.js │ ├── make_examples_readme.js │ ├── publish.js │ ├── test_parser.ts │ ├── utils.js │ └── wiki/ │ ├── stdlib_cheatsheet.js │ └── update.js ├── tsconfig.json ├── webpack.base.config.js ├── webpack.config.js └── webpack.site.config.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .eslintrc.js ================================================ module.exports = { parser: "@typescript-eslint/parser", plugins: [ "@typescript-eslint", "jest", ], parserOptions: { sourceType: "module" }, env: { browser: true, node: true, es6: true, jest: true, }, extends: [ /* disbale rules temporary, before the codebase refactored with module system */ // "eslint:recommended", "prettier" ], plugins: [ "html" ] } ================================================ FILE: .gitattributes ================================================ site/* linguist-detectable=false site linguist-detectable=false ================================================ FILE: .github/ISSUE_TEMPLATE/issue.md ================================================ --- name: Issue about: Issue title: "" --- ================================================ FILE: .github/workflows/cdn.yml ================================================ name: Publish To CDN on: push: branches: - master jobs: publish: runs-on: ubuntu-latest strategy: matrix: node-version: [ 16 ] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} registry-url: https://registry.npmjs.org/ - run: npm ci - run: npm run build:site - uses: antfu/gha-publish-to-git@master with: branch: cdn github_token: '${{ secrets.GITHUB_TOKEN }}' github_pat: '${{ secrets.GH_PAT }}' source_folder: static/dist ================================================ FILE: .github/workflows/publish.yml ================================================ name: Publish Package on: release: types: [created] jobs: publish-npm: runs-on: ubuntu-latest strategy: matrix: node-version: [ 16 ] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} registry-url: https://registry.npmjs.org/ - run: npm ci - run: npm run build - run: npm test - run: npm run publish:ci env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} ================================================ FILE: .github/workflows/test.yml ================================================ name: Build & Test on: [push, pull_request] jobs: build: runs-on: ubuntu-latest strategy: matrix: node-version: [ 14, 16 ] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - name: Install run: npm ci env: CI: true - name: Lint run: npm run lint - name: Test run: | npm run build:dev npm test ================================================ FILE: .gitignore ================================================ .DS_Store node_modules/ build/wenyan-linux build/wenyan-macos build/wenyan-win.exe temp dist /tools/calendar.html 藏書樓 .node-xmlhttprequest-* typings tools/wiki/repo ================================================ FILE: .npmrc ================================================ scripts-prepend-node-path=true ================================================ FILE: CHANGELOG.md ================================================ # v0.3.2 ## Features - Use modern js syntax for compiled code (PR #574, thanks @tsao-chi) - Improved error handling (#566, 8bf7e0a) ## Standard Library - Top-level array for Wonton (d8dfb63) - Fixes in 列經 (PR #578, thanks @wenfeng0218) ## Examples - 玲瓏塔 (PR #578, thanks @wenfeng0218) - 漢諾塔·堆棧法 and 斐氏列·數組法 (PR #580, thanks @wenfeng0218) ## Misc - The Online IDE moved to https://ide.wy-lang.org and [a separate repo](https://github.com/wenyan-lang/ide) ## Thanks Thanks for our first financial contributor @wenfeng0218 on [Open Collective](https://opencollective.com/wenyan-lang)! # v0.3.1 ## Standard Library - WONTON - JSON-ish Object Serialization, #560 for details - Math improves (PR #555, thanks @statementreply) ## Fixes - Typescript typings (20cd77b7dac26b78033de78ae732e7bcff7338e6) ## Examples - Chinese remainder theorem. (PR #569, thanks @YuRen-tw) ## Misc - Improve responsive for the website (PR #568, thanks @MaoSHYJ) # v0.3.0 ## BREAKING CHANGE: `compile` API change As we mentioned in the [v0.2.0 release](https://github.com/wenyan-lang/wenyan/releases/tag/v0.2.0), the support of using `lang` as the first argument of `compile` is now REMOVED. Please use the new API instead. ```js // before compile('js', source, { ... }) // after compile(source, { lang: 'js', ... }) ``` ## [New Online IDE](https://wy-lang.org/ide) The fresh new Online IDE is now landed. With file explorer, rendering, a better editor, auto-complete, [wyg](https://github.com/wenyan-lang/wyg) support, dark mode and more. Please do check it out! (PR #515 #526 #535 #536 #537 #546 #551 #552)   ## We are now moved to Typescript! We have rewritten our codebase to Typescript. The typing declaration file is also shipped in [@wanyanlang/code](https://www.npmjs.com/package/@wenyan/core). Check out for #543 for more details. ### Features - Importing nested modules structure is now landed (PR #534, thanks @antfu) ### Fixes - Functions containing elseif is miscompiled (PR #523, thanks @statementreply) ### Stdlib - New 格物 library (PR #553, thanks @Fros1er) - Fix atan2(Infinity, Infinity) (PR #538 , thanks @statementreply) ### Tests - A lot of tests have been added (#527, #530, thanks @statementreply) ### Examples - Clock (#545, thanks @antfu) - Chinese-sqrt (增乘開平方術) (#550, thanks @jingkecn) # v0.2.4 ## import in, elseif, if true, if false, any Thanks to everyone who contributed their ideas, a selection of proposed new syntaxes are now added | js/c++ | wenyan | issue | |-|-|-| | `continue` | `乃止是遍` | #392 | | `else if` | `或若` | #365 | | `if (ans) {` | `若其然者` | #513 | | `if (!ans) {` | `若其不然者` | ditto | | `auto` | `元` | #486 | | `require('path/to/something')` | `吾嘗觀「「某樓」」中「「某閣」」中「「某書」」之書。` | #475 | refer to #519 for more details # v0.2.3 ## 序.wy Think `序.wy` the Wenyan version of `index.js`. For example, the reader now will search for a module `四庫全書` for a given path `/tmp/examples` - `/tmp/examples/四庫全書.wy` - `/tmp/examples/四庫全書/序.wy` The first match will be imported. Refer to #512 for more details. ## 藏書樓 Think `藏書樓` the Wenyan version of `node_modules`. `藏書樓` will be included as `importPaths` by CLI automatically. It will do an up searching for `藏書樓` from the cwd (just as node did) # v0.2.2 ## New Website Domain http://wy-lang.org! We are now using Netlify to build our website & IDE. The legacy links will redirect to http://wy-lang.org automatically. - New spec page, [check it out](https://wy-lang.org/spec) ## Features - New option `importPaths` for specifying the import searching directories, (PR #499, by @antfu) - New option `allowHttp` for allowing import scripts from the web (default to `false`). refer to #499 for more details. ## Fixes - Fix for mismatched scope begin/end in typecheck (PR #496, thanks @statementreply) - Stdlib: Fix for some 曆法 functions (PR #503, thanks @statementreply) - Stdlib: Improve asin, acos and atan (PR #511, thanks @statementreply) ## Examples - New example Pascal Triangle (PR #498, thanks @MerakDipper) # v0.2.1 ## Static Type Inference When the option is turned on, the compiler will now raise exceptions if your code does not typecheck. Also it is capable of producing type signatures for inspection, e.g. ./example/quicksort.wy produces the following: ``` [0-347] { 快排 : (('a) arr) -> (('a) arr) 己 : (num) arr [33-285] { 首 : ('a) arr 頷 : ('a) arr 尾 : ('a) arr 甲一 : 'a 甲餘 : ('a) arr 乙 : ('a) arr [136-201] { 丁 : 'a } } } ``` For more detail, please refer to #486 ### Standard Library - Fundamental Calendar library (PR #466, thanks @statementreply), check out [Standard Library cheatsheet](https://github.com/wenyan-lang/wenyan/blob/master/documentation/Standard-Lib.md) for more details. ### 3rd Party Compilers - [JVM compiler](https://github.com/MagicLu550/wenyan-lang_jvm) by [MagicLu550](https://github.com/MagicLu550) ### Fixes - Stdlib was not bundled correctly. (PR #481, thanks @antfu) # v0.2.0 ## ⚠ BREAKING CHANGE: `compile` API change The first argument lang move to option, please switch to new API. ```js //before compile('js', source, { ... }) // after compile(source, { lang: 'js', ... }) ``` The old API is still functional for temporary backward compatible, the support **will be REMOVED in the next minor update.** ## Wenyan Snippets Site, #459 Please do check it out. Any feedbacks are welcome!  ## New Execute API Check out [API Document](https://github.com/wenyan-lang/wenyan/blob/master/documentation/Compiler-API.md) and #473 ### Fixes - Fix compiler crash with 0-argument macros (PR #453, thanks @statementreply) - stdlib: Improve sin, cos and tan (^/1/3) (PR #457, thanks @statementreply) - bool2hanzi (PR #465, thanks @Fros1er) ### Docs - Auto generates examples for README.md (PR #448, thanks @cuixiping) # v0.1.3 ## Macros (Experimental) As you might (not) have noticed, *wenyan-lang* strives to be more readable (for ancient Chinese people). **Macros** provide syntactic sugars to bring the 文采 of your code to the next level. E.g. Now you can patch wenyan-lang's notorius print function like so: ``` 或云「「書「甲」焉」」。 蓋謂「「吾有一言。曰「甲」。書之」」。 書「「問天地好在」」焉。 ``` Since we're beating JavaScript to macros, here is a rough C equivalence: ``` #define 書(甲)焉 吾有一言。曰甲。書之 書("問天地好在")焉。 ``` See [**Full Documation**](https://github.com/wenyan-lang/wenyan/blob/master/documentation/Macros.md), #440 for more details. ### Standard Library A new standard library `畫譜` that manipulates canvas on web pages. Check out the demo on Online IDE! ### Browser Runtime New package [`@wenyan/runtime`](https://github.com/wenyan-lang/wenyan/blob/master/documentation/Runtime.md) allowing you to run Wenyan direct in `
Please visit http://wy-lang.org instead.