├── .github ├── actions │ ├── install-linux-dependencies │ │ └── action.yml │ ├── install-linux-dependencies@v2 │ │ └── action.yml │ └── install-mac-dependencies │ │ └── action.yml └── workflows │ └── main.yml ├── .gitignore ├── .idea ├── .gitignore ├── inspectionProfiles │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── vcs.xml └── yuyan.iml ├── .vscode ├── extensions.json ├── launch.json └── settings.json ├── LICENSE ├── Makefile ├── backup_cache_loop.sh ├── clocdef.txt ├── cmlib ├── .gitignore ├── AUTHORS ├── CHANGELOG ├── LICENSE ├── STYLE ├── aes.sml ├── arguments.sig ├── arguments.sml ├── arith.sig ├── arith.sml ├── array-inf.sig ├── array-inf.sml ├── array-util.sig ├── array-util.sml ├── asn1.sig ├── basis.cm ├── branching-table-dataless.sig ├── branching-table-dataless.sml ├── bytestring.sig ├── bytestring.sml ├── bytesubstring.sig ├── bytesubstring.sml ├── cipher.sig ├── cmlib-mlton.mlb ├── cmlib.cm ├── cmlib.mlb ├── cmlib.smackspec ├── command-line.sig ├── command-line.sml ├── cont-mlton.sml ├── cont-nj.sml ├── cont.sig ├── cont.sml ├── convert-intinf.sig ├── convert-intinf.sml ├── convert-word-mlton.sml ├── convert-word-nj.sml ├── convert-word-nj64.sml ├── convert-word.sig ├── coroutine.sig ├── coroutine.sml ├── costring.sig ├── costring.sml ├── cryptohash.sig ├── defaults.sml ├── deprecated │ ├── coord-stream.sig │ ├── coord-stream.sml │ ├── coord.sig │ ├── coord.sml │ ├── pos.sig │ └── pos.sml ├── der.sml ├── dict-list.sml ├── dict-red-black.sml ├── dict-splay.sml ├── dict.sig ├── digital-signature.sig ├── ec-coding.sig ├── ec-crypto.sig ├── ec-crypto.sml ├── ec-der.sml ├── ec-f2m.sml ├── ec-field.sig ├── ec-fp.sml ├── ec-params.sig ├── ec-params.sml ├── ec.sig ├── ecdh.sig ├── ecdh.sml ├── ecdsa.sig ├── ecdsa.sml ├── finally.sig ├── finally.sml ├── fortuna.sig ├── fortuna.sml ├── frame-dict.sig ├── frame-dict.sml ├── from-string.sig ├── from-string.sml ├── hash-inc.sig ├── hash-inc.sml ├── hash-table-dataless.sig ├── hash-table-dataless.sml ├── hash-table.sig ├── hash-table.sml ├── hashable-2.sml ├── hashable.sig ├── hashable.sml ├── ideque.sig ├── ideque.sml ├── io-mini.sig ├── io-util.sig ├── io-util.sml ├── ipqueue-pairing.sml ├── ipqueue.sig ├── iqueue.sig ├── iqueue.sml ├── juliasort.sml ├── lex-engine.sig ├── lex-engine.sml ├── list-util.sig ├── list-util.sml ├── mergesort.sml ├── monad-util.sig ├── monad-util.sml ├── monad.sig ├── monad.sml ├── multi-file-io.sig ├── multi-file-io.sml ├── multi-table-dict.sml ├── multi-table.sig ├── ordered-2.sml ├── ordered.sig ├── ordered.sml ├── output.sig ├── output.sml ├── parse-engine.sig ├── parse-engine.sml ├── parsing.sig ├── parsing.sml ├── partition.sig ├── partition.sml ├── path.sig ├── path.sml ├── pickle.sig ├── pickle.sml ├── pickleable.sig ├── pickleable.sml ├── pqueue-lazy-pairing.sml ├── pqueue-leftist.sml ├── pqueue-pairing.sml ├── pqueue.sig ├── prettyprint.sig ├── prettyprint.sml ├── pstream.sig ├── pstream.sml ├── psusp.sig ├── psusp.sml ├── queue.sig ├── queue.sml ├── quicksort.sml ├── rand-from-rand32.sml ├── rand-from-random.sml ├── rand-mt.sml ├── rand.sig ├── rand32.sig ├── random-aes.sml ├── random-rehash.sml ├── random.sig ├── red-black-tree.sml ├── regexp.sig ├── regexp.sml ├── ripemd160.sml ├── seek-io.sig ├── seek-io.sml ├── sequence-array.sml ├── sequence-list.sml ├── sequence-tree.sml ├── sequence.sig ├── set-list.sml ├── set-red-black.sml ├── set-splay.sml ├── set.sig ├── sha1.sml ├── sha256.sml ├── shared-secret.sig ├── sort.sig ├── splay-tree.sml ├── stream-cipher-fun.sml ├── stream.sig ├── stream.sml ├── streamable-2.sml ├── streamable-mono-2.sml ├── streamable-mono.sig ├── streamable-mono.sml ├── streamable.sig ├── streamable.sml ├── string-mini.sig ├── string-mini.sml ├── sum.sig ├── sum.sml ├── susp-monad.sml ├── susp-nj.sml ├── susp.sig ├── susp.sml ├── symbol.sig ├── symbol.sml ├── table-checkpoint-dict.sml ├── table-checkpoint-hash.sml ├── table-checkpoint.sig ├── table-dataless-mini.sig ├── table-dataless.sig ├── table-mini.sig ├── table.sig ├── tests │ ├── ipqueue-check.sml │ ├── ipqueue-list.sml │ ├── ipqueue-test.sml │ ├── mergesort-qcheck.sml │ ├── mergesort-test.sml │ ├── qchecktest.cm │ ├── quicksort-test.sml │ ├── sets-dicts-test.sml │ ├── test-collection.sml │ ├── test.cm │ ├── test.mlb │ ├── test.sig │ ├── testing-mlton.mlb │ ├── testing.cm │ ├── testing.mlb │ ├── testing.sig │ └── testing.sml ├── topological-sort.sig ├── topological-sort.sml ├── union-find-imperative.sig ├── union-find-imperative.sml ├── weak-mlton.sml ├── weak-nj.sml ├── weak.sig └── weak.sml ├── codegen_single_func_final.py ├── conclusion_and_forth_coming_debug_hint.txt ├── copy_or_generate_debug.py ├── docs ├── LanguagePerformance.md ├── LanguageSpecification.md ├── ModuleAndBuildSystems.md ├── README.md ├── README_eng.md ├── RuntimeSystem.md ├── WASM支持纪要.md ├── YuyanObjectNotation.md ├── _config.yml ├── autogen │ └── docs │ │ ├── 工具包 │ │ └── 数学绘图.html │ │ ├── 总库.html │ │ ├── 标准库.html │ │ ├── 标准库 │ │ ├── 具体列.html │ │ ├── 内建类型.html │ │ ├── 动态分类.html │ │ ├── 命令行参数.html │ │ ├── 多态列.html │ │ ├── 子进程.html │ │ ├── 字符串.html │ │ ├── 小数操作.html │ │ ├── 异常.html │ │ ├── 引用.html │ │ ├── 整数操作.html │ │ ├── 文件系统.html │ │ ├── 时间.html │ │ ├── 爻.html │ │ ├── 笔.html │ │ ├── 续延.html │ │ ├── 转换.html │ │ ├── 进程.html │ │ ├── 错误.html │ │ └── 随机.html │ │ └── 目录.html ├── community_qr_wecom.png ├── result1.png ├── result2.png ├── 从源代码编译.md ├── 其他信息.md ├── 快速入门指南.md ├── 快速开始.md ├── 快速编译.md ├── 教程 │ ├── 0000-教程目录.md │ ├── 0001-豫言编程语言简介.md │ ├── 0010-第一章-教程序言.md │ ├── 0020-第二章-数据与函数.md │ ├── 0030-第三章-类型.md │ ├── 0040-第四章-更深一步了解函数.md │ ├── 0050-第五章-自建数据类型.md │ ├── 0060-第六章-入门教程结语.md │ ├── 0100-语法对照表.md │ ├── combined_tutorial.pdf │ └── makepdf │ │ ├── Makefile │ │ └── template.tex ├── 类型检查.md ├── 语法介绍.md └── 语言设计规范.md ├── empty.yuyan ├── examples ├── example.yuyan ├── helloworld │ ├── helloworld.yuyan │ └── 行。豫库 ├── helloworld2.yuyan ├── hl.yuyan ├── quicksort-ffi.yuyan └── quicksort-stdlib │ ├── 速序。豫 │ └── 速序。豫库 ├── ide ├── client │ └── ide-pre.js └── server │ ├── .gitignore │ ├── online_ide.html │ ├── package-lock.json │ ├── package.json │ └── server.js ├── increment_build_number.sh ├── install.sh ├── lldb_debug.py ├── lsp.py ├── output.c ├── package-lock.json ├── package.json ├── parallel_compile.py ├── parallel_compile_v0.py ├── patches └── debug-opt.patch ├── performance-investigation ├── .gitignore ├── even-odd │ ├── even-odd.sml │ ├── even-odd.sml.exe │ └── even-odd.yuyan ├── fib │ ├── .gitignore │ ├── fib.c │ ├── fib.cmi │ ├── fib.cmo │ ├── fib.java │ ├── fib.ml │ ├── fib.py │ ├── fib.sml │ └── fib.yuyan ├── matrix-multiply │ ├── .gitignore │ ├── Makefile │ ├── MatrixMultiplication.java │ ├── matrix-multiply-debug.yuyan │ ├── matrix-multiply.c │ ├── matrix-multiply.hs │ ├── matrix-multiply.mlb │ ├── matrix-multiply.polyml.sml │ ├── matrix-multiply.py │ ├── matrix-multiply.sml │ ├── matrix-multiply.sml.exe │ ├── matrix-multiply.yuyan │ ├── result.txt │ └── time_plot.yuyan ├── quick-sort │ ├── quick-sort-double.c │ ├── quick-sort.c │ ├── quick-sort.hs │ ├── quick-sort.py │ └── quick-sort.yuyan ├── quicksort-test.yuyan ├── quicksort.py └── quicksort_test.py ├── print_profile_data.py ├── py-interpreter ├── Makefile ├── anf_convert.py ├── ast_util.py ├── c_compiler.py ├── closure_convert.py ├── interpreter.py ├── ir_deserialization.py ├── ir_serialization.py ├── params.py ├── pass_utils.py ├── recursion_rewrite.py ├── yuyan_import.py ├── yybc_ast.py ├── yybc_compiler.py └── yybc_interpreter.py ├── runtime ├── Makefile ├── common │ ├── commandline.c │ ├── common_include.h │ ├── cstdlib │ │ └── cstdtime.c │ ├── debug.c │ ├── entry.c │ ├── exception.c │ ├── file_system.c │ ├── io.c │ ├── llvm_specific.c │ ├── marshall.c │ ├── platforms │ │ └── currentPlatform.c │ ├── primop.c │ ├── process_exit.c │ ├── rand.c │ ├── references.c │ ├── strings.c │ └── time.c ├── emwasm │ ├── emwasm_allocation.c │ ├── emwasm_include.h │ └── entry_init.c ├── extra │ ├── extra_include.h │ └── matplot │ │ ├── matplot.cpp │ │ └── matplot_yy.c ├── mlton │ ├── yydependency.sml │ ├── yylibrary │ ├── yylibrary.cm │ ├── yylibrary.mlb │ └── yylibrary.sml ├── native │ ├── entry_init.c │ ├── fast_gc.c │ ├── fast_gc.h │ ├── libuv │ │ ├── child_processes.c │ │ ├── filesystem.c │ │ ├── getcwd.c │ │ └── uvhelper.c │ ├── native_allocation.c │ └── native_include.h ├── nodejs │ ├── yylibrary.js │ └── yylibrary.v2.js ├── wasi │ ├── wasi_all.wat │ └── wasi_include.h └── wasm │ ├── wasm_allocation.c │ ├── wasm_child_processes.c │ ├── wasm_entry_init.c │ └── wasm_include.h ├── sml.json ├── smlutil ├── gen-record-getter-setter.py ├── log_analyze.py └── log_analyze_local.py ├── src ├── build-system │ ├── compilation-file-ops.sml │ ├── compilation-file-processing.sml │ ├── compilation-manager.sml │ ├── compilation-module.sml │ ├── compilation-structure.sml │ ├── compilation-tokens.sml │ ├── diagnostics │ │ ├── print-diagnostics.sml │ │ └── static-error-structure.sml │ ├── docs-generation.sml │ ├── documents-build │ │ ├── rich-text-document-ops.sml │ │ └── rich-text-document.sml │ └── file-dependency-resolution.sml ├── development.cm ├── development.mlb ├── lsp │ ├── language-server-mode.sml │ ├── language-server.sml │ ├── lsp-diagnostics.sml │ └── syntax-highlight.sml ├── mlton-exec.sml ├── operators │ └── structure │ │ ├── op-ast-ops.sml │ │ ├── op-ast.sml │ │ ├── operator-registry.sml │ │ ├── operators-ops.sml │ │ ├── operators.sml │ │ └── special-chars.sml ├── parser │ ├── bracket-scanner.sml │ ├── declaration-parser.sml │ ├── elaborate-precedence.sml │ ├── mixfix-parser.sml │ ├── parse-ast-ops.sml │ ├── parse-ast.sml │ ├── parser-options.sig │ └── precedence-parser.sml ├── passes │ ├── codegen │ │ ├── llvm-ast.sml │ │ ├── llvm-codegen.sml │ │ └── llvm-convert.sml │ ├── cps-transform │ │ ├── closure-convert.sml │ │ ├── cps-ast-ops.sml │ │ ├── cps-ast.sml │ │ ├── cps-builtin.sml │ │ ├── cps-helper.sml │ │ └── cps-pass.sml │ ├── preprocess │ │ ├── expression-construction-pass.sml │ │ ├── preprocessing-ast.sml │ │ ├── preprocessing-operators.sml │ │ ├── preprocessing-pass.sml │ │ └── structure-name.sml │ └── typechecking │ │ ├── builtin-functions.sml │ │ ├── identifier-name-resolution.sml │ │ ├── type-checking-ast-ops.sml │ │ ├── type-checking-ast.sml │ │ ├── type-checking-context.sml │ │ ├── type-checking-entry.sml │ │ ├── type-checking-errors.sml │ │ ├── type-checking-pass.sml │ │ ├── type-checking-patterns.sml │ │ ├── type-checking-unify.sml │ │ └── type-checking-util.sml ├── ui │ ├── argument-parser.sml │ ├── command-line-arguments-text.sml │ ├── pretty-print.sml │ ├── repl-debug.sml │ ├── repl-help-text.sml │ ├── repl-options.sml │ ├── repl.sml │ └── type-check-and-eval.sml └── util │ ├── debug-print.sml │ ├── file-resource-uri.sml │ ├── io-util.sml │ ├── list-search-util.sml │ ├── math-util.sml │ ├── mixed-str.sml │ ├── number-parser.sml │ ├── ordered.sml │ ├── path-util.sml │ ├── source-location.sml │ ├── source-range.sml │ ├── string-dict.sml │ ├── unique-id.sml │ ├── uri-util.sml │ ├── utf8char.sml │ ├── utf8string.sml │ ├── yyon-util.sml │ └── yyon.sml ├── tests ├── .vscode │ └── settings.json ├── airthmetic │ └── sub-1.yuyan ├── bugs │ ├── errsourcerange │ │ ├── hello-world-5.yuyan │ │ └── 具体列。豫 │ ├── example-4.yuyan │ ├── hl │ │ └── hl-in-comment.yuyan │ ├── note.txt │ ├── pattern-match-nontermination.yuyan │ └── 多态列重复名称。豫 ├── comments │ ├── nested-1.yuyan │ └── nested.success ├── contification │ └── cont-1.yuyan ├── data │ ├── constructor-1.yuyan │ ├── constructor-2.yuyan │ ├── constructor-3.yuyan │ ├── constructor-4.yuyan │ └── constructor-5.yuyan ├── dependent │ └── dependent-1.yuyan ├── example │ ├── callcc │ │ ├── callcc-three-1.yuyan │ │ ├── callcc-three-2.yuyan │ │ └── callcc-three.success │ ├── example-1.yuyan │ ├── example-10.yuyan │ ├── example-2.yuyan │ ├── example-3.yuyan │ ├── example-4.yuyan │ ├── example-5.yuyan │ ├── example-6.yuyan │ ├── example-7.yuyan │ ├── example-8.yuyan │ ├── example-9.yuyan │ ├── example.success │ ├── exception │ │ ├── three-1.yuyan │ │ ├── three.success │ │ ├── uncaught-1.yuyan │ │ └── uncaught.failure │ ├── module │ │ ├── module-1.yuyan │ │ ├── module-2.yuyan │ │ ├── module-3.yuyan │ │ └── module.success │ ├── ref │ │ ├── three-1.yuyan │ │ ├── three-2.yuyan │ │ ├── three-3.yuyan │ │ └── three.success │ └── stackoverflow │ │ └── overflow-1.yuyan ├── next_gen_debug │ ├── double │ │ ├── double-1.yuyan │ │ └── double.success │ ├── experimental │ │ └── avoidance-1.yuyan │ ├── func-ref │ │ └── func-ref-1.yuyan │ ├── import │ │ ├── import-1.yuyan │ │ └── import-base.yuyan │ ├── list │ │ └── list-1.yuyan │ ├── natural │ │ └── 自然语言列库。豫 │ ├── number │ │ └── number-1.yuyan │ ├── parse │ │ ├── parse-1.yuyan │ │ ├── parse-2.yuyan │ │ ├── parse-3.yuyan │ │ ├── parse-4.yuyan │ │ ├── parse-5.yuyan │ │ ├── parse-6.yuyan │ │ └── parse-7.yuyan │ ├── pattern │ │ ├── pattern-1.yuyan │ │ ├── pattern-10.yuyan │ │ ├── pattern-11.yuyan │ │ ├── pattern-12.yuyan │ │ ├── pattern-13.yuyan │ │ ├── pattern-14.yuyan │ │ ├── pattern-15.yuyan │ │ ├── pattern-16.yuyan │ │ ├── pattern-17.yuyan │ │ ├── pattern-18 copy.yuyan │ │ ├── pattern-18.yuyan │ │ ├── pattern-2.yuyan │ │ ├── pattern-3.yuyan │ │ ├── pattern-4.yuyan │ │ ├── pattern-5.yuyan │ │ ├── pattern-6.yuyan │ │ ├── pattern-7.yuyan │ │ ├── pattern-8.yuyan │ │ └── pattern-9.yuyan │ ├── pwd │ │ ├── pwd-1.yuyan │ │ └── pwd.success │ ├── recursion │ │ ├── rec-1.yuyan │ │ ├── rec-2.yuyan │ │ ├── rec-3.yuyan │ │ ├── rec-4.yuyan │ │ └── rec-5.yuyan │ ├── shell │ │ └── shell-1.yuyan │ ├── sig-conv │ │ └── type-as-value.yuyan │ ├── simple │ │ └── simple-1.yuyan │ ├── structure │ │ ├── struct-1.yuyan │ │ ├── struct-2.yuyan │ │ ├── struct-3.yuyan │ │ ├── struct-4.yuyan │ │ └── struct-5.yuyan │ ├── tuple │ │ ├── tuple-1.yuyan │ │ ├── tuple-paren-1.yuyan │ │ ├── tuple-paren.failure │ │ └── tuple.success │ ├── write-file │ │ ├── write-1.yuyan │ │ └── write-2.yuyan │ ├── 去科里化 │ │ └── opt-1.yuyan │ └── 重复定义 │ │ ├── 重复定义-1。豫 │ │ └── 重复定义-2。豫 ├── optimizer │ ├── opt-1.yuyan │ ├── opt-2.yuyan │ ├── opt-3.yuyan │ ├── opt-4.yuyan │ ├── opt-5.yuyan │ ├── opt-6.yuyan │ ├── opt-7.yuyan │ └── opt-rec-1.yuyan ├── prim │ ├── fib-1.yuyan │ └── fib-2.yuyan ├── stdlib │ ├── builtin │ │ ├── builtin-1.yuyan │ │ ├── builtin-2.yuyan │ │ ├── builtin.success │ │ ├── prod-one-1.yuyan │ │ ├── prod-one.success │ │ ├── prod-three-1.yuyan │ │ ├── prod-three.success │ │ ├── prod-two-1.yuyan │ │ └── prod-two.failure │ ├── exception │ │ ├── error-1.yuyan │ │ ├── error-2.yuyan │ │ ├── error-3.yuyan │ │ ├── error-4.yuyan │ │ ├── error-5.yuyan │ │ ├── error-6.yuyan │ │ └── error.failure │ ├── list │ │ ├── list-test-1.yuyan │ │ ├── list-test.success │ │ ├── tabulate-1.yuyan │ │ ├── tabulate-2.yuyan │ │ ├── tabulate-3.yuyan │ │ ├── tabulate-4.yuyan │ │ ├── tabulate-5.yuyan │ │ └── tabulate.success │ └── strings │ │ ├── join-1.yuyan │ │ ├── join.success │ │ ├── pattern-1.yuyan │ │ ├── pattern-10.yuyan │ │ ├── pattern-2.yuyan │ │ ├── pattern-3.yuyan │ │ ├── pattern-4.yuyan │ │ ├── pattern-5.yuyan │ │ ├── pattern-6.yuyan │ │ ├── pattern-7.yuyan │ │ ├── pattern-8.yuyan │ │ ├── pattern-9.yuyan │ │ ├── pattern.success │ │ ├── split-1.yuyan │ │ └── split.success ├── syntax │ ├── arithemetic │ │ ├── three-1.yuyan │ │ ├── three-2.yuyan │ │ ├── three-3.yuyan │ │ └── three.success │ ├── empty-1.yuyan │ ├── empty-10.yuyan │ ├── empty-2.yuyan │ ├── empty-3.yuyan │ ├── empty-4.yuyan │ ├── empty-5.yuyan │ ├── empty-6.yuyan │ ├── empty-7.yuyan │ ├── empty-8.yuyan │ ├── empty-9.yuyan │ ├── empty.success │ ├── expression-construction │ │ ├── decl-ambiguous-parse-1.yuyan │ │ ├── decl-ambiguous-parse.failure │ │ ├── decl-empty-name-1.yuyan │ │ ├── decl-empty-name.failure │ │ ├── decl-no-parse-1.yuyan │ │ ├── decl-no-parse.failure │ │ ├── ecp-import-1.yuyan │ │ ├── ecp-import-nonexistent-1.yuyan │ │ ├── ecp-import-nonexistent.failure │ │ ├── ecp-import.failure │ │ ├── ecp-no-parse-1.yuyan │ │ ├── ecp-no-parse-2.yuyan │ │ ├── ecp-no-parse-3.yuyan │ │ ├── ecp-no-parse.failure │ │ ├── parse-failure-1.yuyan │ │ └── parse-failure.failure │ ├── import │ │ ├── case-1.yuyan │ │ ├── case.success │ │ ├── hello-world-1.yuyan │ │ ├── hello-world-10.yuyan │ │ ├── hello-world-11.yuyan │ │ ├── hello-world-12.yuyan │ │ ├── hello-world-2.yuyan │ │ ├── hello-world-3.yuyan │ │ ├── hello-world-4.yuyan │ │ ├── hello-world-5.yuyan │ │ ├── hello-world-6.yuyan │ │ ├── hello-world-7.yuyan │ │ ├── hello-world-8.yuyan │ │ ├── hello-world-9.yuyan │ │ ├── hello-world-f-1.yuyan │ │ ├── hello-world-f-2.yuyan │ │ ├── hello-world-f.failure │ │ ├── hello-world.success │ │ ├── import-failure-1.yuyan │ │ ├── import-failure.failure │ │ ├── import-success-1.yuyan │ │ ├── import-success.success │ │ └── sanity │ │ │ ├── b.yuyan │ │ │ └── c.yuyan │ ├── literal-1.yuyan │ ├── literal.success │ ├── num-1.yuyan │ ├── num.failure │ ├── quotes │ │ ├── empty-quote-1.yuyan │ │ ├── empty-quote-2.yuyan │ │ ├── empty-quote-3.yuyan │ │ ├── empty-quote-4.yuyan │ │ ├── empty-quote.failure │ │ ├── unclosed-literal-1.yuyan │ │ ├── unclosed-literal.failure │ │ ├── unclosed-quote-1.yuyan │ │ ├── unclosed-quote-2.yuyan │ │ ├── unclosed-quote-3.yuyan │ │ ├── unclosed-quote-4.yuyan │ │ ├── unclosed-quote-5.yuyan │ │ ├── unclosed-quote-6.yuyan │ │ ├── unclosed-quote-7.yuyan │ │ ├── unclosed-quote-8.yuyan │ │ └── unclosed-quote.failure │ └── typecheck │ │ ├── import-cyclic-1.yuyan │ │ ├── import-cyclic-2.yuyan │ │ ├── import-cyclic-3.yuyan │ │ ├── import-cyclic-4.yuyan │ │ ├── import-cyclic-5.yuyan │ │ ├── import-cyclic-6.yuyan │ │ ├── import-cyclic.failure │ │ ├── import-self-1.yuyan │ │ ├── import-self.failure │ │ ├── import-tc-1.yuyan │ │ ├── import-tc.failure │ │ ├── tc-1.yuyan │ │ ├── tc-2.yuyan │ │ ├── tc-3.yuyan │ │ ├── tc-4.yuyan │ │ ├── tc-5.yuyan │ │ ├── tc-editable.yuyan │ │ └── tc.failure └── tutorial │ └── tutorial-1.yuyan ├── unescape.py ├── unused_import_linting.py ├── wasm_inspect.html ├── yybcvm ├── .gitignore ├── Makefile ├── native │ ├── commandline.c │ ├── common_include.h │ ├── cstdlib │ │ └── cstdtime.c │ ├── debug.c │ ├── debug_print.c │ ├── debug_print.h │ ├── entry.c │ ├── entry_init.c │ ├── exception.c │ ├── file_system.c │ ├── garbage_collector.c │ ├── garbage_collector.h │ ├── io.c │ ├── libuv │ │ ├── child_processes.c │ │ └── uvhelper.c │ ├── marshall.c │ ├── marshall.h │ ├── memory_verifier.c │ ├── memory_verifier.h │ ├── native_allocation.c │ ├── platforms │ │ └── currentPlatform.c │ ├── primop.c │ ├── process_exit.c │ ├── profiler.c │ ├── rand.c │ ├── references.c │ ├── runtime_stack.c │ ├── strings.c │ ├── time.c │ ├── type_defs.h │ └── yystdlib_include.h ├── pygen │ └── .gitignore └── vm │ └── yybc_vm.c ├── yylib ├── .vscode │ └── settings.json ├── design.yuyan ├── runtest-ideal.yuyan ├── runtest.yuyan ├── 工具包 │ └── 数学绘图。豫 ├── 总库。豫 ├── 拓展库 │ ├── 单元测试 │ │ ├── 总集。豫 │ │ ├── 汇报结果。豫 │ │ └── 测试组件。豫 │ ├── 文本解析组合子 │ │ ├── 基础组合子。豫 │ │ ├── 复杂组合子。豫 │ │ ├── 总集。豫 │ │ ├── 组合子数据结构。豫 │ │ └── 组合组合子。豫 │ ├── 癸象工具 │ │ ├── 总集。豫 │ │ ├── 癸象数据结构。测试。豫 │ │ ├── 癸象数据结构。豫 │ │ ├── 癸象移位规约解析。豫 │ │ ├── 癸象解析。豫 │ │ ├── 癸象递归下降解析。豫 │ │ └── 解析命令行。豫 │ └── 顺序标识符 │ │ └── 顺序标识符。豫 ├── 标准库 │ ├── 控制 │ │ ├── 惰性求值。豫 │ │ └── 组合子。豫 │ ├── 控制。豫 │ ├── 操作系统 │ │ ├── 命令行参数。豫 │ │ ├── 子进程。豫 │ │ ├── 文件系统。豫 │ │ ├── 时间。豫 │ │ ├── 系统名称。豫 │ │ ├── 路径。豫 │ │ └── 进程。豫 │ ├── 操作系统。豫 │ ├── 数学运算 │ │ ├── 具体列。豫 │ │ ├── 大小。豫 │ │ ├── 数组转换。豫 │ │ ├── 转换。豫 │ │ └── 随机。豫 │ ├── 数学运算。豫 │ ├── 数据结构 │ │ ├── 函数操作。豫 │ │ ├── 列表搜索。豫 │ │ ├── 可选值。测试。豫 │ │ ├── 可选值。豫 │ │ ├── 多态列。测试。豫 │ │ ├── 多态列。豫 │ │ ├── 多态列工具。子集。测试。豫 │ │ ├── 多态列工具。豫 │ │ ├── 字典术。豫 │ │ ├── 字符串术。测试。豫 │ │ ├── 字符串术。豫 │ │ ├── 字符流术。豫 │ │ ├── 对子术。豫 │ │ ├── 小数操作。豫 │ │ ├── 整数操作。豫 │ │ ├── 爻术。豫 │ │ └── 特殊字符。豫 │ ├── 数据结构。豫 │ ├── 语言核心 │ │ ├── 不安全。豫 │ │ ├── 内建类型。豫 │ │ ├── 动态分类。豫 │ │ ├── 异常。豫 │ │ ├── 引用。豫 │ │ └── 续延。豫 │ ├── 语言核心。豫 │ ├── 输入输出 │ │ └── 笔。豫 │ └── 输入输出。豫 ├── 标准库。豫 └── 豫言标准内核。豫 ├── 单元测试 ├── 优化 │ └── 检查函数逃逸测试。豫 └── 词法解析 │ └── 检查词法解析。豫 ├── 测试文件.txt ├── 豫言编译器 ├── 入口。豫 ├── 文档 │ ├── 编译流程.md │ ├── equlity_checking_notes.md │ ├── 希腊字母音译表.png │ ├── 翻译列表.txt │ ├── 英文字母翻译.md │ └── 递归处理.jpg ├── 编译数据 │ ├── 抽象绑定树结构 │ │ ├── 命名环境术。豫 │ │ ├── 抽象语法树 │ │ │ ├── 内建常量数据。豫 │ │ │ ├── 内建常量表示方法。豫 │ │ │ ├── 副作用检查。豫 │ │ │ ├── 复杂度计算。豫 │ │ │ ├── 序列化 │ │ │ │ ├── 序列化总集。豫 │ │ │ │ ├── 抽象语法树反序列化工具。豫 │ │ │ │ ├── 抽象语法树反序列化节点名称。豫 │ │ │ │ └── 抽象语法树序列化工具。豫 │ │ │ ├── 总集。豫 │ │ │ ├── 抽象语法友好表示方法。豫 │ │ │ ├── 抽象语法树基础操作。豫 │ │ │ ├── 抽象语法树数据。豫 │ │ │ ├── 抽象语法树方法。豫 │ │ │ ├── 抽象语法树相等方法。豫 │ │ │ ├── 抽象语法树表示。豫 │ │ │ ├── 操作符结合性数据。豫 │ │ │ └── 结构名称操作数据。豫 │ │ ├── 模块操作。豫 │ │ ├── 符列环境术。豫 │ │ ├── 粗语法树。豫 │ │ └── 静态单例类型处理。豫 │ ├── 操作符 │ │ ├── 内建操作符 │ │ │ ├── 内建操作符对象定义。豫 │ │ │ ├── 内建操作符工具。豫 │ │ │ ├── 内建操作符类型定义。豫 │ │ │ ├── 总集。豫 │ │ │ ├── 文言符集。豫 │ │ │ └── 现代汉语符集。豫 │ │ ├── 操作符操作。豫 │ │ ├── 操作符数据结构。豫 │ │ └── 操作符集术。豫 │ ├── 文件管理 │ │ └── 编译文件信息。豫 │ └── 编译配置 │ │ ├── 全局配置。豫 │ │ ├── 编译期属性读取。豫 │ │ └── 编译期输出。豫 ├── 编译步骤 │ ├── 代码生成 │ │ ├── 主程序生成入口。豫 │ │ ├── 代码生成入口。豫 │ │ └── 低级虚拟机 │ │ │ ├── 主程序生成。豫 │ │ │ ├── 代码生成。豫 │ │ │ ├── 代码生成工具。豫 │ │ │ ├── 数值运算代码生成。豫 │ │ │ ├── 目标信息。豫 │ │ │ └── 直接代码生成。豫 │ ├── 代码生成准备变换 │ │ ├── 代码生成准备变换。豫 │ │ └── 顶层。豫 │ ├── 优化 │ │ ├── 优化统计信息。豫 │ │ ├── 函数参数优化。豫 │ │ ├── 前优化入口。豫 │ │ ├── 前函数续延化变换。豫 │ │ ├── 前结构变量闭包优化。豫 │ │ ├── 基础工具 │ │ │ ├── 定义查找。豫 │ │ │ └── 表达式带定义操作。豫 │ │ ├── 尾调用优化。豫 │ │ ├── 栈分配优化。豫 │ │ ├── 树组优化框架。豫 │ │ ├── 结构组件优化。豫 │ │ ├── 结构顶层绑定优化。豫 │ │ └── 跨文件优化 │ │ │ ├── 去柯里化。豫 │ │ │ ├── 常量内联。豫 │ │ │ └── 跨文件优化入口。豫 │ ├── 总体过程 │ │ ├── 分布编译步骤。豫 │ │ ├── 单一编译工作。豫 │ │ ├── 程序整合。豫 │ │ ├── 编译文件缓存工具。豫 │ │ ├── 编译过程。豫 │ │ └── 编译过程工具。豫 │ ├── 求值正则变换 │ │ ├── 无类型正则变换。豫 │ │ ├── 正则形式统一变换。豫 │ │ ├── 正则无副作用消除。豫 │ │ ├── 续延传递变换。豫 │ │ └── 顶层。豫 │ ├── 类型标注擦除 │ │ ├── 对子转换。豫 │ │ ├── 当前续延调用转换。豫 │ │ ├── 模式匹配展开。豫 │ │ ├── 模式匹配消除。豫 │ │ ├── 模式匹配转换处理。豫 │ │ ├── 类型擦除。豫 │ │ ├── 结构类型擦除。豫 │ │ ├── 结构组件函数化。豫 │ │ └── 转换擦除顶层。豫 │ ├── 类型检查 │ │ ├── 元变量管理。豫 │ │ ├── 去糖化。豫 │ │ ├── 对象类型检查。豫 │ │ ├── 整数小数解析。豫 │ │ ├── 文件结构检查。豫 │ │ ├── 模块转换。豫 │ │ ├── 模式匹配类型检查。豫 │ │ ├── 模式合一。豫 │ │ ├── 模式合一剪枝。豫 │ │ ├── 模式合一工具。豫 │ │ ├── 模式合一结构比较。豫 │ │ ├── 派函数操作。豫 │ │ ├── 签名类型处理。豫 │ │ ├── 类型子类型检查工具。豫 │ │ ├── 类型检查工具。豫 │ │ ├── 类型类型检查。豫 │ │ ├── 结构投影类型检查。豫 │ │ └── 顶部归一化。豫 │ ├── 语法分析 │ │ ├── 具体语法树。豫 │ │ ├── 函数合集。豫 │ │ ├── 导入解析。豫 │ │ ├── 导入预测。豫 │ │ ├── 抽象语法分析。豫 │ │ ├── 抽象语法分析工具。豫 │ │ ├── 符记。豫 │ │ ├── 粗语法分析。豫 │ │ ├── 粗语法分析数据结构。豫 │ │ ├── 粗语法分析语句。豫 │ │ ├── 粗语法分析语句拆分二。豫 │ │ ├── 表达式解析。豫 │ │ ├── 表达式解析输入分析。豫 │ │ └── 词法解析。豫 │ ├── 近似类型检查 │ │ └── 近似类型检查。豫 │ └── 闭包转换 │ │ ├── 全局结构变量储存变换。豫 │ │ ├── 函数提升。豫 │ │ ├── 正则前闭包转换。豫 │ │ └── 闭包转换顶层。豫 └── 编译辅助工具 │ ├── 命令行 │ ├── compare.hs │ ├── 可打印文档。豫 │ ├── 命令行参数处理。豫 │ └── 版本管理。豫 │ └── 调试工具 │ └── 调试入口。豫 └── 运行时支持库 ├── Makefile └── native ├── commandline.c ├── common_include.h ├── cstdlib └── cstdtime.c ├── debug.c ├── debug_print.c ├── debug_print.h ├── entry.c ├── entry_init.c ├── exception.c ├── file_system.c ├── garbage_collector.c ├── garbage_collector.h ├── io.c ├── libuv ├── child_processes.c └── uvhelper.c ├── marshall.c ├── marshall.h ├── memory_verifier.c ├── memory_verifier.h ├── native_allocation.c ├── platforms └── currentPlatform.c ├── primop.c ├── process_exit.c ├── profiler.c ├── rand.c ├── references.c ├── runtime_stack.c ├── strings.c ├── time.c └── type_defs.h /.github/actions/install-linux-dependencies/action.yml: -------------------------------------------------------------------------------- 1 | # .github/actions/install-mac-dependencies/action.yml 2 | 3 | name: 'Install Linux Software' 4 | description: 'Installs Linux Yuyan Dependencies' 5 | runs: 6 | using: 'composite' 7 | steps: 8 | - name: Install MLTon 9 | run: | 10 | wget https://phoenixnap.dl.sourceforge.net/project/mlton/mlton/20210117/mlton-20210117-1.amd64-linux-glibc2.31.tgz 11 | tar -xvzf mlton-20210117-1.amd64-linux-glibc2.31.tgz 12 | cd mlton-20210117-1.amd64-linux-glibc2.31/ 13 | sudo make 14 | sudo make install 15 | shell: bash 16 | - name: Install the libraries 17 | run: | 18 | sudo apt install make llvm clang libgmp-dev 19 | sudo apt install libgc-dev libuv1-dev llvm libbsd-dev 20 | shell: bash -------------------------------------------------------------------------------- /.github/actions/install-linux-dependencies@v2/action.yml: -------------------------------------------------------------------------------- 1 | # .github/actions/install-mac-dependencies/action.yml 2 | 3 | name: 'Install Linux Software' 4 | description: 'Installs Linux Yuyan Dependencies' 5 | runs: 6 | using: 'composite' 7 | steps: 8 | - name: Install the libraries 9 | run: | 10 | sudo apt install make llvm clang libgmp-dev 11 | sudo apt install libgc-dev libuv1-dev llvm libbsd-dev 12 | shell: bash 13 | - name: Download yy_bs from 14 | run: | 15 | curl -o yy_bs -L https://github.com/yuyan-lang/yuyan/releases/download/v0.1.0rc1.4/yy_bs_bs 16 | curl -o ./运行时支持库/libyyrtoptv0.1.0rc2+0016.so -L https://github.com/yuyan-lang/yuyan/releases/download/v0.1.0rc1.4/libyyrtoptv0.1.0rc2+0016.so 17 | curl -o ./运行时支持库/libyyrtdebugv0.1.0rc2+0016.so -L https://github.com/yuyan-lang/yuyan/releases/download/v0.1.0rc1.4/libyyrtdebugv0.1.0rc2+0016.so 18 | chmod u+x yy_bs 19 | shell: bash -------------------------------------------------------------------------------- /.github/actions/install-mac-dependencies/action.yml: -------------------------------------------------------------------------------- 1 | # .github/actions/install-mac-dependencies/action.yml 2 | 3 | name: 'Install Mac Dependencies' 4 | description: 'Installs the Mac Dependency for Yuyan' 5 | runs: 6 | using: 'composite' 7 | steps: 8 | - name: brew install 9 | run: | 10 | brew install bdw-gc libuv mlton llvm 11 | echo "PATH=/usr/local/opt/llvm/bin:$PATH" >> $GITHUB_ENV 12 | shell: bash -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/yuyan.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [] 3 | } -------------------------------------------------------------------------------- /backup_cache_loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while true 4 | do 5 | make backupcache 6 | sleep 60 7 | done -------------------------------------------------------------------------------- /clocdef.txt: -------------------------------------------------------------------------------- 1 | YY 2 | filter remove_matches ^\s*// 3 | extension 4 | extension yuyan 5 | 3rd_gen_scale 1.51 -------------------------------------------------------------------------------- /cmlib/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .cm 3 | .svn 4 | [#]*[#] 5 | .#* 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /cmlib/AUTHORS: -------------------------------------------------------------------------------- 1 | Chris Martens - 15-210 library (Sequence) contributions, imported Sequence 2 | Filip Sieczkowski - Sum 3 | Guy Blelloch - 15-210 library (Sequence) contributions 4 | Ian Ernest Voysey - 15-210 library (Sequence) contributions 5 | Kanat Tangwongsan - 15-210 library (Sequence) contributions 6 | Karl Crary - Primary developer 7 | Robert J. Simmons - Pos and Coord, testing code 8 | Rowan Davies - leftist and pairing heaps 9 | William Lovas - Merge sort, testing code 10 | -------------------------------------------------------------------------------- /cmlib/arith.sig: -------------------------------------------------------------------------------- 1 | 2 | signature ARITH = 3 | sig 4 | 5 | val sqrt : IntInf.int -> IntInf.int 6 | 7 | (* factor2 x = (d, s) where d * 2^s *) 8 | val factor2 : IntInf.int -> IntInf.int * IntInf.int 9 | 10 | (* if isprime x = false then x is composite 11 | if isprime x = true then x is prime with high probablity 12 | *) 13 | val isprime : IntInf.int -> bool 14 | 15 | (* invmod (x, q) = y where x * y = 1 (mod q) *) 16 | val invmod : IntInf.int * IntInf.int -> IntInf.int 17 | 18 | (* powmod (y, x, q) = z where y^x = z (mod q) *) 19 | val powmod : IntInf.int * IntInf.int * IntInf.int -> IntInf.int 20 | 21 | (* if p is prime 22 | then sqrtmod (x, p) = r where r * r = x (mod p) 23 | *) 24 | val sqrtmod : IntInf.int * IntInf.int -> IntInf.int 25 | exception NotSquare 26 | 27 | end 28 | -------------------------------------------------------------------------------- /cmlib/array-inf.sig: -------------------------------------------------------------------------------- 1 | 2 | signature ARRAY_INF = 3 | sig 4 | type 'a array 5 | 6 | val array : 'a -> 'a array 7 | val sub : 'a array * int -> 'a 8 | val update : 'a array * int * 'a -> unit 9 | val erase : 'a array -> unit 10 | val isEmpty : 'a array -> bool 11 | end 12 | -------------------------------------------------------------------------------- /cmlib/array-util.sig: -------------------------------------------------------------------------------- 1 | 2 | signature ARRAY_UTIL = 3 | sig 4 | 5 | val foldliLazy : (int * 'a * 'b Susp.susp -> 'b) -> 'b -> 'a array -> 'b 6 | val foldriLazy : (int * 'a * 'b Susp.susp -> 'b) -> 'b -> 'a array -> 'b 7 | val foldlLazy : ('a * 'b Susp.susp -> 'b) -> 'b -> 'a array -> 'b 8 | val foldrLazy : ('a * 'b Susp.susp -> 'b) -> 'b -> 'a array -> 'b 9 | 10 | end -------------------------------------------------------------------------------- /cmlib/basis.cm: -------------------------------------------------------------------------------- 1 | library 2 | (* Re-export everything from $/basis.cm except signatures CONT, SUSP and WEAK. *) 3 | library($/basis.cm) - signature CONT - signature SUSP - signature WEAK 4 | is 5 | $/basis.cm 6 | -------------------------------------------------------------------------------- /cmlib/cipher.sig: -------------------------------------------------------------------------------- 1 | 2 | signature CIPHER = 3 | sig 4 | 5 | type prekey 6 | type init 7 | type key 8 | 9 | val messageSize : int option 10 | 11 | val makeKey : prekey * init -> key 12 | val encrypt : key * Bytestring.string -> Bytestring.string 13 | val decrypt : key * Bytestring.string -> Bytestring.string 14 | 15 | end 16 | -------------------------------------------------------------------------------- /cmlib/cmlib-mlton.mlb: -------------------------------------------------------------------------------- 1 | $(SML_LIB)/basis/mlton.mlb 2 | cmlib.mlb 3 | 4 | (* Overwrite the generic (non-)implementations of Cont and Weak. *) 5 | cont-mlton.sml 6 | weak-mlton.sml 7 | -------------------------------------------------------------------------------- /cmlib/cmlib.smackspec: -------------------------------------------------------------------------------- 1 | description: CMlib, an SML standard library 2 | maintainer: Karl Crary 3 | maintainer: Robert J. Simmons 4 | keywords: cmlib, standard library, sets, dictionaries, maps, tables 5 | requires: qcheck v1 (v1.2.0) 6 | 7 | platform: smlnj 8 | test: sml -m tests/test.cm 9 | 10 | platform: mlton 11 | comment: QCheck must be set up for this to work. Run the following: 12 | comment: smackage make qcheck -f Makefile.mlton 13 | test: mlton tests/test.mlb 14 | test: tests/test 15 | test: rm tests/test 16 | -------------------------------------------------------------------------------- /cmlib/cont-mlton.sml: -------------------------------------------------------------------------------- 1 | 2 | structure Cont:> CONT = 3 | struct 4 | type 'a cont = 'a MLton.Cont.t 5 | val callcc = MLton.Cont.callcc 6 | fun throw k x = MLton.Cont.throw (k, x) 7 | end 8 | -------------------------------------------------------------------------------- /cmlib/cont-nj.sml: -------------------------------------------------------------------------------- 1 | 2 | structure Cont :> CONT = SMLofNJ.Cont 3 | -------------------------------------------------------------------------------- /cmlib/cont.sig: -------------------------------------------------------------------------------- 1 | 2 | signature CONT = 3 | sig 4 | 5 | type 'a cont 6 | val callcc : ('a cont -> 'a) -> 'a 7 | val throw : 'a cont -> 'a -> 'b 8 | 9 | end 10 | -------------------------------------------------------------------------------- /cmlib/cont.sml: -------------------------------------------------------------------------------- 1 | 2 | (* A bogus implementation of CONT, for platforms that don't support call/cc. *) 3 | 4 | structure Cont :> CONT = 5 | struct 6 | 7 | type 'a cont = unit 8 | 9 | fun callcc f = f () 10 | 11 | fun throw () x = 12 | raise (Fail "Continuations not implemented.") 13 | 14 | end 15 | -------------------------------------------------------------------------------- /cmlib/convert-intinf.sig: -------------------------------------------------------------------------------- 1 | 2 | signature CONVERT_INT_INF = 3 | sig 4 | 5 | val toBytesB : IntInf.int -> Bytestring.string 6 | val toBytesL : IntInf.int -> Bytestring.string 7 | val toFixedBytesB : int * IntInf.int -> Bytestring.string 8 | val toFixedBytesL : int * IntInf.int -> Bytestring.string 9 | val fromBytesB : Bytestring.string -> IntInf.int 10 | val fromBytesL : Bytestring.string -> IntInf.int 11 | val fromSignedBytesB : bool * Bytestring.string -> IntInf.int 12 | val fromSignedBytesL : bool * Bytestring.string -> IntInf.int 13 | 14 | end 15 | -------------------------------------------------------------------------------- /cmlib/coroutine.sig: -------------------------------------------------------------------------------- 1 | 2 | signature COROUTINE = 3 | sig 4 | type ('a, 'b) corout 5 | 6 | val coroutine : ('a * ('b, 'a) corout -> ('a, 'b) corout) -> ('a, 'b) corout 7 | val yield : ('a, 'b) corout -> 'a -> 'b * ('a, 'b) corout 8 | end 9 | -------------------------------------------------------------------------------- /cmlib/coroutine.sml: -------------------------------------------------------------------------------- 1 | 2 | structure Coroutine 3 | :> COROUTINE 4 | = 5 | struct 6 | 7 | open Cont 8 | 9 | datatype ('a, 'b) corout = 10 | C of ('a * ('b, 'a) corout) cont 11 | 12 | fun coroutine f = 13 | callcc 14 | (fn exit => 15 | f (callcc (fn k => throw exit (C k)))) 16 | 17 | fun yield (C k) x = 18 | callcc 19 | (fn kSelf => throw k (x, C kSelf)) 20 | 21 | end 22 | -------------------------------------------------------------------------------- /cmlib/cryptohash.sig: -------------------------------------------------------------------------------- 1 | 2 | signature CRYPTO_HASH = 3 | sig 4 | 5 | type state 6 | 7 | val initial : state 8 | val update : state * Bytestring.string -> state 9 | val finish : state * Word8.word Stream.stream -> Bytestring.string 10 | 11 | val hash : Word8.word Stream.stream -> Bytestring.string 12 | 13 | end 14 | -------------------------------------------------------------------------------- /cmlib/deprecated/coord-stream.sig: -------------------------------------------------------------------------------- 1 | 2 | signature COORDINATED_STREAM = 3 | sig 4 | 5 | type 'a stream 6 | val coordinate : ('a stream -> bool) -> Coord.coord -> 'a stream -> ('a * Coord.coord) stream 7 | 8 | end 9 | -------------------------------------------------------------------------------- /cmlib/deprecated/coord-stream.sml: -------------------------------------------------------------------------------- 1 | 2 | structure CoordinatedStream 3 | :> COORDINATED_STREAM 4 | where type 'a stream = 'a Stream.stream 5 | = 6 | struct 7 | 8 | open Stream 9 | 10 | fun coordinate eoln coord s = 11 | lazy 12 | (fn () => 13 | (case front s of 14 | Nil => Nil 15 | | Cons (x, s') => 16 | let 17 | val coord' = 18 | if eoln s then 19 | Coord.nextline coord 20 | else 21 | Coord.nextchar coord 22 | in 23 | Cons ((x, coord'), coordinate eoln coord' s') 24 | end)) 25 | 26 | end 27 | -------------------------------------------------------------------------------- /cmlib/digital-signature.sig: -------------------------------------------------------------------------------- 1 | 2 | signature DIGITAL_SIGNATURE = 3 | sig 4 | 5 | type param 6 | type privkey 7 | type pubkey 8 | type sg 9 | 10 | val validParam : param -> bool 11 | val validPrivkey : param * privkey -> bool 12 | val validPubkey : param * pubkey -> bool 13 | 14 | val newkey : param -> pubkey * privkey 15 | val sign : param * privkey * Bytestring.string -> sg 16 | val verify : param * pubkey * Bytestring.string * sg -> bool 17 | 18 | end 19 | -------------------------------------------------------------------------------- /cmlib/ec-crypto.sig: -------------------------------------------------------------------------------- 1 | 2 | signature ELLIPTIC_CURVE_CRYPTO = 3 | sig 4 | 5 | structure EC : ELLIPTIC_CURVE 6 | 7 | val mult : EC.curve * IntInf.int * EC.point -> EC.point 8 | 9 | type param = { curve : EC.curve, 10 | base : EC.point, 11 | order : IntInf.int, 12 | cofactor : IntInf.int } 13 | 14 | type privkey = IntInf.int 15 | type pubkey = EC.point 16 | 17 | val validParam : param -> bool 18 | val validPrivkey : param * privkey -> bool 19 | val validPubkey : param * pubkey -> bool 20 | 21 | val newkey : param -> pubkey * privkey 22 | 23 | val privkeyToPubkey : param * privkey -> pubkey 24 | 25 | end 26 | -------------------------------------------------------------------------------- /cmlib/ec-field.sig: -------------------------------------------------------------------------------- 1 | 2 | (* Actually a family of fields. *) 3 | 4 | signature EC_FIELD = 5 | sig 6 | 7 | type index 8 | type elem 9 | 10 | val validIndex : index -> bool 11 | val validElem : index * elem -> bool 12 | 13 | val size : index -> IntInf.int 14 | 15 | val eq : elem * elem -> bool 16 | val zero : index -> elem 17 | val one : index -> elem 18 | val plus : index * elem * elem -> elem 19 | val minus : index * elem * elem -> elem 20 | val negate : index * elem -> elem 21 | val times : index * elem * elem -> elem 22 | val inverse : index * elem -> elem 23 | 24 | val elemToBytes : index * elem -> Bytestring.string 25 | val elemFromBytes : Bytestring.string -> elem 26 | val elemToInt : elem -> IntInf.int 27 | 28 | end 29 | -------------------------------------------------------------------------------- /cmlib/ec-params.sig: -------------------------------------------------------------------------------- 1 | 2 | signature ELLIPTIC_CURVE_PARAMS = 3 | sig 4 | 5 | type paramp = EllipticCurveCryptoFp.param 6 | type param2m = EllipticCurveCryptoF2m.param 7 | 8 | val secp256k1 : paramp 9 | val secp256r1 : paramp 10 | 11 | val sect283k1 : param2m 12 | val sect283r1 : param2m 13 | 14 | end 15 | -------------------------------------------------------------------------------- /cmlib/ec.sig: -------------------------------------------------------------------------------- 1 | 2 | signature ELLIPTIC_CURVE = 3 | sig 4 | 5 | structure Field : EC_FIELD 6 | 7 | type curve = {index : Field.index, a : Field.elem, b : Field.elem} 8 | type point = (Field.elem * Field.elem) option 9 | 10 | val validCurve : curve -> bool 11 | val validPoint : (curve * point) -> bool 12 | 13 | val infinity : point 14 | val plus : curve * point * point -> point 15 | val negate : curve * point -> point 16 | val double : curve * point -> point 17 | val eq : point * point -> bool 18 | 19 | val parity : curve * point -> bool 20 | val recoverPoint : curve * Field.elem * bool -> point option 21 | 22 | end 23 | -------------------------------------------------------------------------------- /cmlib/ecdh.sig: -------------------------------------------------------------------------------- 1 | 2 | signature ECDH = 3 | sig 4 | 5 | structure EC : ELLIPTIC_CURVE 6 | 7 | include SHARED_SECRET 8 | where type param = { curve : EC.curve, 9 | base : EC.point, 10 | order : IntInf.int, 11 | cofactor : IntInf.int } 12 | where type privkey = IntInf.int 13 | where type pubkey = EC.point 14 | where type secret = IntInf.int 15 | 16 | val privkeyToPubkey : param * privkey -> pubkey 17 | 18 | end 19 | -------------------------------------------------------------------------------- /cmlib/ecdh.sml: -------------------------------------------------------------------------------- 1 | 2 | functor ECDHFun (structure EllipticCurveCrypto : ELLIPTIC_CURVE_CRYPTO) 3 | :> 4 | ECDH 5 | where type EC.Field.index = EllipticCurveCrypto.EC.Field.index 6 | where type EC.Field.elem = EllipticCurveCrypto.EC.Field.elem 7 | = 8 | struct 9 | 10 | open EllipticCurveCrypto 11 | 12 | type secret = IntInf.int 13 | 14 | fun secret ({curve, ...}:param, pubkey, privkey) = 15 | (case mult (curve, privkey, pubkey) of 16 | NONE => 17 | (* If the parameters are correct, this can't happen. *) 18 | raise (Fail "Bad parameters") 19 | | SOME (x, _) => 20 | EC.Field.elemToInt x) 21 | 22 | end 23 | 24 | 25 | structure ECDHp = ECDHFun (structure EllipticCurveCrypto = EllipticCurveCryptoFp) 26 | structure ECDH2m = ECDHFun (structure EllipticCurveCrypto = EllipticCurveCryptoF2m) 27 | -------------------------------------------------------------------------------- /cmlib/ecdsa.sig: -------------------------------------------------------------------------------- 1 | 2 | signature ECDSA = 3 | sig 4 | 5 | structure EC : ELLIPTIC_CURVE 6 | 7 | include DIGITAL_SIGNATURE 8 | where type param = { curve : EC.curve, 9 | base : EC.point, 10 | order : IntInf.int, 11 | cofactor : IntInf.int } 12 | where type privkey = IntInf.int 13 | where type pubkey = EC.point 14 | where type sg = IntInf.int * IntInf.int 15 | 16 | val privkeyToPubkey : param * privkey -> pubkey 17 | 18 | end 19 | -------------------------------------------------------------------------------- /cmlib/finally.sig: -------------------------------------------------------------------------------- 1 | 2 | signature FINALLY = 3 | sig 4 | val finally : (unit -> 'a) -> (unit -> unit) -> 'a 5 | end -------------------------------------------------------------------------------- /cmlib/finally.sml: -------------------------------------------------------------------------------- 1 | 2 | structure Finally :> FINALLY = 3 | struct 4 | 5 | fun finally f g = 6 | let 7 | val x = Sum.INL (f ()) handle exn => Sum.INR exn 8 | in 9 | g (); 10 | (case x of 11 | Sum.INL y => y 12 | | Sum.INR exn => raise exn) 13 | end 14 | 15 | end -------------------------------------------------------------------------------- /cmlib/fortuna.sig: -------------------------------------------------------------------------------- 1 | 2 | (* The module does not provide automatic collection of entropy. The application 3 | does so, and then injects it using addEntropy. The module also does not 4 | automatically maintain a seed file. The application may do so, using initialSeed 5 | to import the seed file's contents, and using random to generate seed file contents. 6 | It might also be useful to provide a facility to save the entropy. 7 | *) 8 | 9 | signature FORTUNA = 10 | sig 11 | 12 | include RANDOM where type seed = Bytestring.string 13 | 14 | val poolCount : int 15 | 16 | (* takes (pool number, entropy) *) 17 | val addEntropy : int * Bytestring.string -> unit 18 | 19 | val initialSeed : Bytestring.string -> unit 20 | 21 | end 22 | -------------------------------------------------------------------------------- /cmlib/from-string.sig: -------------------------------------------------------------------------------- 1 | 2 | signature FROM_STRING = 3 | sig 4 | 5 | type cs 6 | val scanStringAll : ((char, cs) StringCvt.reader -> ('a, cs) StringCvt.reader) -> string -> 'a option 7 | val scanSubstringAll : ((char, cs) StringCvt.reader -> ('a, cs) StringCvt.reader) -> Substring.substring -> 'a option 8 | 9 | val toInt : string -> int option 10 | val toIntM : string -> int option (* rejects "~" for leading minus *) 11 | val toWord8 : string -> Word8.word option 12 | val toWord8Hex : string -> Word8.word option 13 | 14 | end 15 | -------------------------------------------------------------------------------- /cmlib/from-string.sml: -------------------------------------------------------------------------------- 1 | 2 | structure FromString :> FROM_STRING = 3 | struct 4 | 5 | type cs = Substring.substring 6 | 7 | fun scanSubstringAll scan str = 8 | (case scan Substring.getc str of 9 | SOME (x, tail) => 10 | if Substring.isEmpty tail then 11 | SOME x 12 | else 13 | NONE 14 | | NONE => NONE) 15 | 16 | fun scanStringAll scan str = scanSubstringAll scan (Substring.full str) 17 | 18 | val toInt = scanStringAll (Int.scan StringCvt.DEC) 19 | 20 | fun toIntM str = 21 | if String.size str < 1 orelse String.sub (str, 0) = #"~" then 22 | NONE 23 | else 24 | toInt str 25 | 26 | val toWord8 = scanStringAll (Word8.scan StringCvt.DEC) 27 | val toWord8Hex = scanStringAll (Word8.scan StringCvt.HEX) 28 | 29 | end 30 | -------------------------------------------------------------------------------- /cmlib/hash-inc.sig: -------------------------------------------------------------------------------- 1 | 2 | signature HASH_INCREMENT = 3 | sig 4 | 5 | val hashInc : Word.word -> Word.word -> Word.word 6 | 7 | end -------------------------------------------------------------------------------- /cmlib/hash-inc.sml: -------------------------------------------------------------------------------- 1 | 2 | structure JenkinsHash :> HASH_INCREMENT 3 | = 4 | struct 5 | 6 | (* Jenkins hash function *) 7 | 8 | fun hashInc hash datum = 9 | let 10 | val hash = Word.+ (hash, datum) 11 | val hash = Word.+ (hash, Word.<< (hash, 0w10)) 12 | val hash = Word.xorb (hash, Word.>> (hash, 0w6)) 13 | in 14 | hash 15 | end 16 | 17 | end 18 | 19 | 20 | (* A non-commutative variant of the Jenkins hash. *) 21 | structure MJHash :> HASH_INCREMENT 22 | = 23 | struct 24 | 25 | fun hashInc hash datum = 26 | let 27 | val hash = Word.+ (hash, Word.<< (hash, 0w10)) 28 | val hash = Word.xorb (hash, Word.>> (hash, 0w6)) 29 | val hash = Word.+ (hash, datum) 30 | in 31 | hash 32 | end 33 | 34 | end 35 | -------------------------------------------------------------------------------- /cmlib/hash-table-dataless.sig: -------------------------------------------------------------------------------- 1 | 2 | signature DATALESS_HASH_TABLE = 3 | DATALESS_TABLE 4 | where type init = int 5 | -------------------------------------------------------------------------------- /cmlib/hash-table.sig: -------------------------------------------------------------------------------- 1 | 2 | signature HASH_TABLE = 3 | TABLE 4 | where type init = int 5 | -------------------------------------------------------------------------------- /cmlib/hashable.sig: -------------------------------------------------------------------------------- 1 | 2 | signature HASHABLE = 3 | sig 4 | type t 5 | 6 | val eq : t * t -> bool 7 | val hash : t -> word 8 | end 9 | -------------------------------------------------------------------------------- /cmlib/io-mini.sig: -------------------------------------------------------------------------------- 1 | 2 | signature MINI_IO = 3 | sig 4 | 5 | type vector 6 | type elem 7 | 8 | type instream 9 | type outstream 10 | 11 | val input1 : instream -> elem option 12 | val inputN : instream * int -> vector 13 | val closeIn : instream -> unit 14 | val endOfStream : instream -> bool 15 | 16 | val output : outstream * vector -> unit 17 | val output1 : outstream * elem -> unit 18 | val flushOut : outstream -> unit 19 | val closeOut : outstream -> unit 20 | 21 | end 22 | -------------------------------------------------------------------------------- /cmlib/io-util.sig: -------------------------------------------------------------------------------- 1 | 2 | signature IO_UTIL = 3 | sig 4 | 5 | type outstream 6 | val nullOut : outstream 7 | 8 | end 9 | -------------------------------------------------------------------------------- /cmlib/iqueue.sig: -------------------------------------------------------------------------------- 1 | 2 | signature IQUEUE = 3 | sig 4 | type 'a iqueue 5 | 6 | val iqueue : unit -> 'a iqueue 7 | val reset : 'a iqueue -> unit 8 | 9 | exception Empty 10 | val insert : 'a iqueue -> 'a -> unit 11 | val isEmpty : 'a iqueue -> bool 12 | val front : 'a iqueue -> 'a 13 | val remove : 'a iqueue -> 'a 14 | end 15 | -------------------------------------------------------------------------------- /cmlib/list-util.sig: -------------------------------------------------------------------------------- 1 | 2 | signature LIST_UTIL = 3 | sig 4 | 5 | val revapp : ('a -> unit) -> 'a list -> unit 6 | val foldrLazy : ('a * 'b Susp.susp -> 'b) -> 'b -> 'a list -> 'b 7 | 8 | end 9 | -------------------------------------------------------------------------------- /cmlib/list-util.sml: -------------------------------------------------------------------------------- 1 | 2 | structure ListUtil :> LIST_UTIL = 3 | struct 4 | 5 | fun revapp f l = 6 | (case l of 7 | nil => () 8 | 9 | | h :: t => 10 | ( 11 | revapp f t; 12 | f h 13 | )) 14 | 15 | fun foldrLazy f x l = 16 | (case l of 17 | [] => x 18 | | h :: t => 19 | f (h, Susp.delay (fn () => foldrLazy f x t))) 20 | 21 | end -------------------------------------------------------------------------------- /cmlib/monad.sig: -------------------------------------------------------------------------------- 1 | 2 | signature MONAD = 3 | sig 4 | 5 | type 'a m 6 | 7 | val return : 'a -> 'a m 8 | val seq : 'a m -> 'b m -> 'b m 9 | val bind : 'a m -> ('a -> 'b m) -> 'b m 10 | 11 | end 12 | -------------------------------------------------------------------------------- /cmlib/monad.sml: -------------------------------------------------------------------------------- 1 | 2 | structure OptionMonad :> MONAD where type 'a m = 'a option = 3 | struct 4 | 5 | type 'a m = 'a option 6 | 7 | val return = SOME 8 | 9 | fun seq x y = 10 | (case x of 11 | NONE => NONE 12 | | SOME _ => y) 13 | 14 | fun bind x f = 15 | (case x of 16 | NONE => NONE 17 | | SOME x' => f x') 18 | 19 | end 20 | 21 | 22 | structure ListMonad :> MONAD where type 'a m = 'a list = 23 | struct 24 | 25 | type 'a m = 'a list 26 | 27 | fun return x = [x] 28 | 29 | fun bind l f = 30 | foldr 31 | (fn (x, r) => f x @ r) 32 | nil 33 | l 34 | 35 | fun seq l l' = bind l (fn _ => l') 36 | 37 | end 38 | -------------------------------------------------------------------------------- /cmlib/multi-file-io.sig: -------------------------------------------------------------------------------- 1 | 2 | signature MULTI_FILE_IO = 3 | sig 4 | 5 | include MINI_IO 6 | 7 | val openIn : string -> instream 8 | val openAppend : string -> outstream 9 | val exists : string -> bool 10 | 11 | type pos 12 | 13 | val getPosIn : instream -> pos 14 | val getPosOut : outstream -> pos 15 | 16 | (* Can seek outside current file contents, but only within the current piece. *) 17 | structure SeekIO : SEEK_IO 18 | where type instream = instream 19 | where type outstream = outstream 20 | where type pos = pos 21 | 22 | end 23 | -------------------------------------------------------------------------------- /cmlib/multi-table.sig: -------------------------------------------------------------------------------- 1 | 2 | signature MULTI_TABLE = 3 | sig 4 | 5 | type key 6 | type value 7 | 8 | val reset : unit -> unit 9 | val member : key -> bool 10 | val insert : key -> value -> unit 11 | val find : key -> value list 12 | val lookup : key -> value list 13 | val toList : unit -> (key * value list) list 14 | 15 | end 16 | -------------------------------------------------------------------------------- /cmlib/ordered-2.sml: -------------------------------------------------------------------------------- 1 | 2 | structure IntInfOrdered 3 | :> ORDERED where type t = IntInf.int 4 | = 5 | struct 6 | type t = IntInf.int 7 | 8 | val eq : IntInf.int * IntInf.int -> bool = (op =) 9 | val compare = IntInf.compare 10 | end 11 | 12 | 13 | structure TimeOrdered 14 | :> ORDERED where type t = Time.time 15 | = 16 | struct 17 | type t = Time.time 18 | 19 | val compare = Time.compare 20 | fun eq (t1, t2) = (case compare (t1, t2) of EQUAL => true | _ => false) 21 | end 22 | 23 | 24 | -------------------------------------------------------------------------------- /cmlib/ordered.sig: -------------------------------------------------------------------------------- 1 | 2 | signature ORDERED = 3 | sig 4 | type t 5 | 6 | val eq : t * t -> bool 7 | val compare : t * t -> order 8 | end 9 | -------------------------------------------------------------------------------- /cmlib/partition.sig: -------------------------------------------------------------------------------- 1 | 2 | signature PARTITION = 3 | sig 4 | 5 | type 'a seq 6 | val partition : ('a * 'a -> bool) -> 'a seq -> 'a seq seq 7 | 8 | end 9 | -------------------------------------------------------------------------------- /cmlib/pickleable.sig: -------------------------------------------------------------------------------- 1 | 2 | signature PICKLEABLE_TYPE = 3 | sig 4 | type t 5 | 6 | val pu : t Pickle.pu 7 | end 8 | 9 | 10 | signature PICKLEABLE_CON = 11 | sig 12 | type 'a t 13 | 14 | val pu : 'a Pickle.pu -> 'a t Pickle.pu 15 | end 16 | -------------------------------------------------------------------------------- /cmlib/pstream.sig: -------------------------------------------------------------------------------- 1 | 2 | (* Pollable streams. *) 3 | 4 | signature PSTREAM = 5 | sig 6 | 7 | type 'a pstream 8 | datatype 'a front = Nil | Cons of 'a * 'a pstream 9 | 10 | val eager : 'a front -> 'a pstream 11 | val lazy : (unit -> 'a front option) -> 'a pstream 12 | 13 | exception NotReady 14 | val front : 'a pstream -> 'a front 15 | val isReady : 'a pstream -> bool 16 | val poll : 'a pstream -> 'a front option 17 | 18 | datatype 'a result = 19 | Ready of 'a 20 | | Blocked 21 | | Closed 22 | 23 | val fromBlockingProcess : (unit -> 'a result) -> 'a pstream 24 | val fromIqueue : 'a IQueue.iqueue -> 'a pstream 25 | 26 | val toStream : 'a pstream -> 'a option Stream.stream 27 | 28 | val fix : ('a pstream -> 'a pstream) -> 'a pstream 29 | 30 | val map : ('a -> 'b) -> 'a pstream -> 'b pstream 31 | 32 | end 33 | -------------------------------------------------------------------------------- /cmlib/psusp.sig: -------------------------------------------------------------------------------- 1 | 2 | (* Pollable suspensions. *) 3 | 4 | signature PSUSP = 5 | sig 6 | 7 | type 'a psusp 8 | 9 | val delay : (unit -> 'a option) -> 'a psusp 10 | 11 | exception NotReady 12 | val force : 'a psusp -> 'a 13 | val isReady : 'a psusp -> bool 14 | val poll : 'a psusp -> 'a option 15 | 16 | end 17 | -------------------------------------------------------------------------------- /cmlib/queue.sig: -------------------------------------------------------------------------------- 1 | 2 | signature QUEUE = 3 | sig 4 | type 'a queue 5 | 6 | exception Empty 7 | val empty : 'a queue 8 | val insert : 'a queue -> 'a -> 'a queue 9 | val isEmpty : 'a queue -> bool 10 | val front : 'a queue -> 'a * 'a queue 11 | end 12 | 13 | -------------------------------------------------------------------------------- /cmlib/rand.sig: -------------------------------------------------------------------------------- 1 | 2 | signature RAND = 3 | sig 4 | 5 | (* randomX(max) generates a random number in the range 0 .. max-1 *) 6 | val randIntInf : IntInf.int -> IntInf.int 7 | val randInt : int -> int 8 | 9 | val randBool : unit -> bool 10 | val randBits : int -> IntInf.int 11 | val randWord8 : unit -> Word8.word 12 | 13 | val randWord32 : unit -> Word32.word 14 | 15 | type seed 16 | val reseed : seed -> unit 17 | 18 | end 19 | -------------------------------------------------------------------------------- /cmlib/rand32.sig: -------------------------------------------------------------------------------- 1 | 2 | signature RAND32 = 3 | sig 4 | val randWord32 : unit -> Word32.word 5 | 6 | type seed 7 | val reseed : seed -> unit 8 | end 9 | -------------------------------------------------------------------------------- /cmlib/random.sig: -------------------------------------------------------------------------------- 1 | 2 | (* Secure random number generation. *) 3 | 4 | signature RANDOM = 5 | sig 6 | 7 | val random : int -> Bytestring.string (* generates the indicated number of bytes *) 8 | 9 | type seed 10 | val reseed : seed -> unit 11 | 12 | end 13 | -------------------------------------------------------------------------------- /cmlib/seek-io.sig: -------------------------------------------------------------------------------- 1 | 2 | signature SEEK_IO = 3 | sig 4 | 5 | type instream 6 | type outstream 7 | type pos 8 | 9 | exception SeekImpossible 10 | val seekIn : instream * pos -> unit 11 | val seekOut : outstream * pos -> unit 12 | 13 | end 14 | -------------------------------------------------------------------------------- /cmlib/shared-secret.sig: -------------------------------------------------------------------------------- 1 | 2 | signature SHARED_SECRET = 3 | sig 4 | 5 | type param 6 | type privkey 7 | type pubkey 8 | type secret 9 | 10 | val validParam : param -> bool 11 | val validPrivkey : param * privkey -> bool 12 | val validPubkey : param * pubkey -> bool 13 | 14 | val newkey : param -> pubkey * privkey 15 | val secret : param * pubkey * privkey -> secret 16 | 17 | end 18 | -------------------------------------------------------------------------------- /cmlib/sort.sig: -------------------------------------------------------------------------------- 1 | 2 | signature SORT = 3 | sig 4 | val sort : ('a * 'a -> order) -> 'a list -> 'a list 5 | end -------------------------------------------------------------------------------- /cmlib/streamable-2.sml: -------------------------------------------------------------------------------- 1 | 2 | structure VectorSliceStreamable 3 | :> STREAMABLE 4 | where type 'a t = 'a VectorSlice.slice 5 | = 6 | struct 7 | 8 | type 'a t = 'a VectorSlice.slice 9 | 10 | datatype 'a front = Nil | Cons of 'a * 'a t 11 | 12 | fun front v = 13 | (case VectorSlice.getItem v of 14 | NONE => Nil 15 | | SOME (h, t) => Cons (h, t)) 16 | 17 | end 18 | -------------------------------------------------------------------------------- /cmlib/streamable-mono.sig: -------------------------------------------------------------------------------- 1 | 2 | signature MONO_STREAMABLE = 3 | sig 4 | type t 5 | type elem 6 | 7 | datatype front = Nil | Cons of elem * t 8 | val front : t -> front 9 | end 10 | -------------------------------------------------------------------------------- /cmlib/streamable-mono.sml: -------------------------------------------------------------------------------- 1 | 2 | functor MonomorphizeStreamable (structure Streamable : STREAMABLE 3 | type elem) 4 | :> MONO_STREAMABLE 5 | where type t = elem Streamable.t 6 | where type elem = elem 7 | = 8 | struct 9 | 10 | type t = elem Streamable.t 11 | type elem = elem 12 | 13 | datatype front = Nil | Cons of elem * t 14 | 15 | fun front s = 16 | (case Streamable.front s of 17 | Streamable.Nil => Nil 18 | | Streamable.Cons (x, s') => Cons (x, s')) 19 | 20 | end 21 | -------------------------------------------------------------------------------- /cmlib/streamable.sig: -------------------------------------------------------------------------------- 1 | 2 | signature STREAMABLE = 3 | sig 4 | type 'a t 5 | 6 | datatype 'a front = Nil | Cons of 'a * 'a t 7 | val front : 'a t -> 'a front 8 | end 9 | -------------------------------------------------------------------------------- /cmlib/string-mini.sig: -------------------------------------------------------------------------------- 1 | 2 | signature MINI_STRING = 3 | sig 4 | 5 | type string 6 | type elem 7 | 8 | val null : string 9 | val sub : string * int -> elem 10 | val size : string -> int 11 | val extract : string * int * int option -> string 12 | val concat : string list -> string 13 | val implode : elem list -> string 14 | val explode : string -> elem list 15 | 16 | end 17 | -------------------------------------------------------------------------------- /cmlib/susp-monad.sml: -------------------------------------------------------------------------------- 1 | 2 | structure SuspMonad :> MONAD where type 'a m = 'a Susp.susp = 3 | struct 4 | 5 | type 'a m = 'a Susp.susp 6 | 7 | fun return x = Susp.delay (fn () => x) 8 | 9 | fun seq s1 s2 = 10 | Susp.delay (fn () => (Susp.force s1; Susp.force s2)) 11 | 12 | fun bind s1 s2 = 13 | Susp.delay 14 | (fn () => 15 | let 16 | val x = Susp.force s1 17 | in 18 | Susp.force (s2 x) 19 | end) 20 | 21 | end 22 | -------------------------------------------------------------------------------- /cmlib/susp-nj.sml: -------------------------------------------------------------------------------- 1 | structure Susp :> SUSP = SMLofNJ.Susp 2 | 3 | -------------------------------------------------------------------------------- /cmlib/susp.sig: -------------------------------------------------------------------------------- 1 | 2 | signature SUSP = 3 | sig 4 | 5 | type 'a susp 6 | 7 | val delay : (unit -> 'a) -> 'a susp 8 | val force : 'a susp -> 'a 9 | 10 | end 11 | -------------------------------------------------------------------------------- /cmlib/susp.sml: -------------------------------------------------------------------------------- 1 | 2 | (* A valid implementation of SUSP, for platforms that don't support suspensions primitively. *) 3 | 4 | structure Susp :> SUSP = 5 | struct 6 | 7 | type 'a susp = (unit -> 'a) ref 8 | 9 | fun delay f = 10 | let 11 | val r = ref (fn () => raise (Fail "empty suspension")) 12 | 13 | val () = 14 | r := (fn () => let 15 | val x = f () 16 | in 17 | r := (fn () => x); 18 | x 19 | end) 20 | in 21 | r 22 | end 23 | 24 | fun force r = !r () 25 | 26 | end 27 | -------------------------------------------------------------------------------- /cmlib/symbol.sig: -------------------------------------------------------------------------------- 1 | 2 | signature SYMBOL = 3 | sig 4 | 5 | type value 6 | type symbol 7 | 8 | val eq : symbol * symbol -> bool 9 | val compare : symbol * symbol -> order 10 | 11 | val fromValue : value -> symbol 12 | val toValue : symbol -> value 13 | 14 | val hash : symbol -> word 15 | 16 | end 17 | -------------------------------------------------------------------------------- /cmlib/table-checkpoint.sig: -------------------------------------------------------------------------------- 1 | 2 | signature CHECKPOINT_TABLE = 3 | sig 4 | 5 | type key 6 | type value 7 | type checkpoint 8 | 9 | val member : key -> bool 10 | val insert : key -> value -> unit 11 | val remove : key -> unit 12 | val find : key -> value option 13 | val lookup : key -> value 14 | 15 | val operate : 16 | key -> (unit -> value) -> (value -> value) -> value option * value 17 | val insertMerge : key -> value -> (value -> value) -> unit 18 | 19 | val toList : unit -> (key * value) list 20 | val fold : (key * value * 'a -> 'a) -> 'a -> 'a 21 | val app : (key * value -> unit) -> unit 22 | 23 | val reset : unit -> unit 24 | val save : unit -> checkpoint 25 | val restore : checkpoint -> unit 26 | 27 | end 28 | -------------------------------------------------------------------------------- /cmlib/table-dataless-mini.sig: -------------------------------------------------------------------------------- 1 | 2 | signature MINI_DATALESS_TABLE = 3 | sig 4 | 5 | type init 6 | type key 7 | type table 8 | 9 | val table : init -> table 10 | val reset : table -> init -> unit 11 | 12 | val size : table -> int 13 | val insert : table -> key -> unit 14 | val remove : table -> key -> unit 15 | val find : table -> key -> key option 16 | 17 | val fold : (key * 'b -> 'b) -> 'b -> table -> 'b 18 | 19 | end 20 | -------------------------------------------------------------------------------- /cmlib/table-mini.sig: -------------------------------------------------------------------------------- 1 | 2 | signature MINI_TABLE = 3 | sig 4 | 5 | type init 6 | type key 7 | type 'a table 8 | 9 | val table : init -> 'a table 10 | val reset : 'a table -> init -> unit 11 | 12 | val size : 'a table -> int 13 | val insert : 'a table -> key -> 'a -> unit 14 | val remove : 'a table -> key -> unit 15 | val find : 'a table -> key -> 'a option 16 | 17 | val fold : (key * 'a * 'b -> 'b) -> 'b -> 'a table -> 'b 18 | 19 | end 20 | -------------------------------------------------------------------------------- /cmlib/tests/qchecktest.cm: -------------------------------------------------------------------------------- 1 | Group is 2 | ../../qcheck-1.0/qcheck.cm 3 | 4 | ../cmlib.cm 5 | mergesort-qcheck.sml 6 | -------------------------------------------------------------------------------- /cmlib/tests/test.cm: -------------------------------------------------------------------------------- 1 | Group is 2 | ../cmlib.cm 3 | $SMACKAGE/qcheck/v1/qcheck.cm 4 | testing.sig 5 | testing.sml 6 | 7 | mergesort-test.sml 8 | mergesort-qcheck.sml 9 | quicksort-test.sml 10 | sets-dicts-test.sml 11 | test-collection.sml 12 | ipqueue-list.sml 13 | ipqueue-check.sml 14 | ipqueue-test.sml 15 | -------------------------------------------------------------------------------- /cmlib/tests/test.mlb: -------------------------------------------------------------------------------- 1 | 2 | ../cmlib.mlb 3 | $(SMACKAGE)/qcheck/v1/qcheck.mlb 4 | testing.sig 5 | testing.sml 6 | 7 | mergesort-test.sml 8 | mergesort-qcheck.sml 9 | quicksort-test.sml 10 | ipqueue-list.sml 11 | ipqueue-check.sml 12 | ipqueue-test.sml 13 | sets-dicts-test.sml 14 | -------------------------------------------------------------------------------- /cmlib/tests/test.sig: -------------------------------------------------------------------------------- 1 | signature TEST = 2 | sig 3 | val run : unit -> unit 4 | end 5 | -------------------------------------------------------------------------------- /cmlib/tests/testing-mlton.mlb: -------------------------------------------------------------------------------- 1 | ../cmlib-mlton.mlb 2 | 3 | local 4 | testing.sig 5 | testing.sml 6 | in 7 | signature TESTING 8 | structure Testing 9 | end -------------------------------------------------------------------------------- /cmlib/tests/testing.cm: -------------------------------------------------------------------------------- 1 | library 2 | signature TESTING 3 | structure Testing 4 | is 5 | ../cmlib.cm 6 | testing.sig 7 | testing.sml -------------------------------------------------------------------------------- /cmlib/tests/testing.mlb: -------------------------------------------------------------------------------- 1 | ../cmlib.mlb 2 | 3 | local 4 | testing.sig 5 | testing.sml 6 | in 7 | signature TESTING 8 | structure Testing 9 | end -------------------------------------------------------------------------------- /cmlib/tests/testing.sig: -------------------------------------------------------------------------------- 1 | signature TESTING = 2 | sig 3 | (* expect a predicate to hold of a value; string should describe the test *) 4 | val expect : 'a -> ('a -> bool) -> string -> unit 5 | (* expect a value to be equal to a given value; string should describe the 6 | test *) 7 | val expectEq : ''a -> ''a -> string -> unit 8 | 9 | val passes : unit -> int 10 | val failures : unit -> int 11 | val report : unit -> unit (* report pass/failure counts *) 12 | val reset : unit -> unit (* reset pass/failure counts *) 13 | end 14 | -------------------------------------------------------------------------------- /cmlib/tests/testing.sml: -------------------------------------------------------------------------------- 1 | structure Testing :> TESTING = 2 | struct 3 | val n_passes = ref 0 4 | val n_failures = ref 0 5 | 6 | fun passes () = !n_passes 7 | fun failures () = !n_failures 8 | 9 | fun reset () = (n_passes := 0; n_failures := 0) 10 | 11 | fun report () = 12 | print (Int.toString (passes ()) ^ " tests passed, " 13 | ^ Int.toString (failures ()) ^ " tests failed.\n") 14 | 15 | fun incr r = r := !r + 1 16 | 17 | fun expect x p s = 18 | if p x 19 | then (incr n_passes) 20 | else (print ("Failed test: " ^ s ^ "\n"); 21 | incr n_failures) 22 | 23 | fun expectEq x y s = expect x (fn x => x = y) s 24 | 25 | end 26 | -------------------------------------------------------------------------------- /cmlib/topological-sort.sig: -------------------------------------------------------------------------------- 1 | 2 | signature TOPOLOGICAL_SORT = 3 | sig 4 | 5 | type key 6 | type value 7 | 8 | exception Cycle of key 9 | 10 | val sort : value list -> value list 11 | 12 | end -------------------------------------------------------------------------------- /cmlib/union-find-imperative.sig: -------------------------------------------------------------------------------- 1 | 2 | signature IMPERATIVE_UNION_FIND = 3 | sig 4 | 5 | type 'a set 6 | 7 | val new : 'a -> 'a set 8 | val eq : 'a set * 'a set -> bool 9 | val union : ('a * 'a -> 'a) -> 'a set -> 'a set -> unit 10 | val sameSet : 'a set * 'a set -> bool 11 | val find : 'a set -> 'a 12 | val isCanonical : 'a set -> bool 13 | 14 | end 15 | -------------------------------------------------------------------------------- /cmlib/weak-mlton.sml: -------------------------------------------------------------------------------- 1 | structure Weak:> WEAK = 2 | struct 3 | type 'a weak = 'a MLton.Weak.t 4 | val weak = MLton.Weak.new 5 | val strong = MLton.Weak.get 6 | end 7 | -------------------------------------------------------------------------------- /cmlib/weak-nj.sml: -------------------------------------------------------------------------------- 1 | 2 | structure Weak :> WEAK = SMLofNJ.Weak 3 | -------------------------------------------------------------------------------- /cmlib/weak.sig: -------------------------------------------------------------------------------- 1 | 2 | signature WEAK = 3 | sig 4 | 5 | type 'a weak 6 | val weak : 'a -> 'a weak 7 | val strong : 'a weak -> 'a option 8 | 9 | end 10 | -------------------------------------------------------------------------------- /cmlib/weak.sml: -------------------------------------------------------------------------------- 1 | 2 | (* A semantically sound but unhelpful implementation of WEAK, 3 | for platforms that don't support weak pointers. 4 | *) 5 | 6 | structure Weak :> WEAK = 7 | struct 8 | 9 | type 'a weak = 'a 10 | 11 | fun weak x = x 12 | fun strong x = SOME x 13 | 14 | end 15 | -------------------------------------------------------------------------------- /conclusion_and_forth_coming_debug_hint.txt: -------------------------------------------------------------------------------- 1 | run yy_test 2 | 3 | 4 | pay attention to the difference between hello-world-1 and hello-world-2. 5 | The reason is pending investigation, but we've just implemented first class modules. 6 | 7 | I will not touch this project until Dec 30, 2022 -------------------------------------------------------------------------------- /docs/LanguagePerformance.md: -------------------------------------------------------------------------------- 1 | # 语言性能 2 | 3 | 由于处于早期阶段,性能还不尽人意。可以在运行在`performance-investigation`里面的测试脚本进行测试。以下是初步结果: 4 | 5 | 6 | ![p1](result1.png) 7 | ![p2](result2.png) -------------------------------------------------------------------------------- /docs/LanguageSpecification.md: -------------------------------------------------------------------------------- 1 | 2 | # 豫言语言规范 3 | 4 | 一个豫言程序是一系列豫言声明(Declarations),每个声明以句号(`。`)分隔。 5 | 6 | 声明包括:注释,定义,函数的类型声明,构造器的类型声明,直接表达式,和结构声明。 7 | 8 | 9 | 10 | 表达式包括:直接值(immediate values)以及其他。 11 | 12 | 直接值包括: 13 | - 字符串,以`『』`包含的所有字符都算作字符串的一部分,其中可以两个右引号`』』`来在`『』`中表示`』`。 14 | - 整数及小数,如`「一二三」`表示整数`123`, `「三二一点五四」`表示小数`321.54` 15 | 16 | ### 关于括号的使用 17 | 一对`「」`及内部字符按照如下规则理解, 18 | - 只包含数字,则理解为数字,如`三点二`,`一二`。 19 | - 如内部出现句号,则理解为一个结构声明 20 | - 如内部出现其他括号和引号,则理解为一个复杂表达式 21 | - 如果出现一些预留的特殊字符,例如(《》),则理解为一个复杂表达式 22 | - 否则理解为一个名字 23 | 24 | 一对`()`永远被理解成一个复杂表达式,如内部出现`。`则理解成一个结构体 25 | 26 | 为了方便输入,`()`被视为`「」`。 27 | 28 | (中文输入法下`Shift+{`可以输入「」和『』) 29 | 30 | ## 语法表 31 | 32 | 详见[语法表](SyntaxSheet.md) 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/ModuleAndBuildSystems.md: -------------------------------------------------------------------------------- 1 | ## 关于发布的软件库 2 | 3 | 其根目录必须包含一个`包裹。豫`文件。 4 | 5 | ### `包裹。豫`中的规定属性 6 | 7 | | 属性 | 值 | 8 | |------|------| 9 | | 名称 | 包名,引用时需要与文件夹名相同 | 10 | | 依赖 | 数组(字符串),所有依赖的包名。将用于自动从网络安装所需要的包 | 11 | -------------------------------------------------------------------------------- /docs/WASM支持纪要.md: -------------------------------------------------------------------------------- 1 | 2 | # 对于WASM支持 3 | 4 | LLVM代码生成假设所有使用的指针都是64位的,故不可以生成wasm32程序。 5 | 6 | libgc支持wasm,但不支持wasm64. 7 | 8 | 我们需要等待libgc支持wasm64,在这之前,我们的在线IDE不使用libgc,而直接不进行垃圾回收。 -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate 2 | title: 豫言 3 | description: 一款函数式中文编程语言 4 | google_site_verification: 5czGwj7rXQ5Iel0c-Zq2qTgS7V_QRwFalbTNgEjmWeU 5 | 6 | plugins: 7 | - jekyll-sitemap 8 | -------------------------------------------------------------------------------- /docs/autogen/docs/总库.html: -------------------------------------------------------------------------------- 1 |

总库



返回目录 -------------------------------------------------------------------------------- /docs/community_qr_wecom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/docs/community_qr_wecom.png -------------------------------------------------------------------------------- /docs/result1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/docs/result1.png -------------------------------------------------------------------------------- /docs/result2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/docs/result2.png -------------------------------------------------------------------------------- /docs/其他信息.md: -------------------------------------------------------------------------------- 1 | ## 关于调试技巧 2 | 3 | vscode的vim插件有时候会和输入法冲突导致输入一些看不见的字符导致编译失败,可以使用vim,debug。 4 | 5 | 6 | 7 | ## 语言性能 8 | 9 | 详见[语言性能](LanguagePerformance.md) 10 | 11 | -------------------------------------------------------------------------------- /docs/快速开始.md: -------------------------------------------------------------------------------- 1 | 2 | 运行一个程序: 3 | ``` 4 | yy filename.yuyan 5 | ``` 6 | 7 | 编译一个程序 8 | ``` 9 | yy filename.yuyan -c -o output.out 10 | ``` 11 | 12 | 显示帮助 13 | ``` 14 | yy -h 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/教程/0000-教程目录.md: -------------------------------------------------------------------------------- 1 | # 豫言编程语言教程 2 | 3 | - [豫言编程语言简介](0001-豫言编程语言简介.md) 4 | 5 | ## 初级教程 6 | 7 | - [第一章-教程序言](0010-第一章-教程序言.md) 8 | - [第二章-数据与函数](0020-第二章-数据与函数.md) 9 | - [第三章-类型](0030-第三章-类型.md) 10 | - [第四章-更深一步了解函数](0040-第四章-更深一步了解函数.md) 11 | - [第五章-自建数据类型](0050-第五章-自建数据类型.md) 12 | - [第六章-入门教程结语](0060-第六章-入门教程结语.md) 13 | 14 | ## 附录 15 | 16 | - [语法表](0100-语法对照表.md) -------------------------------------------------------------------------------- /docs/教程/0001-豫言编程语言简介.md: -------------------------------------------------------------------------------- 1 | # 豫言编程语言简介 2 | 3 | ## 综述 4 | 5 | ### 设计理念 6 | 7 | 豫言中文编程语言以中文编程为核心,以现代化编译器框架LLVM为基础,吸取函数式编程领域数十年来的语言设计经验,自主研发,实现了从顶部语法,编译设计,代码生成的全中文编程环境。豫言编译器将全中文的源码,通过一系列编译步骤,生成了完全使用中文标识符LLVM后端码,最终由LLVM编译器框架生成后端执行程序。豫言编译器本身也使用了豫言编程语言实现,证明了豫言语言设计可以被用来构建大型程序,是众多编程语言以外企业和个人的又一项选择。 8 | 9 | ### 核心特征 10 | 11 | 与其他语言相比,豫言有着独特的风格。与其余大部分中文编程语言相比,豫言基于函数式编程,开创性地采用了依值类型系统,从根本上增强了语言的安全性与可靠性,也从某种程度上增加了软件开发效率。与同类型的英文编程语言相比,豫言的出现减少了语言学习的门槛,使得广大软件行业从业者乃至青少年不需要借助英文就可以学习和使用先进的编程语言范式,同时这些范式在豫言中拥有更直接的表达,这对于汉语在计算机行业及编程语言相关技术的发展有着直接的促进作用。 12 | 13 | ### 历史展望 14 | 15 | 豫言编程语言不是第一个,也不会是最后一个中文编程语言,我们已经看到有新的中文编程语言(例如入墨答语言)借用了豫言编程语言中的一些设计。我们希望全新设计的豫言编程语言成为集当今优秀的编程语言设计于一体,能够兼顾工业生产、人才教育、科学研究的一门编程语言。未来一定会有新的编程语言出现,我们希望通过豫言成为他们设计时的可靠参考。 16 | 17 | 18 | ## 为何设计中文编程语言? 19 | 20 | 中文有源远流长的历史,丰富的文化内涵。这样一门语言,在科技上仍然看不到广泛的使用,定有其特殊的原因。中文编程语言的设计虽然经历了照搬翻译英文关键字,自主设计语法,到使用本土表达的发展阶段,但目前仍有实用方面未能够解决的问题。我希望借本项目,探索中文在编程语言设计领域的各种问题,最终展现中文在编程语言行业的魅力。 21 | -------------------------------------------------------------------------------- /docs/教程/0010-第一章-教程序言.md: -------------------------------------------------------------------------------- 1 | # 第一章:教程序言 2 | 3 | 豫言是一门极简单又深入的语言。我们与大家分享我在豫言编程语言设计方面的思考,希望以此在中文编程语言的设计上继往开来,推陈出新。如有错误不周之处,恳请读者予以斧正。 4 | 5 | ## 语法 6 | 7 | 豫言有简略的文言语法,和易懂的现代汉语语法。 8 | 文言语法主要用于实际开发,现代汉语语法主要用于教学。 9 | 两种语法一一对应,详见附录语法表。 10 | 本教程将使用现代汉语语法书写,豫言编译器本身使用文言语法书写。读者最终可以自由选择两种语法之一使用。 11 | 12 | ## 如何运行代码 13 | 14 | 代码有两种运行方式,一是使用在线IDE(目前仍在开发中),二是在本地安装程序,并使用VSCode等文本编辑器编辑代码,使用命令行运行代码。 15 | 16 | 本教程大多数情况下需要依赖标准库,运行代码时请在文件顶部加上 17 | ``` 18 | 导入并打开标准库。 19 | ``` -------------------------------------------------------------------------------- /docs/教程/0060-第六章-入门教程结语.md: -------------------------------------------------------------------------------- 1 | 2 | # 入门教程结语 3 | 4 | 恭喜你已经完成了入门教程的学习! -------------------------------------------------------------------------------- /docs/教程/combined_tutorial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/docs/教程/combined_tutorial.pdf -------------------------------------------------------------------------------- /docs/教程/makepdf/Makefile: -------------------------------------------------------------------------------- 1 | MARKDOWN_FILES := $(wildcard ../*.md) 2 | combined_tutorial.pdf: $(MARKDOWN_FILES) 3 | pandoc $(MARKDOWN_FILES) -o ../combined_tutorial.pdf --pdf-engine=xelatex -V CJKmainfont="PingFang SC" --highlight-style=pygments -H template.tex --listings 4 | 5 | 6 | clean: 7 | rm ../combined_tutorial.pdf -------------------------------------------------------------------------------- /docs/教程/makepdf/template.tex: -------------------------------------------------------------------------------- 1 | \usepackage{listings} 2 | \usepackage{xcolor} 3 | \usepackage{mdframed} 4 | 5 | \colorlet{shadecolor}{gray!15} 6 | 7 | \lstdefinestyle{mystyle}{ 8 | basicstyle=\ttfamily, 9 | backgroundcolor=\color{shadecolor}, 10 | breaklines=true, 11 | showstringspaces=false, 12 | } 13 | 14 | \lstset{style=mystyle} 15 | 16 | \surroundwithmdframed[ 17 | hidealllines=true, 18 | backgroundcolor=shadecolor, 19 | innerleftmargin=10pt, 20 | innerrightmargin=10pt, 21 | innertopmargin=0pt, 22 | innerbottommargin=0pt 23 | ]{lstlisting} 24 | -------------------------------------------------------------------------------- /docs/类型检查.md: -------------------------------------------------------------------------------- 1 | 2 | ## 一些类型检查的一些临时设计 3 | 4 | #### 对子类型,爻分支类型 5 | 除非特别指定类型,否则会会移除静态单例并补全隐式参数 6 | -------------------------------------------------------------------------------- /empty.yuyan: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/empty.yuyan -------------------------------------------------------------------------------- /examples/helloworld/helloworld.yuyan: -------------------------------------------------------------------------------- 1 | 观笔之书。 2 | 笔之写于『你吃了吗?』续以新行。 3 | 4 | 注:当前版本0.1.0默认打印结束时的值,想要不打印可以加上:。 5 | 甲者有也。 -------------------------------------------------------------------------------- /examples/helloworld/行。豫库: -------------------------------------------------------------------------------- 1 | ../../yystdlib/公库。豫库 2 | helloworld.yuyan -------------------------------------------------------------------------------- /examples/helloworld2.yuyan: -------------------------------------------------------------------------------- 1 | 语者夫你吃了吗表有亦夫你好表有也。 2 | 问为语也。 3 | 施问乃为你吃了吗临元。 4 | 5 | 问。 -------------------------------------------------------------------------------- /examples/hl.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 阳为爻也。 3 | -------------------------------------------------------------------------------- /examples/quicksort-stdlib/速序。豫库: -------------------------------------------------------------------------------- 1 | ../../yystdlib/公库。豫库 2 | 速序。豫 3 | -------------------------------------------------------------------------------- /ide/client/ide-pre.js: -------------------------------------------------------------------------------- 1 | // pre.js 2 | 3 | var Module = { 4 | print: function(text) { 5 | // Redirect stdout to stderrOutput element 6 | var stdoutOutput = document.getElementById("stdout-output"); 7 | stdoutOutput.textContent += text + "\n"; 8 | }, 9 | printErr: function(text) { 10 | // Redirect stderr to stderrOutput element 11 | var stderrOutput = document.getElementById("stderr-output"); 12 | stderrOutput.textContent += text + "\n"; 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /ide/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "express": "^4.18.2" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /increment_build_number.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | 3 | sed -i -E 's/\+([0-9]+)/&@/g;:a {s/0@/1/g;s/1@/2/g;s/2@/3/g;s/3@/4/g;s/4@/5/g;s/5@/6/g;s/6@/7/g;s/7@/8/g;s/8@/9/g;s/9@/@0/g;t a};s/@/1/g' 豫言编译器/编译辅助工具/命令行/版本管理。豫 -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | cp runtime/libyyrtdebug.a /usr/local/lib/libyuyanlangruntimedebug.a 2 | cp runtime/libyyrtopt.a /usr/local/lib/libyuyanlangruntime.a 3 | cp yy /usr/local/bin/yuyanlang 4 | ln -sf /usr/local/bin/yuyanlang /usr/local/bin/yy -------------------------------------------------------------------------------- /lsp.py: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/python3 2 | 3 | import sys 4 | import os 5 | import time 6 | f = open ("pylog", 'w') 7 | time.sleep(1) 8 | # print("Content-Length: ", len(""""{jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":{"openClose":true, "change":1}}}}""")) 9 | # print("") 10 | sys.stderr.write(""""{jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":{"openClose":true, "change":1}}}}""") 11 | l = input() 12 | l = input() 13 | for i in range(4081): 14 | l = sys.stdin.read(1) 15 | 16 | # f.write(str(i)) 17 | # f.write(":") 18 | # f.write("{}".format(l)) 19 | # f.write("\n") 20 | f.write(l) 21 | f.flush() 22 | print(""""{jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":{"openClose":true, "change":1}}}}""") 23 | 24 | time.sleep(10) 25 | 26 | os.path.dirname() -------------------------------------------------------------------------------- /output.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/output.c -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yuyan", 3 | "lockfileVersion": 3, 4 | "requires": true, 5 | "packages": { 6 | "": { 7 | "dependencies": { 8 | "strftime": "^0.10.2" 9 | } 10 | }, 11 | "node_modules/strftime": { 12 | "version": "0.10.2", 13 | "resolved": "https://registry.npmjs.org/strftime/-/strftime-0.10.2.tgz", 14 | "integrity": "sha512-Y6IZaTVM80chcMe7j65Gl/0nmlNdtt+KWPle5YeCAjmsBfw+id2qdaJ5MDrxUq+OmHKab+jHe7mUjU/aNMSZZg==", 15 | "engines": { 16 | "node": ">=0.2.0" 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "strftime": "^0.10.2" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /performance-investigation/.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | *.out -------------------------------------------------------------------------------- /performance-investigation/even-odd/even-odd.sml: -------------------------------------------------------------------------------- 1 | local 2 | fun even' 0 = true 3 | | even' i = odd' (i-1) 4 | and odd' 0 = false 5 | | odd' i = even' (i-1) 6 | in 7 | fun even i = even' (abs i) 8 | fun odd i = odd' (abs i) 9 | end 10 | 11 | structure Main = 12 | struct 13 | fun doit n = 14 | if n = 0 15 | then () 16 | else let 17 | val _ = if (even 500000000) <> not (odd 500000000) 18 | then raise Fail "bug" 19 | else () 20 | in 21 | doit (n - 1) 22 | end 23 | end 24 | 25 | val _ = Main.doit 1 -------------------------------------------------------------------------------- /performance-investigation/even-odd/even-odd.sml.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/performance-investigation/even-odd/even-odd.sml.exe -------------------------------------------------------------------------------- /performance-investigation/even-odd/even-odd.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 偶数乃化整数而爻也。 4 | 奇数乃化整数而爻也。 5 | 6 | 偶数者会数而鉴数而 7 | 有零则阳 8 | 或有「其他」则(奇数于(数减一))也。 9 | 奇数者会数而鉴数而 10 | 有零则阴 11 | 或有「其他」则(偶数于(数减一))也。 12 | 13 | 开始乃化整数而有也。 14 | 开始者会数而 15 | 鉴数而 16 | 有零则元 17 | 或有「其他」则 18 | ( 19 | (若(「爻相等」于(偶数于(500000000))于(非于(奇数于(500000000))))则 20 | 元否则(发生事故于『错误』)); 21 | 开始于(数减一) 22 | ) 23 | 也。 24 | 25 | 26 | 开始于一。 -------------------------------------------------------------------------------- /performance-investigation/fib/.gitignore: -------------------------------------------------------------------------------- 1 | *.out 2 | -------------------------------------------------------------------------------- /performance-investigation/fib/fib.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | int fibonacci(int n) { 6 | if (n <= 1) { 7 | return n; 8 | } 9 | return fibonacci(n - 1) + fibonacci(n - 2); 10 | } 11 | 12 | int main(int argc, char *argv[]) { 13 | if (argc != 2) { 14 | printf("Usage: %s \n", argv[0]); 15 | return 1; 16 | } 17 | 18 | int n = atoi(argv[1]); 19 | if (n < 0) { 20 | printf("n must be a non-negative integer.\n"); 21 | return 1; 22 | } 23 | 24 | int result = fibonacci(n); 25 | printf("The %dth number in the Fibonacci sequence is: %d\n", n, result); 26 | 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /performance-investigation/fib/fib.cmi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/performance-investigation/fib/fib.cmi -------------------------------------------------------------------------------- /performance-investigation/fib/fib.cmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/performance-investigation/fib/fib.cmo -------------------------------------------------------------------------------- /performance-investigation/fib/fib.java: -------------------------------------------------------------------------------- 1 | 2 | public class fib { 3 | public static int fibonacci(int n) { 4 | if (n <= 1) { 5 | return n; 6 | } 7 | return fibonacci(n - 1) + fibonacci(n - 2); 8 | } 9 | 10 | public static void main(String[] args) { 11 | if (args.length != 1) { 12 | System.out.println("Usage: java Fibonacci "); 13 | System.exit(1); 14 | } 15 | 16 | int n = Integer.parseInt(args[0]); 17 | if (n < 0) { 18 | System.out.println("n must be a non-negative integer."); 19 | System.exit(1); 20 | } 21 | 22 | int result = fibonacci(n); 23 | System.out.println("The " + n + "th number in the Fibonacci sequence is: " + result); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /performance-investigation/fib/fib.ml: -------------------------------------------------------------------------------- 1 | let rec fibonacci n = 2 | if n <= 1 then n 3 | else fibonacci (n - 1) + fibonacci (n - 2) 4 | 5 | let () = 6 | match Array.length Sys.argv with 7 | | 2 -> 8 | let n = int_of_string Sys.argv.(1) in 9 | if n < 0 then 10 | print_endline "n must be a non-negative integer." 11 | else 12 | let result = fibonacci n in 13 | Printf.printf "The %dth number in the Fibonacci sequence is: %d\n" n result 14 | | _ -> 15 | Printf.printf "Usage: %s \n" Sys.argv.(0) -------------------------------------------------------------------------------- /performance-investigation/fib/fib.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | def fibonacci(n): 4 | if n <= 1: 5 | return n 6 | return fibonacci(n - 1) + fibonacci(n - 2) 7 | 8 | if len(sys.argv) != 2: 9 | print("Usage: python fibonacci.py ") 10 | sys.exit(1) 11 | 12 | n = int(sys.argv[1]) 13 | if n < 0: 14 | print("n must be a non-negative integer.") 15 | sys.exit(1) 16 | 17 | result = fibonacci(n) 18 | print(f"The {n}th number in the Fibonacci sequence is: {result}") -------------------------------------------------------------------------------- /performance-investigation/fib/fib.sml: -------------------------------------------------------------------------------- 1 | structure Fib = struct 2 | fun fib (n : int) : int = (if n < 2 then n else fib (n-1) + fib (n-2)) 3 | val _ = print (Int.toString (fib (10))) 4 | end 5 | -------------------------------------------------------------------------------- /performance-investigation/fib/fib.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 4 | 斐波那契乃化整数而整数也。 5 | 斐波那契者会数而 6 | 若数小于二 7 | 则数 8 | 否则(斐波那契于(数减一)) 9 | 加(斐波那契于(数减二))也。 10 | 11 | 参数者整数操作之理解整数于(第N个于零于(命令行参数之获取参数于元))也。 12 | 13 | 打印行于『斐波那契数列的第十个数为:』附(整数表示于(斐波那契于参数))。 -------------------------------------------------------------------------------- /performance-investigation/matrix-multiply/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | time_plot 3 | *.png 4 | *.hi 5 | *.exe 6 | -------------------------------------------------------------------------------- /performance-investigation/matrix-multiply/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | yuyan: 4 | yy -c -O3 matrix-multiply.yuyan -o matrix_yuyan_o3.out 5 | 6 | 7 | yuyandebug: 8 | yy -c matrix-multiply.yuyan -o matrix_yuyan.out 9 | 10 | yuyanprofile: 11 | yy -O3 -c matrix-multiply.yuyan -o matrix_yuyan.out --profile 12 | 13 | yuyanprofiledebug: 14 | yy -c matrix-multiply.yuyan -o matrix_yuyan.out --profile 15 | 16 | 17 | 18 | time_plot.out: time_plot.yuyan 19 | yy -c -o time_plot.out $^ 20 | 21 | time : time_plot.out 22 | ./time_plot.out 23 | 24 | sml : matrix-multiply.sml matrix-multiply.mlb 25 | mlton -output matrix_sml.out matrix-multiply.mlb 26 | 27 | hs : matrix-multiply.hs 28 | stack ghc matrix-multiply.hs -- -O 29 | mv matrix-multiply matrix_hs.out 30 | -------------------------------------------------------------------------------- /performance-investigation/matrix-multiply/matrix-multiply.mlb: -------------------------------------------------------------------------------- 1 | $(SML_LIB)/basis/basis.mlb 2 | $(SML_LIB)/smlnj-lib/Util/smlnj-lib.mlb 3 | 4 | matrix-multiply.sml -------------------------------------------------------------------------------- /performance-investigation/matrix-multiply/matrix-multiply.py: -------------------------------------------------------------------------------- 1 | #https://medium.com/swlh/a-performance-comparison-between-c-java-and-python-df3890545f6d 2 | 3 | import random 4 | import time 5 | import sys 6 | 7 | n = 2048 if len(sys.argv) < 2 else int(sys.argv[1]) 8 | 9 | #populate the matrices with random values between 0.0 and 1.0 10 | A = [[random.random() for row in range(n)] for col in range(n)] 11 | B = [[random.random() for row in range(n)] for col in range(n)] 12 | C = [[0 for row in range(n)] for col in range(n)] 13 | 14 | start = time.time() 15 | #matrix multiplication 16 | for i in range(n): 17 | for j in range(n): 18 | for k in range(n): 19 | C[i][j] += A[i][k] * B[k][j] 20 | 21 | end = time.time() 22 | print("%0.6f" % (end-start)) -------------------------------------------------------------------------------- /performance-investigation/matrix-multiply/matrix-multiply.sml.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/performance-investigation/matrix-multiply/matrix-multiply.sml.exe -------------------------------------------------------------------------------- /performance-investigation/quick-sort/quick-sort.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import time 3 | import random 4 | 5 | def quicksort(arr): 6 | if len(arr) <= 1: 7 | return arr 8 | pivot = arr[0] 9 | smaller = [x for x in arr[1:] if x < pivot] 10 | equal = [x for x in arr if x == pivot] 11 | larger = [x for x in arr[1:] if x > pivot] 12 | return quicksort(smaller) + equal + quicksort(larger) 13 | 14 | if __name__ == "__main__": 15 | if len(sys.argv) != 2: 16 | print("Usage: python quicksort.py ") 17 | sys.exit(1) 18 | 19 | n = int(sys.argv[1]) 20 | array = [random.random() for _ in range(n)] 21 | 22 | start_time = time.time() 23 | sorted_array = quicksort(array) 24 | end_time = time.time() 25 | 26 | time_diff = end_time - start_time 27 | print(f"{time_diff:.6f}") 28 | -------------------------------------------------------------------------------- /performance-investigation/quick-sort/quick-sort.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 上限者一零零零零零零零也。 5 | 「: 设 6 | 设矩阵长宽为二零四。 :」 7 | 「列长」者(整数也鉴(命令行参数之获取参数于元)而 8 | 有数衔【】则(理解整数于数) 9 | 或有「其他」则发生事故于『期待一个参数』)也。 10 | 11 | 「: 打印行于『开始:』。 :」 12 | 13 | 开始时间者时间之获取当前纳秒时间于元也。 14 | 15 | 「数列」者(打表授以(整数))于「列长」于(会数而随机之获取随机整数于(上限))也。 16 | 17 | 快排乃化整数列而整数列也。 18 | 快排者会甲而 19 | 鉴甲而 20 | 有【】则【】 21 | 或有头衔尾则 22 | (滤于(会数而数小于头)于尾) 23 | 接(滤于(会数而数等于头)于尾) 24 | 接(滤于(会数而数大于头)于尾)也。 25 | 26 | 快排于「数列」。 27 | 28 | 29 | 结束时间者时间之获取当前纳秒时间于元也。 30 | 总用时纳秒数者「小数操作」之「减」于结束时间于开始时间也。 31 | 总用时秒数者「小数操作」之乘于((总用时纳秒数))于(零点零零零零零零零零一)也。 32 | 33 | 「: 打印行于『总用时纳秒数:』。 34 | 打印行于(整数操作之表示于(总用时纳秒数))。 35 | 打印行于『总用时秒数:』。 :」 36 | 打印行于(「小数操作」之表示于(总用时秒数))。 -------------------------------------------------------------------------------- /performance-investigation/quicksort_test.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | d = {1:"一", 2:"二", 3:"三", 4 | 4:"四",5:"五",6:"六",7:"七",8:"八",9:"九",10:"十"} 5 | 6 | 7 | arr = np.random.randint(1, 10, size=1000) 8 | print("arr=[" + (", " .join([str(x) for x in list(arr)])) + "]") 9 | print("速序于「「" + ("」,「".join([d[x] for x in arr])) + "」,「空」」") -------------------------------------------------------------------------------- /py-interpreter/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ALL_PY_FILES = $(shell find . -name '*.py') 3 | 4 | run_default: ./.yybuild.nosync/py/output.yybcb 5 | make -C ../yybcvm 6 | ../yybcvm/build/native/vm.exe ./.yybuild.nosync/py/output.yybcb 7 | 8 | ./.yybuild.nosync/py/output.yybcb: $(ALL_PY_FILES) 9 | @echo DEPENDS $^ 10 | cd .. && python3 py-interpreter/yybc_compiler.py 豫言编译器/入口。豫 豫言编译器/入口。豫 11 | -------------------------------------------------------------------------------- /py-interpreter/params.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | MULTI_CPU=16 -------------------------------------------------------------------------------- /runtime/common/commandline.c: -------------------------------------------------------------------------------- 1 | #include "common_include.h" 2 | 3 | yy_ptr yyGetCommandLineProgramName(){ 4 | return string_to_addr(global_argv[0]); 5 | } 6 | 7 | 8 | yy_ptr yyGetCommandLineArgs(){ 9 | 10 | if(global_argc < 2){ 11 | yy_ptr elems[] = {}; 12 | return array_to_iso_addr(0, elems); 13 | } 14 | 15 | yy_ptr argPtrString[global_argc - 1]; 16 | 17 | for (int i = 0; i < global_argc - 1; i ++){ 18 | argPtrString[i] = string_to_addr(global_argv[i+1]); 19 | } 20 | 21 | yy_ptr result = array_to_iso_addr(global_argc - 1, argPtrString); 22 | return result; 23 | } -------------------------------------------------------------------------------- /runtime/common/cstdlib/cstdtime.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../common_include.h" 3 | 4 | 5 | #include 6 | 7 | 8 | char * yyGetCurrentLocalDateTimeStr() { 9 | time_t t = time(NULL); 10 | char *result = ctime(&t); 11 | return result; 12 | } 13 | 14 | char * yyGetCurrentLocalDateTimeFmt(char * fmt) { 15 | time_t t = time(NULL); 16 | struct tm *tm = localtime(&t); 17 | int bufsz = strlen(fmt) * 2; 18 | char buffer[bufsz]; 19 | strftime(buffer, bufsz, fmt, tm); 20 | char *result = strdup(buffer); 21 | return result; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /runtime/common/debug.c: -------------------------------------------------------------------------------- 1 | #include "common_include.h" 2 | 3 | yy_ptr yyDebugLog0(char* str){ 4 | return 0; 5 | } 6 | yy_ptr yyDebugLog1(char* str, yy_ptr i1){ 7 | return 0; 8 | } 9 | yy_ptr yyDebugLog2(char* str, yy_ptr i1, yy_ptr i2){ 10 | return 0; 11 | } 12 | yy_ptr yyDebugLog3(char* str, yy_ptr i1, yy_ptr i2, yy_ptr i3){ 13 | return 0; 14 | } -------------------------------------------------------------------------------- /runtime/common/llvm_specific.c: -------------------------------------------------------------------------------- 1 | // #include 2 | 3 | 4 | // char* yy_getDataLayout(){ 5 | // return 6 | // } -------------------------------------------------------------------------------- /runtime/common/platforms/currentPlatform.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | 6 | uint64_t yyRunningOnWindows(){ 7 | #ifdef _WIN32 8 | return true; 9 | #else 10 | return false; 11 | #endif 12 | } 13 | 14 | uint64_t yyRunningOnMacOS(){ 15 | #ifdef __APPLE__ 16 | return true; 17 | #else 18 | return false; 19 | #endif 20 | } 21 | 22 | uint64_t yyRunningOnLinux(){ 23 | #ifdef __linux__ 24 | return true; 25 | #else 26 | return false; 27 | #endif 28 | } -------------------------------------------------------------------------------- /runtime/common/process_exit.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "common_include.h" 4 | 5 | 6 | yy_ptr yyProcessExit(yy_ptr exitStatusAddr){ 7 | int64_t st = addr_to_int(exitStatusAddr); 8 | exit(st); 9 | } -------------------------------------------------------------------------------- /runtime/common/time.c: -------------------------------------------------------------------------------- 1 | 2 | #include "common_include.h" 3 | 4 | // yy_ptr yyCurrentNanosecondTime(){ 5 | // uint64_t currentTime = uv_hrtime(); 6 | // return int_to_addr((int64_t) currentTime); 7 | // } 8 | 9 | yy_ptr yyCurrentNanosecondTime() { 10 | struct timespec time; 11 | clock_gettime(CLOCK_MONOTONIC, &time); 12 | 13 | // Convert seconds and nanoseconds to nanoseconds 14 | int64_t nanoseconds = time.tv_sec * 1000000000 + time.tv_nsec; 15 | 16 | double nanoseconds_double = (double) nanoseconds; 17 | 18 | // Return the nanoseconds 19 | return double_to_addr(nanoseconds_double); 20 | } -------------------------------------------------------------------------------- /runtime/emwasm/emwasm_allocation.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | 6 | // #include "gc.h" 7 | #include "emwasm_include.h" 8 | 9 | yy_ptr yy_gcAllocateArray(uint64_t size) { 10 | yy_ptr x = yy_gcAllocateBytes(size * 8); 11 | return x; 12 | } 13 | 14 | void* yy_gcAllocateBytes(uint64_t size) { 15 | yy_ptr x = GC_MALLOC(size); 16 | // yy_ptr x = malloc(size); // for testing 17 | return x; 18 | } 19 | 20 | void* yy_gcReallocateBytes(void* ptr, uint64_t size) { 21 | yy_ptr x = GC_REALLOC(ptr, size); 22 | // yy_ptr x = malloc(size); // for testing 23 | return x; 24 | } -------------------------------------------------------------------------------- /runtime/emwasm/emwasm_include.h: -------------------------------------------------------------------------------- 1 | #include "../common/common_include.h" 2 | #include "gc.h" // https://hboehm.info/gc/ libgc 3 | -------------------------------------------------------------------------------- /runtime/emwasm/entry_init.c: -------------------------------------------------------------------------------- 1 | 2 | #include "emwasm_include.h" 3 | 4 | 5 | // uv_loop_t *uv_global_loop; 6 | 7 | void optional_entry_initialization(){ 8 | // initialize garbage collection 9 | GC_INIT(); 10 | // GC_enable_incremental(); 11 | // GC_expand_hp(60719476736); // about 60 GB 12 | 13 | 14 | 15 | } -------------------------------------------------------------------------------- /runtime/extra/extra_include.h: -------------------------------------------------------------------------------- 1 | #include "../globalInclude.h" 2 | 3 | 4 | void yy_matlib_createLinePlot( 5 | char *filename, 6 | char *titleStr, 7 | char *xAsixName, 8 | char *yAsixName, 9 | double *xValuesList, 10 | double **ysValuesList, 11 | char **legendList, 12 | int xValueLength, 13 | int yValueLength); 14 | 15 | -------------------------------------------------------------------------------- /runtime/mlton/yylibrary: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/runtime/mlton/yylibrary -------------------------------------------------------------------------------- /runtime/mlton/yylibrary.cm: -------------------------------------------------------------------------------- 1 | Library 2 | 3 | is 4 | yylibrary.sml -------------------------------------------------------------------------------- /runtime/mlton/yylibrary.mlb: -------------------------------------------------------------------------------- 1 | $(SML_LIB)/basis/basis.mlb 2 | $(SML_LIB)/basis/sml-nj.mlb 3 | $(SML_LIB)/smlnj-lib/smlnj-lib.mlb 4 | $(SML_LIB)/smlnj-lib/Util/smlnj-lib.mlb 5 | 6 | 7 | local 8 | ann 9 | "nonexhaustiveMatch ignore" 10 | "allowExtendedTextConsts true" 11 | "allowOrPats true" 12 | "allowFFI true" 13 | in 14 | yylibrary.sml 15 | end 16 | in 17 | 18 | 19 | end -------------------------------------------------------------------------------- /runtime/native/entry_init.c: -------------------------------------------------------------------------------- 1 | 2 | #include "native_include.h" 3 | 4 | 5 | uv_loop_t *uv_global_loop; 6 | 7 | void optional_entry_initialization(){ 8 | // initialize garbage collection 9 | if (use_libgc){ 10 | GC_INIT(); 11 | // GC_enable_incremental(); 12 | #ifdef __linux__ 13 | // GC_expand_hp(60719476736); // about 60G 14 | #endif 15 | } else { 16 | yy_fastgc_init(); // Initialize with 32MB buffer size 17 | } 18 | // initialize uv default loop (can replace) 19 | uv_global_loop = uv_default_loop(); 20 | 21 | 22 | 23 | } -------------------------------------------------------------------------------- /runtime/native/fast_gc.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef YY_FASTGC_H 4 | #define YY_FASTGC_H 5 | 6 | #include 7 | #include 8 | 9 | 10 | void yy_fastgc_init(); 11 | 12 | void* yy_fastgc_malloc(uint64_t size); 13 | 14 | void* yy_fastgc_realloc(void* ptr, uint64_t size); 15 | 16 | #endif /* YY_FASTGC_H */ 17 | -------------------------------------------------------------------------------- /runtime/native/libuv/getcwd.c: -------------------------------------------------------------------------------- 1 | // #include "../native_include.h" 2 | 3 | // #include "limits.h" 4 | 5 | // char* yyGetCurrentWorkingDirectory(){ 6 | // size_t sz = PATH_MAX * sizeof(char); 7 | // char *path_buffer = yy_gcAllocateBytes(sz); 8 | // int err = uv_cwd(path_buffer, &sz); 9 | // if (err != 0){ 10 | // errorAndAbort("Cannot get CWD, SIZE ERROR!!!"); 11 | // } 12 | // return path_buffer; 13 | // } -------------------------------------------------------------------------------- /runtime/native/native_allocation.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | 6 | // #include "gc.h" 7 | #include "native_include.h" 8 | 9 | 10 | yy_ptr yy_gcAllocateArray(uint64_t size) { 11 | yy_ptr x = yy_gcAllocateBytes(size * 8); 12 | return x; 13 | } 14 | 15 | void* yy_gcAllocateBytes(uint64_t size) { 16 | yy_ptr x; 17 | if (use_libgc) 18 | { 19 | x = GC_MALLOC(size); 20 | } else { 21 | x = yy_fastgc_malloc(size); 22 | } 23 | // yy_ptr x = malloc(size); // for testing 24 | return x; 25 | } 26 | 27 | void* yy_gcReallocateBytes(void* ptr, uint64_t size) { 28 | yy_ptr x; 29 | if (use_libgc) 30 | { 31 | x = GC_REALLOC(ptr, size); 32 | } else { 33 | x = yy_fastgc_realloc(ptr, size); 34 | } 35 | // yy_ptr x = malloc(size); // for testing 36 | return x; 37 | } -------------------------------------------------------------------------------- /runtime/native/native_include.h: -------------------------------------------------------------------------------- 1 | #include "../common/common_include.h" 2 | #include "gc.h" // https://hboehm.info/gc/ libgc 3 | #include 4 | 5 | #include "fast_gc.h" 6 | 7 | extern uv_loop_t *uv_global_loop; 8 | 9 | void readStreamUntilEofIntoDataAync(uv_stream_t *stream); -------------------------------------------------------------------------------- /runtime/wasi/wasi_include.h: -------------------------------------------------------------------------------- 1 | #include "../common/common_include.h" 2 | 3 | // #include -------------------------------------------------------------------------------- /runtime/wasm/wasm_allocation.c: -------------------------------------------------------------------------------- 1 | #include "wasm_include.h" 2 | // extern yy_ptr emscripten_allocate(size_t); 3 | 4 | // extern void* array.new(uint64_t size); 5 | 6 | void* yy_gcAllocateBytes(uint64_t size) { 7 | // yy_ptr x = (yy_ptr) EM_ASM_PTR({ 8 | // var byteSize = $0; 9 | // var buffer = new ArrayBuffer(Number(byteSize)); 10 | // return buffer; 11 | // }, size); 12 | yy_ptr x = malloc(size); // TODO: use GC allocate 13 | return x; 14 | } 15 | 16 | yy_ptr yy_gcAllocateArray(uint64_t size) { 17 | // Webassembly GC in proposal, will replace with real thing 18 | // when it is implemented https://webassembly.org/roadmap/ 19 | uint64_t byteSize = size * 8; 20 | return yy_gcAllocateBytes(byteSize); 21 | } 22 | -------------------------------------------------------------------------------- /runtime/wasm/wasm_entry_init.c: -------------------------------------------------------------------------------- 1 | #include "wasm_include.h" 2 | 3 | 4 | void optional_entry_initialization() { 5 | } -------------------------------------------------------------------------------- /runtime/wasm/wasm_include.h: -------------------------------------------------------------------------------- 1 | #include "../common/common_include.h" 2 | 3 | // #include -------------------------------------------------------------------------------- /sml.json: -------------------------------------------------------------------------------- 1 | { 2 | "cm": { 3 | "make/onSave": "runtime/mlton/yylibrary.cm" 4 | } 5 | } -------------------------------------------------------------------------------- /src/build-system/compilation-module.sml: -------------------------------------------------------------------------------- 1 | structure CompilationModule = 2 | struct 3 | open CompilationTokens 4 | (* file path is the key *) 5 | 6 | end -------------------------------------------------------------------------------- /src/build-system/documents-build/rich-text-document-ops.sml: -------------------------------------------------------------------------------- 1 | structure RichTextDocumentOps = 2 | struct 3 | 4 | open RichTextDocument 5 | 6 | 7 | 8 | 9 | end 10 | -------------------------------------------------------------------------------- /src/lsp/language-server.sml: -------------------------------------------------------------------------------- 1 | 2 | structure LanguageServer = struct 3 | 4 | datatype server = Server of CompilationManager.compilationmanager 5 | 6 | type t = server 7 | 8 | fun getCM (server : server) = 9 | case server of (Server cm)=> cm 10 | 11 | end -------------------------------------------------------------------------------- /src/mlton-exec.sml: -------------------------------------------------------------------------------- 1 | Repl.main (); -------------------------------------------------------------------------------- /src/operators/structure/operator-registry.sml: -------------------------------------------------------------------------------- 1 | structure OperatorRegistry = 2 | struct 3 | open Operators 4 | structure Store :DICT =RedBlackDict(structure Key =IntOrdered) 5 | type registry = operator Store.dict 6 | type t = registry 7 | 8 | 9 | fun find(s : registry) (key : int) = Store.lookup s key 10 | fun add(s : registry) (oper : operator) = Store.insert s (getUID oper) oper 11 | fun make(s : operator list) : registry = 12 | foldr( fn (oper, acc) => Store.insert acc (getUID oper) oper) Store.empty s 13 | 14 | 15 | end -------------------------------------------------------------------------------- /src/operators/structure/special-chars.sml: -------------------------------------------------------------------------------- 1 | 2 | 3 | structure SpecialChars = 4 | struct 5 | val leftSingleQuote = UTF8Char.fromString "「" NONE 6 | val rightSingleQuote = UTF8Char.fromString "」" NONE 7 | val leftDoubleQuote = UTF8Char.fromString "『" NONE 8 | val rightDoubleQuote = UTF8Char.fromString "』" NONE 9 | val leftAngledBracket = UTF8Char.fromString "《" NONE 10 | val rightAngledBracket = UTF8Char.fromString "》" NONE 11 | val leftParenthesis = UTF8Char.fromString "(" NONE 12 | val rightParenthesis = UTF8Char.fromString ")" NONE 13 | val colon = UTF8Char.fromString ":" NONE 14 | val period = UTF8Char.fromString "。" NONE 15 | val space = UTF8Char.fromString " " NONE 16 | val newline = UTF8Char.fromString "\n" NONE 17 | val tab = UTF8Char.fromString "\t" NONE 18 | val tilde = UTF8Char.fromString "~" NONE 19 | val slash = UTF8Char.fromString "/" NONE 20 | val pathSeparator = slash 21 | end -------------------------------------------------------------------------------- /src/parser/mixfix-parser.sml: -------------------------------------------------------------------------------- 1 | 2 | 3 | structure MixFixParser 4 | = 5 | struct 6 | 7 | 8 | open Operators 9 | 10 | 11 | 12 | end -------------------------------------------------------------------------------- /src/parser/parse-ast-ops.sml: -------------------------------------------------------------------------------- 1 | structure ParseASTOps = struct 2 | open ParseAST 3 | 4 | 5 | fun opastAppendArg (original : OpAST )(arg : OpAST) : OpAST = 6 | case original of (OpAST (oper, l)) => OpAST(oper, l@[arg]) 7 | | _ => raise Fail "past39" 8 | fun opastPrependArg (arg : OpAST) (original : OpAST ) : OpAST = 9 | case original of (OpAST (oper, l)) => OpAST(oper, arg :: l) 10 | | _ => raise Fail ("past42 : on " ^ PrettyPrint.show_opast arg ^ " and " ^ PrettyPrint.show_opast original) 11 | 12 | end -------------------------------------------------------------------------------- /src/parser/parser-options.sig: -------------------------------------------------------------------------------- 1 | signature PARSER_OPTIONS = 2 | sig 3 | val enableBracketedExpression : bool 4 | end -------------------------------------------------------------------------------- /src/passes/preprocess/preprocessing-ast.sml: -------------------------------------------------------------------------------- 1 | structure PreprocessingAST = struct 2 | 3 | 4 | 5 | type t = OpAST.preprocessAST 6 | 7 | 8 | end 9 | -------------------------------------------------------------------------------- /src/passes/typechecking/type-checking-entry.sml: -------------------------------------------------------------------------------- 1 | structure TypeCheckingEntry = 2 | struct 3 | open TypeCheckingPass 4 | open StaticErrorStructure 5 | 6 | end 7 | -------------------------------------------------------------------------------- /src/ui/repl-debug.sml: -------------------------------------------------------------------------------- 1 | structure ReplDebug = 2 | struct 3 | open CompilationStructure 4 | fun profileLSPTokens(CompilationFile f : compilationfile) (cm : compilationmanager): unit = 5 | let val resJson = SyntaxHighlight.highlightFile (FileResourceURI.make (#fp f)) cm 6 | in LanguageServerMode.sendJSON(resJson) 7 | end 8 | fun showTokens(CompilationFile f : compilationfile) (cm : compilationmanager): unit = 9 | let val tokens = (#tokensInfo f) 10 | in DebugPrint.p (PrettyPrint.show_tokens tokens) end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /src/util/debug-print.sml: -------------------------------------------------------------------------------- 1 | structure DebugPrint = 2 | struct 3 | fun p (s : string) :unit = 4 | (TextIO.output (TextIO.stdErr, s); TextIO.flushOut TextIO.stdErr) 5 | end 6 | -------------------------------------------------------------------------------- /src/util/math-util.sml: -------------------------------------------------------------------------------- 1 | 2 | structure MathUtil = struct 3 | 4 | fun power (base: int) (e : int) = if e = 0 then 1 else base * (power base (e-1)) 5 | end -------------------------------------------------------------------------------- /src/util/ordered.sml: -------------------------------------------------------------------------------- 1 | 2 | structure UTF8CharOrdered 3 | :> ORDERED where type t = UTF8Char.t 4 | = 5 | struct 6 | type t = UTF8Char.t 7 | 8 | val ~= = UTF8Char.~= 9 | infix 4 ~= 10 | val eq : UTF8Char.t * UTF8Char.t -> bool = op ~= 11 | val compare :UTF8Char.t * UTF8Char.t -> order = fn (c1, c2) => 12 | if c1 ~= c2 then EQUAL else 13 | if (UTF8Char.asUTF8WChar c1) < (UTF8Char.asUTF8WChar c2) then LESS else GREATER 14 | end 15 | 16 | 17 | structure UTF8StringOrdered =ListOrdered(structure Ordered=UTF8CharOrdered) 18 | structure StructureNameOrdered =ListOrdered(structure Ordered=UTF8StringOrdered) -------------------------------------------------------------------------------- /src/util/source-location.sml: -------------------------------------------------------------------------------- 1 | 2 | structure SourceLocation = struct 3 | 4 | (* sourcelocation is file path , line, col *) 5 | type sourcelocation = string * int * int 6 | type t = sourcelocation 7 | end 8 | -------------------------------------------------------------------------------- /src/util/source-range.sml: -------------------------------------------------------------------------------- 1 | structure SourceRange = struct 2 | 3 | (* sourcerange is file path , line, col, endLine, endCol *) 4 | datatype sourcerange = StartEnd of string * int * int * int * int 5 | (* | StartLength of string * int * int * int start line col length *) 6 | type t = sourcerange 7 | end -------------------------------------------------------------------------------- /src/util/string-dict.sml: -------------------------------------------------------------------------------- 1 | structure StrDict = SplayDict(structure Key =StringOrdered) 2 | -------------------------------------------------------------------------------- /src/util/unique-id.sml: -------------------------------------------------------------------------------- 1 | structure UID = 2 | struct 3 | val counter : int ref = ref 0 4 | 5 | fun next() : int = 6 | let 7 | val _ = counter := !counter + 1 8 | in 9 | ( 10 | (* print("UID.next is " ^ Int.toString(!counter) ^ " \n"); *) 11 | !counter) 12 | end 13 | 14 | end -------------------------------------------------------------------------------- /src/util/yyon.sml: -------------------------------------------------------------------------------- 1 | structure YYON = struct 2 | (* similar to json structure, but uses UTF8String.t *) 3 | 4 | datatype value 5 | = OBJECT of (UTF8String.t * value) list 6 | | ARRAY of value list 7 | | NULL 8 | | BOOL of bool 9 | | INT of int 10 | | FLOAT of real 11 | | STRING of UTF8String.t 12 | 13 | end -------------------------------------------------------------------------------- /tests/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "yuyan.executablePath": "./../yy" 3 | } -------------------------------------------------------------------------------- /tests/airthmetic/sub-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 5 | 打印行于(整数表示于(六减三))。 6 | 打印行于(整数表示于(整数操作之「减」于六于三))。 7 | -------------------------------------------------------------------------------- /tests/bugs/errsourcerange/hello-world-5.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之笔之书。 2 | 观标准库之笔之书。 3 | 寻标准库之内建类型之书。 4 | 观标准库之内建类型之书。 5 | 6 | 我的打印乃化字符串而有也。 7 | 施我的打印乃为 8 | 9 | 打印行于『天地玄黄宇宙洪荒』。 10 | 11 | -------------------------------------------------------------------------------- /tests/bugs/errsourcerange/具体列。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻多态列之书。 4 | 观多态列之书。 5 | 6 | 寻内建类型之书。 7 | 观内建类型之书。 8 | 9 | 寻整数操作之书。 10 | 11 | 整数列者多态列启以整数也。 12 | 13 | 求和乃化整数列而整数也。 14 | 求和者会列而(多态列之从左折叠授以(整数))于(会甲而会乙而整数操作之加于甲于(乙))于(零)于列也。 -------------------------------------------------------------------------------- /tests/bugs/example-4.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻标准库之书。 3 | 观标准库之书。 4 | 5 | 类甲立元类型也。 6 | 甲一立类甲也。 7 | 8 | 9 | 类乙立元类型也。 10 | 11 | 丙乃类甲列也。 12 | 丙者【甲一】也。 13 | 14 | 丁乃化类甲列而类甲也。 15 | 丁者会戊而鉴戊而 16 | 有【】则发生事故于『发』 17 | 或有己衔【】则己也。 18 | 19 | 庚乃化类甲列而类乙也。 20 | 庚者丁也。「:this should report type errors:」 21 | -------------------------------------------------------------------------------- /tests/bugs/hl/hl-in-comment.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 注 (booleans。 3 | 爻者夫阴表有亦夫阳表有也。 4 | 阳乃爻也。 5 | 阴乃爻也。 6 | 阳者「阳」临元也。 7 | 阴者阴临元也。 8 | )。 -------------------------------------------------------------------------------- /tests/bugs/note.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | (((。。。。。。。。。。。<- when a lot of things follows the unclosed quotes -------------------------------------------------------------------------------- /tests/bugs/多态列重复名称。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 4 | 全部符合乃承乙而化(化乙而(爻))而化乙列而爻也。 5 | 全部符合者会函而会列而((长度于「列」) = (长度于((滤于函于(列)))))也。 6 | 「:列的解析会出问题(bs版本):」 -------------------------------------------------------------------------------- /tests/comments/nested-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 「: 外左 3 | 「: 内 :」 4 | 外右 :」 -------------------------------------------------------------------------------- /tests/comments/nested.success: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/comments/nested.success -------------------------------------------------------------------------------- /tests/contification/cont-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 「:./yy_bs tests/contification/cont-1.yuyan --print-opt-info --do-not-load-cache -fno-const-prop :」 3 | 甲者一也。 4 | 乙者若(《《C调用》》名『yy_豫言不安全转换』传甲)则甲否则甲也。 -------------------------------------------------------------------------------- /tests/data/constructor-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 「: 「〇列」号化元类型而元类型也。 :」 4 | 甲立化元类型而元类型也。 5 | 丙立甲于整数也。 6 | 乙立化整数而化甲于整数而甲于整数也。 7 | 8 | 9 | 丁者乙于一于丙也。 10 | 11 | 打印行于『ok』。 -------------------------------------------------------------------------------- /tests/data/constructor-2.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 寻观constructor-1之书。 3 | 4 | 5 | 戊者乙于一于丙也。 -------------------------------------------------------------------------------- /tests/data/constructor-3.yuyan: -------------------------------------------------------------------------------- 1 | 寻constructor-1之书。 2 | 诵constructor-1之书。 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/data/constructor-4.yuyan: -------------------------------------------------------------------------------- 1 | 寻constructor-3之书。 2 | 诵constructor-3之书。 3 | 4 | 寻观标准库之输入输出之书。 5 | 诵输入输出之书。 6 | -------------------------------------------------------------------------------- /tests/data/constructor-5.yuyan: -------------------------------------------------------------------------------- 1 | 寻观constructor-4之书。 2 | 3 | 4 | 戊者乙于一于丙也。 -------------------------------------------------------------------------------- /tests/dependent/dependent-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 4 | 5 | 自然数立元类型也。 6 | 自零立自然数也。 7 | 自进立化自然数而自然数也。 8 | 9 | 「: 宇宙者元类型也。 :」 10 | 11 | 大己号化自然数而元类型也。 12 | 大己即会数一而 13 | 鉴数一而 14 | 有自零则自然数 15 | 或有自进于「底数」则(自然数合(大己于「底数」))也。 16 | 17 | 壹者自进于自零也。 18 | 19 | 「: 小己乃(化自然数者甲而(大己于甲))也。 20 | 小己者会数而 21 | 鉴数而 22 | 有自零则壹 23 | 或有自进于「底数」则(壹与(小己于「底数」))也。 :」 24 | -------------------------------------------------------------------------------- /tests/example/callcc/callcc-three-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 5 | 甲者((续延之以当前续延调用)授以整数)于(会续而(三))也。 6 | 7 | 打印行于(整数操作之表示于(甲))。 8 | -------------------------------------------------------------------------------- /tests/example/callcc/callcc-three-2.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 甲者((续延之以当前续延调用)授以整数)于(会续而(续授以(整数))于(三))也。 4 | 5 | 打印行于(整数操作之表示于(甲))。 6 | -------------------------------------------------------------------------------- /tests/example/callcc/callcc-three.success: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /tests/example/example-10.yuyan: -------------------------------------------------------------------------------- 1 | 导入并打开标准库。 2 | 3 | 「:定义语法:」 4 | 参数1为〇返回〇的类型是从元类型到从元类型到元类型。 5 | 「参数1为〇返回〇」其实就是遇到了甲随后遇到了乙随后(从甲到乙)。 6 | 函数「参数1为〇返回〇」结合性无序七零零。 7 | 8 | 〇数组的类型是从元类型到元类型。 9 | 「〇数组」其实就是遇到了甲随后「数组引用类」使用于甲。 10 | 函数「〇数组」结合性无序七零零。 11 | 整数数组成员数为〇个的类型是从整数到(「整数」数组)。 12 | 「整数数组成员数为〇个」的定义是遇到了长度随后「新数组引用」使用于长度使用于长度。 13 | 函数「整数数组成员数为〇个」结合性无序七零零。 14 | 〇的第〇个成员的类型是自类到从(类数组)到从整数到类。 15 | 「〇的第〇个成员」的定义是遇到了组随后遇到了索引随后「读数组引用」使用于组使用于索引。 16 | 函数「〇的第〇个成员」结合性无序七零零。 17 | 十的定义是一零。 18 | 19 | 「:示例:」 20 | 「函数1」 的类型是 参数1为 字符串 返回 「整数」。 21 | 「函数1」 的定义是 遇到了参数1随后 22 | 执行如下计算「 23 | 索引 的类型是 整数。 24 | 索引 的定义是 一。 25 | 数组 的类型是 「整数」 数组。 26 | 数组 的定义是 整数数组成员数为 十 个。 27 | 变量 的定义是 「数组」的第索引个成员。 28 | 「返回」 的定义是 二。 29 | 返回。 30 | 」。 31 | 32 | 打印行于『函数1的结果是』附(整数表示使用于(函数1使用于『你好』))。 33 | 34 | 索引 的类型是 整数。 35 | 索引 的定义是 一。 36 | 数组 的类型是 「整数」 数组。 37 | 数组 的定义是 整数数组成员数为 十 个。 38 | 值 的定义是 「数组」的第 索引 个成员。 39 | 「值2」 的定义是 「数组」的第 二 个成员。 40 | -------------------------------------------------------------------------------- /tests/example/example-2.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻观标准库之语言核心之内建类型之书。 4 | 5 | 列立化元类型而元类型也。 6 | 空立(化元类型者甲而列于甲)也。 7 | 多立(化元类型者甲而化甲而化列于甲而列于甲)也。 8 | 列3者列也。 9 | 空3立(化元类型者甲而列3于甲)也。 -------------------------------------------------------------------------------- /tests/example/example-3.yuyan: -------------------------------------------------------------------------------- 1 | 甲乃化《《内建类型:元类型》》而《《内建类型:元类型》》也。 2 | 甲者会甲而甲也。 3 | 4 | 甲子乃化《《内建类型:元类型》》而《《内建类型:元类型》》也。 5 | 甲子者会甲而甲也。 6 | -------------------------------------------------------------------------------- /tests/example/example-4.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻标准库之书。 3 | 观标准库之书。 4 | 5 | 类甲立元类型也。 6 | 甲一立类甲也。 7 | 8 | 9 | 类乙立元类型也。 10 | 11 | 丙乃类甲列也。 12 | 丙者【甲一】也。 13 | 14 | 丁乃化类甲列而类甲也。 15 | 丁者会戊而鉴戊而 16 | 有【】则发生事故于『发』 17 | 或有己衔【】则己也。 18 | 19 | 庚乃化类甲列而类甲也。 20 | 庚者丁也。 21 | -------------------------------------------------------------------------------- /tests/example/example-5.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之数据结构之整数操作之书。 3 | 寻观标准库之输入输出之笔之书。 4 | 5 | 打印行于(虑「。 6 | 整数表示于三 7 | 」)。 -------------------------------------------------------------------------------- /tests/example/example-6.yuyan: -------------------------------------------------------------------------------- 1 | 虑「。三。四」 -------------------------------------------------------------------------------- /tests/example/example-7.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之语言核心之内建类型之书。 2 | 3 | 甲者「 4 | 〇乙乃化元类型而元类型也。 5 | 〇丙〇乃化元类型而元类型也。 6 | 丁〇乃化元类型而元类型也。 7 | 戊乃化元类型而元类型也。 8 | 」也。 -------------------------------------------------------------------------------- /tests/example/example-8.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之语言核心之内建类型之书。 2 | 3 | 甲立化元类型而元类型也。 4 | 乙立(承「元类型」者丙而甲于丙)也。 5 | 6 | 丁乃甲于整数也。 7 | 丁者乙也。 -------------------------------------------------------------------------------- /tests/example/example-9.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 导入并打开标准库中的语言核心中的内建类型。 3 | 导入并打开标准库中的数据结构中的整数操作。 4 | 5 | 二叉树是一种元类型。 6 | 树叶是一种二叉树。 7 | 树节点是一种从整数到从二叉树到从二叉树到二叉树。 8 | 9 | 树高度的类型是从二叉树到整数。 10 | 树高度的定义是递归树高度随后 11 | 遇到了树随后 12 | 分析树随后 13 | 如果是树叶那么零 14 | 或者如果是(树节点使用于节点数使用于左子使用于右子)那么 15 | (「整数最大值」使用于(树高度使用于左子)使用于(树高度使用于右子))。 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/example/example.success: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/example/example.success -------------------------------------------------------------------------------- /tests/example/exception/three-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻标准库之书。 4 | 观标准库之书。 5 | 6 | 「数列」者多授以整数于一一一于(多授以整数于二二二于(空授以(整数)))也。 7 | 8 | 「: 元素者索引异常之尝试于(会癸而第N个授以整数于三于(列))于(会癸而打印行于『捕捉到异常』;三)也。 :」 9 | 元素者尝试运行于(会癸而第N个授以整数于三于「数列」)于(会癸而打印行于『捕捉到异常』;三)也。 10 | 11 | 打印行于(表示于(元素))。 -------------------------------------------------------------------------------- /tests/example/exception/three.success: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /tests/example/exception/uncaught-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻标准库之书。 4 | 观标准库之书。 5 | 6 | 列2者多授以整数于一一一于(多授以整数于二二二于(空授以(整数)))也。 7 | 8 | 元素者第N个授以整数于三于「列2」也。 -------------------------------------------------------------------------------- /tests/example/exception/uncaught.failure: -------------------------------------------------------------------------------- 1 | 索引异常 -------------------------------------------------------------------------------- /tests/example/module/module-1.yuyan: -------------------------------------------------------------------------------- 1 | 甲者「 2 | 乙者一也。 3 | 」也。 4 | -------------------------------------------------------------------------------- /tests/example/module/module-2.yuyan: -------------------------------------------------------------------------------- 1 | 虑「 2 | 乙者一也。 3 | 乙 4 | 」。 5 | -------------------------------------------------------------------------------- /tests/example/module/module-3.yuyan: -------------------------------------------------------------------------------- 1 | 甲者「。。。」也。 2 | -------------------------------------------------------------------------------- /tests/example/module/module.success: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/example/module/module.success -------------------------------------------------------------------------------- /tests/example/ref/three-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 寻标准库之书。 5 | 观标准库之书。 6 | 7 | 整数引用者引用之引用操作授以整数也。 8 | 9 | 操作者整数引用也。 10 | ( 11 | 虑( 12 | 甲者操作之创造于一也。 13 | 操作之写于(一加(操作之读取于(甲)))于甲。 14 | 操作之写于(一加(操作之读取于(甲)))于甲 。 15 | 打印行于(表示于(操作之读取于(甲)))。 16 | ) 17 | )。 18 | -------------------------------------------------------------------------------- /tests/example/ref/three-2.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻标准库之书。 4 | 观标准库之书。 5 | 6 | 整数引用者引用之数组操作授以整数也。 7 | 8 | 操作者整数引用也。 9 | ( 10 | 虑( 11 | 甲者操作之创造于一于三也。 12 | 操作之写于(「减」于一于(操作之读取于(甲)于零))于零于甲。 13 | 操作之写于(一加(操作之读取于(甲)于二))于二于甲 。 14 | 操作之写于(一加(操作之读取于(甲)于二))于二于甲 。 15 | 打印行于(表示于(操作之读取于(甲)于二))。 16 | ) 17 | )。 18 | -------------------------------------------------------------------------------- /tests/example/ref/three-3.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻标准库之书。 4 | 观标准库之书。 5 | 6 | 整数引用者引用之数组操作授以整数也。 7 | 8 | 操作者整数引用也。 9 | 虑( 10 | 甲者操作之创造于一于三也。 11 | 操作之写于(「减」于一于(操作之读取于(甲)于零))于零于甲。 12 | 操作之写于(一加(操作之读取于(甲)于二))于二于甲 。 13 | 结果者(操作之读取于甲于(一))加((操作之读取于甲于(二))加(操作之读取于甲于(零)))也。 14 | 打印行于(表示于(结果))。 15 | ) 16 | 。 17 | -------------------------------------------------------------------------------- /tests/example/ref/three.success: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/example/ref/three.success -------------------------------------------------------------------------------- /tests/example/stackoverflow/overflow-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 恒等乃化整数而整数也。 5 | 恒等者会数而(若数小于零 6 | 则发生事故于『期待正整数』否则( 7 | 若数等于零 8 | 则数 9 | 否则(恒等于(数减一))加一 10 | ) 11 | )也。 12 | 13 | 恒等于一零零零零零零零零。 -------------------------------------------------------------------------------- /tests/next_gen_debug/double/double-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 打印行于(「小数操作」之表示于一点二)。 -------------------------------------------------------------------------------- /tests/next_gen_debug/double/double.success: -------------------------------------------------------------------------------- 1 | 1.2 -------------------------------------------------------------------------------- /tests/next_gen_debug/experimental/avoidance-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 「:Dreyer Phd pp. 79 :」 4 | 5 | 6 | 「: S乃元类型也。 :」 7 | S者「 8 | t乃元类型也。 9 | 」也。 10 | 11 | F即(遇S者X而「 12 | u者X之t也。 13 | v者X之t也。 14 | 」)也。 15 | 16 | G即(遇S者X而「 17 | u者X之t也。 18 | v者u也。 19 | 」)也。 20 | 21 | AppF即F于(S也「t者整数也。」)也。 22 | AppG即G于(S也「t者整数也。」)也。 23 | 24 | 25 | 「:以下需要重新检查:」 26 | 「: 测试乃化(AppF之v)而AppG之v也。 27 | 测试者会甲而甲也。 :」 28 | 29 | -------------------------------------------------------------------------------- /tests/next_gen_debug/func-ref/func-ref-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 函引用乃引用类于(化整数而整数)也。 4 | 函引用者新引用于((化整数而整数)也会甲而发生事故于『未赋值』)也。 5 | 6 | 甲乃化整数而整数也。 7 | 甲者会乙而乙加一也。 8 | 9 | 写引用于「函引用」于甲。 10 | 11 | 打印行于(整数表示于((读引用于「函引用」)于二))。 12 | -------------------------------------------------------------------------------- /tests/next_gen_debug/import/import-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 寻观import-base之书。 4 | 5 | 6 | 打印行于(整数表示于甲)。 -------------------------------------------------------------------------------- /tests/next_gen_debug/import/import-base.yuyan: -------------------------------------------------------------------------------- 1 | 2 | import-base者1也。 3 | 甲者二也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/list/list-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之数据结构之多态列之书。 3 | 寻观标准库之输入输出之笔之书。 4 | 5 | 打印行于『1』。 6 | 打表于二于(会无而二)。 7 | 打印行于『2』。 -------------------------------------------------------------------------------- /tests/next_gen_debug/natural/自然语言列库。豫: -------------------------------------------------------------------------------- 1 | 2 | 导入并打开标准库。 3 | 4 | 对于〇的操作即会类型而(化引用类于类型而引用类于类型)也。 5 | 对于一个名为□的对象做如下操作〇即会操作函数而会对象而(虑无者操作函数于对象而对象)也。 6 | 〇的长度即会「列」而长度于(读引用于「列」)也。 7 | 〇的第〇个即会「列」而会序数而第N个于序数于(读引用于「列」)也。 8 | 让〇为□,然后〇即会参数而会函数而函数于参数也。 9 | 执行〇次以下的操作,在第□次执行〇即会次数而会操作式而打表于次数于操作式也。 10 | 交换〇中序数为〇与〇的位置即会「列引用」而会甲而会乙而 11 | 虑本身者读引用于「列引用」而 12 | 虑暂存者第N个于甲于本身而 13 | 虑身2者更新第N个于甲于(会无而(第N个于乙于本身))于本身而 14 | 虑身3者更新第N个于乙于(会无而暂存)于身2而 15 | 虑无者写引用于「列引用」于身3而 16 | 元也。 17 | 不做任何事即元也。 18 | 打印数列即会「列引用」而『【』附(以『,』合并(态射于(读引用于「列引用」)))附『】』也。 19 | 20 | 冒泡排序的类型是对于数列的操作。 21 | 冒泡排序的定义是对于一个名为L的对象做如下操作 22 | ( 23 | (让L的长度为l,然后( 24 | 执行l次以下的操作,在第i次执行( 25 | 执行l-1次以下的操作,在第j次执行( 26 | 如果(L的第j个)大于(L的第j+1个) 27 | 那么(交换L中序数为j与j+1的位置) 28 | 否则不做任何事 29 | ) 30 | ) 31 | ) 32 | ) 33 | )。 34 | 35 | 打印数列于(冒泡排序于(新引用于【2,3,1,5】))。 -------------------------------------------------------------------------------- /tests/next_gen_debug/number/number-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 零点零一。 -------------------------------------------------------------------------------- /tests/next_gen_debug/parse/parse-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之数据结构之多态列之书。 3 | 4 | (虑乙者「甲」列而乙)。 5 | 6 | 【一】接【】。 -------------------------------------------------------------------------------- /tests/next_gen_debug/parse/parse-2.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 5 | (虑输出者操作系统之子进程之获取输出于『clang』于【『-dumpmachine』】 6 | 而输出之标准输出)。 -------------------------------------------------------------------------------- /tests/next_gen_debug/parse/parse-3.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 5 | (虑输出者操作系统之子进程之获取输出于『clang』于【『-dumpmachine』】 6 | 而输出之标准输出)。 -------------------------------------------------------------------------------- /tests/next_gen_debug/parse/parse-4.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之语言核心之内建类型之书。 2 | 3 | 4 | 甲立元类型也。 5 | 6 | (虑甲物者甲而(元;甲物))。 7 | -------------------------------------------------------------------------------- /tests/next_gen_debug/parse/parse-5.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 串者字符串也。 4 | 5 | (虑串名者「下个字符序数」于『字符串』而 6 | (「写出」于( 7 | 「字符串声明」于串名于「串」 8 | 「: 『@"』附(串名)附『" = private constant [』附(整数表示于((字节长度于串)加一))附(『 x i8 ] c"』)附 9 | 串附『\00"』 :」 10 | ) 11 | ; 12 | (「默认返回」于『bitcast 』附(「字符串声明类型」于串)附(『* @"』)附串名附(『" to i64*』)))) -------------------------------------------------------------------------------- /tests/next_gen_debug/parse/parse-6.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 寻观标准库之数据结构之多态列之书。 4 | 5 | 甲乃化有而整数列列列列 列列列列 列列也。 6 | 甲者会无而 【【【【 【【【【 【【一,二,三,四】】 】】】】 】】】】也。 7 | 「: 甲者会无而无有也。 :」 8 | -------------------------------------------------------------------------------- /tests/next_gen_debug/parse/parse-7.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 函数甲立元类型也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 4 | 丙立元类型也。 5 | 甲立化整数而化整数而丙也。 6 | 名立元类型也。 7 | 乙乃化丙而整数也。 8 | 乙者会物而 9 | 鉴物而 10 | 有甲于「符名」于结则(符名)也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-10.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 5 | 甲者「 6 | 乙立元类型也。 7 | 丙立乙也。 8 | 」也。 9 | 观甲之书。 10 | 11 | 12 | 庚乃(乙合乙)列也。 13 | 庚者(丙与丙)衔(丙与丙)衔【】也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-11.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 5 | 甲即「 6 | 乙立元类型也。 7 | 丙立乙也。 8 | 」也。 9 | 观甲之书。 10 | 11 | 12 | 庚乃化(乙合乙)列而有也。 13 | 庚者会戊而 14 | 鉴戊而 15 | 有((丙与丙)衔【】)则元也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-12.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 5 | 甲者「 6 | 乙号元类型也。 7 | 乙立元类型也。 8 | 丙号乙也。 9 | 丙立乙也。 10 | 」也。 11 | 观甲之书。 12 | 13 | 14 | 庚乃化(乙合乙)列而有也。 15 | 庚者会戊而 16 | 鉴戊而 17 | 有((丙与丙)衔【】)则元也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-13.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 5 | 甲者「 6 | 乙立元类型也。 7 | 丙立乙也。 8 | 」也。 9 | 观甲之书。 10 | 11 | 12 | 辛者「 13 | 观甲之书。 14 | 15 | 庚乃化甲之乙列而有也。 16 | 庚者会戊而 17 | 鉴戊而 18 | 有((丙)衔【】)则元也。 19 | 20 | 」也。 21 | -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-14.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 5 | 甲者「 6 | 乙立元类型也。 7 | 丙立乙也。 8 | 」也。 9 | 观甲之书。 10 | 11 | 12 | 辛者「 13 | 观甲之书。 14 | 15 | 庚乃化(或可有(甲之乙))而有也。 16 | 庚者会戊而 17 | 鉴戊而 18 | 有(「可无」)则元也。 19 | 20 | 」也。 21 | 22 | 壬乃 ((或可有字符串)合(或可有字符串))列也。 23 | 壬者【可无与可无】也。 24 | 25 | 壬2乃 ((或可有字符串))也。 26 | 壬2者可无也。 27 | 28 | 壬3乃 ((或可有字符串))列也。 29 | 壬3者【可无】也。 30 | 31 | 「: 癸乃 化((或可有字符串)合(或可有字符串))列而有也。 32 | 癸者会甲而鉴甲而 33 | 有(可无与可无)衔【】则元也。 34 | 35 | 癸2乃 化((或可有字符串))而有也。 36 | 癸2者会甲而鉴甲而 37 | 有(可无)则元也。 :」 -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-15.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之数据结构之可选值之书。 3 | 4 | 5 | 甲者会乙而 6 | 鉴乙而 7 | 有「可无」则「可无」也。 8 | -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-16.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之数据结构之可选值之书。 3 | 4 | 5 | 甲者会乙而 6 | 鉴乙而 7 | 有「可无」则「可无」也。 8 | 9 | 「:这个其实是一个bug,c.f. ML的Let-bound polymorphism:」 10 | 甲于可有『附』。 11 | 甲于可有二。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-2.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 寻观标准库之语言核心之内建类型之书。 5 | 寻观标准库之数据结构之可选值之书。 6 | 7 | 列立化元类型而元类型也。 8 | 「〇列」即列也。 9 | 术〇列交左序七零零也。 10 | 术列交无序七零零也。 11 | 空立(承元类型者「甲」而甲列)也。 12 | 多立(承元类型者「甲」而化甲而化甲列而甲列)也。 13 | 「〇衔〇」即多也。 14 | 术〇衔〇交右序七零零也。 15 | 16 | 17 | 【】即空也。 18 | 术【】交无序七一零也。 19 | 20 | 「: 乘乃化整数而化整数而整数也。 21 | 乘者会甲而会乙而《《C调用》》名『yyIntMult』传甲与乙也。 :」 22 | 23 | 「: 注 list map。 :」 24 | 「: 态射乃(承元类型者「甲」而承乙而化「化甲而「乙」」而化甲列而列于乙)也。 25 | 态射者循态射以 26 | 会射而(会列而「鉴列而 27 | 有空则空 28 | 或有头衔尾则 29 | ((射于(头))衔「态射于射于(尾)」 ) 30 | 」)也。 :」 31 | 滤出可有乃承甲而化(或可有甲)列而甲列也。 32 | 滤出可有者循滤出可有以会列而鉴列而 33 | 有【】则【】 34 | 或有(可有素)衔尾则(素)衔(「滤出可有」于尾) 35 | 或有「可无」衔尾则(「滤出可有」于尾)也。 36 | 37 | -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-3.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 寻观标准库之语言核心之内建类型之书。 5 | 寻标准库之数据结构之可选值之书。 6 | 7 | 列立化元类型而元类型也。 8 | 「〇列」即列也。 9 | 术〇列交左序七零零也。 10 | 术列交无序七零零也。 11 | 空立(承元类型者「甲」而甲列)也。 12 | 多立(承元类型者「甲」而化甲而化甲列而甲列)也。 13 | 「〇衔〇」即多也。 14 | 术〇衔〇交右序七零零也。 15 | 16 | 17 | 【】即空也。 18 | 术【】交无序七一零也。 19 | 20 | 「: 乘乃化整数而化整数而整数也。 21 | 乘者会甲而会乙而《《C调用》》名『yyIntMult』传甲与乙也。 :」 22 | 23 | 24 | 「: 注 list map。 :」 25 | 「: 态射乃(承元类型者「甲」而承乙而化「化甲而「乙」」而化甲列而列于乙)也。 26 | 态射者循态射以 27 | 会射而(会列而「鉴列而 28 | 有空则空 29 | 或有头衔尾则 30 | ((射于(头))衔「态射于射于(尾)」 ) 31 | 」)也。 :」 32 | 滤出可有乃承甲而化(可选值之「或可有〇」于甲)列而甲列也。 33 | 滤出可有者循滤出可有以会列而鉴列而 34 | 有【】则【】 35 | 或有((可选值之「可有〇」)于素)衔尾则(素)衔(「滤出可有」于尾) 36 | 或有「可无」衔尾则(「滤出可有」于尾)也。 37 | 38 | -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-4.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 甲立元类型也。 4 | 5 | 鉴甲而有(『非』于乙)则甲。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-5.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 甲者一也。 4 | 5 | 乙乃化整数而整数也。 6 | 乙者会数而数也。 7 | 8 | 鉴甲而 9 | 有一则 10 | (若阳则 11 | (鉴甲而 12 | 有一则乙于三) 13 | 否则 14 | (鉴甲而 15 | 有一则(若阳则 16 | (鉴甲而 17 | 有一则乙于三) 18 | 否则 19 | (鉴甲而 20 | 有一则乙于三) 21 | )) 22 | ) 23 | 或有二则乙于三。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-6.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 甲者一也。 4 | 5 | 鉴甲而 6 | 有一则 7 | (若阳则 8 | (鉴甲而 9 | 有一则三) 10 | 否则 11 | (鉴甲而 12 | 有一则三) 13 | )。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-7.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 4 | 甲立元类型也。 5 | 6 | 乙立化甲而甲也。 7 | 8 | 丙乃化甲而甲也。 9 | 丙者会物而鉴物而 10 | 有乙于物二则物二 也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-8.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 5 | 甲者「 6 | 乙立元类型也。 7 | 丙立乙也。 8 | 」也。 9 | 10 | 11 | 丁乃化甲之乙列而有也。 12 | 丁者会戊而 13 | 鉴戊而 14 | 有甲之丙衔【】则元也。 15 | 16 | 17 | 己乃化甲之乙而有也。 18 | 己者会戊而 19 | 鉴戊而 20 | 有甲之丙则元也。 21 | 22 | 23 | 庚乃化(甲之乙合甲之乙)列而有也。 24 | 庚者会戊而 25 | 鉴戊而 26 | 有((甲之丙与甲之丙)衔【】)则元也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pattern/pattern-9.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 5 | 甲者「 6 | 乙立元类型也。 7 | 丙立乙也。 8 | 」也。 9 | 观甲之书。 10 | 11 | 12 | 庚乃化(乙合乙)列而有也。 13 | 庚者会戊而 14 | 鉴戊而 15 | 有((丙与丙)衔【】)则元也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pwd/pwd-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 打印行于(文件系统之获取当前路径于元)。 -------------------------------------------------------------------------------- /tests/next_gen_debug/pwd/pwd.success: -------------------------------------------------------------------------------- 1 | /yuyan -------------------------------------------------------------------------------- /tests/next_gen_debug/recursion/rec-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 递归乃化整数而有也。 5 | 递归者会数而 6 | (虑「 7 | 打印行于(整数表示于数)。 8 | 「: 若数大于零则 9 | (递归于(数减一)) 否则元。 :」 10 | 」)也。 11 | 12 | 13 | 递归于二。 -------------------------------------------------------------------------------- /tests/next_gen_debug/recursion/rec-2.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 递归乃化整数而有也。 5 | 递归者循递归以会数而 6 | 虑无者打印行于(整数表示于数)而 7 | 若数大于零则 8 | (递归于(数减一)) 否则元 9 | 也。 10 | 11 | 12 | 递归于二。 -------------------------------------------------------------------------------- /tests/next_gen_debug/recursion/rec-3.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 递归乃有也。 5 | 递归者 6 | (虑「 7 | 打印行于(整数表示于二)。 8 | 」)也。 9 | 10 | 11 | 「: 递归于三。 :」 -------------------------------------------------------------------------------- /tests/next_gen_debug/recursion/rec-4.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 「: 递归乃有也。 :」 5 | 递归者 6 | (虑「 7 | 打印行于(整数表示于二)。 8 | 元。 9 | 」)也。 10 | 11 | 12 | 「: 递归于三。 :」 -------------------------------------------------------------------------------- /tests/next_gen_debug/recursion/rec-5.yuyan: -------------------------------------------------------------------------------- 1 | 字符串者「《《内建类型:字符串》》」也。 2 | 整数者「《《内建类型:整数》》」也。 3 | 小数者「《《内建类型:小数》》」也。 4 | 动态分类值者「《《内建类型:动态分类值》》」也。 5 | 「有」者「《《内建类型:有》》」也。 6 | 「: 无者「《《内建类型:无》》」也。 :」 7 | 爻者「《《内建类型:爻》》」也。 8 | 元类型者「《《内建类型:元类型》》」也。 9 | 类型者「《《内建类型:元类型》》」也。 10 | 阳者「《《内建爻:阳》》」也。 11 | 阴者「《《内建爻:阴》》」也。 12 | 元者「《《内建有:元》》」也。 13 | 14 | 15 | 打印行乃化字符串而有也。 16 | 打印行者会串而《《C调用》》名『yyPrintln』传串也。 17 | 18 | 「整数表示」乃化整数而字符串也。 19 | 「整数表示」者会甲而《《C调用》》名『yyIntToString』传甲也。 20 | 21 | 递归者 22 | (虑「 23 | 打印行于(整数表示于二)。 24 | 元。 25 | 」)也。 26 | 27 | -------------------------------------------------------------------------------- /tests/next_gen_debug/shell/shell-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 打印行于『开始』。 5 | 子进程之成功运行并打印结果于『sleep』于【『10』】。 -------------------------------------------------------------------------------- /tests/next_gen_debug/sig-conv/type-as-value.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之语言核心之内建类型之书。 2 | 甲立元类型也。 3 | 4 | 乙者化甲而甲也。 5 | 丙者甲合甲也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/simple/simple-1.yuyan: -------------------------------------------------------------------------------- 1 | 甲者一也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/structure/struct-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 结构语法者「 4 | 5 | 语法分析树立元类型也。 6 | 7 | 「: 注;空白文件。 :」 8 | 「: 注:使用句号分隔。 :」 9 | 连续语句立化语法分析树列而语法分析树也。 10 | 11 | 12 | 」也。 13 | 14 | 15 | 我。 16 | 「: 结构语法表示者「 17 | 观结构语法之书。 18 | 表示乃化结构语法之语法分析树而字符串也。 19 | 表示者循表示以(会树而 20 | 虑递归者表示而 21 | 鉴树而 22 | 有连续语句于句们则(『(连续语句:』附(以『。「:换行:」』合并(态射于递归于「句们」))附『)』) 23 | 或有「其他」则发生事故于『未有41』) 24 | 也。 25 | 26 | 」也。 :」 27 | -------------------------------------------------------------------------------- /tests/next_gen_debug/structure/struct-2.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 元类型者「《《内建类型:元类型》》」也。 3 | 4 | 「〇列」立化元类型而元类型也。 5 | 6 | 结构语法者「 7 | 8 | 语法分析树立元类型也。 9 | 10 | 连续语句立化语法分析树列而语法分析树也。 11 | 12 | 」也。 13 | 14 | 15 | 我。 -------------------------------------------------------------------------------- /tests/next_gen_debug/structure/struct-3.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 甲者三也。 3 | 4 | 乙者「 5 | 甲者三点二也。 6 | 」也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/structure/struct-4.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 整数者三也。 3 | 寻观标准库之语言核心之内建类型之书。 4 | 整数者三点二也。 5 | 乙者「 6 | 甲者三点二也。 7 | 」也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/structure/struct-5.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 整数者三也。 3 | 整数者三点二也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/tuple/tuple-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 甲乃整数合整数合整数也。 5 | 甲者一与二与三也。 6 | 7 | 8 | 打印行于(整数表示于甲中二)。 -------------------------------------------------------------------------------- /tests/next_gen_debug/tuple/tuple-paren-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 4 | 5 | 甲乃化(整数合(整数合整数))而(整数合整数合整数)也。 6 | 甲者会乙而乙也。 7 | -------------------------------------------------------------------------------- /tests/next_gen_debug/tuple/tuple-paren.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/next_gen_debug/tuple/tuple-paren.failure -------------------------------------------------------------------------------- /tests/next_gen_debug/tuple/tuple.success: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /tests/next_gen_debug/write-file/write-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之语言核心之内建类型之书。 2 | 寻观标准库之操作系统之文件系统之书。 3 | 寻观标准库之数据结构之字符串术之书。 4 | 寻观标准库之数据结构之多态列之书。 5 | 寻观标准库之语言核心之引用之书。 6 | 7 | 8 | 乙者新引用于『乙』也。 9 | 10 | 函乃化字符串而字符串也。 11 | 函者会甲而读引用于乙也。 12 | 文件系统之写文件于『测试文件.txt』于((函于『A』)附『AB「「:换行:」』附(以『「:换行:」』合并(【『1』,『2』】)))。 -------------------------------------------------------------------------------- /tests/next_gen_debug/去科里化/opt-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 5 | 函甲乃化爻而化爻而整数也。 6 | 函甲者会乙而会丁而 7 | 若(乙且丁) 8 | 则(三) 9 | 否则(函甲于乙于丁)也。 10 | 「:测试: 目前的去柯里化可能把这个函数优化成死循环,因为递归变量是在一开始展开的:」 11 | 12 | 打印行于(整数表示于(函甲于阳于阳))。 13 | 14 | -------------------------------------------------------------------------------- /tests/next_gen_debug/重复定义/重复定义-1。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 甲乃《《内建类型:整数》》也。 4 | 甲者一也。 5 | 甲者二也。 -------------------------------------------------------------------------------- /tests/next_gen_debug/重复定义/重复定义-2。豫: -------------------------------------------------------------------------------- 1 | 2 | 字符串即「《《内建类型:字符串》》」也。 3 | 「有」者「《《内建类型:有》》」也。 4 | 打印行乃化字符串而有也。 5 | 打印行者会串而《《C调用》》名『yyPrintln』传串也。 6 | 7 | 乙者「 8 | 9 | 甲乃字符串也。 10 | 甲者『一』也。 11 | 甲者『二』也。 12 | 」也。 13 | 14 | 观乙之书。 15 | 16 | 打印行于甲。 -------------------------------------------------------------------------------- /tests/optimizer/opt-1.yuyan: -------------------------------------------------------------------------------- 1 | 虑「 2 | 3 | 4 | 小数即「《《内建类型:小数》》」也。 5 | 字符串即「《《内建类型:字符串》》」也。 6 | 「有」即「《《内建类型:有》》」也。 7 | 8 | 9 | 打印行乃化字符串而有也。 10 | 打印行者会串而《《C调用》》名『yyPrintln』传串也。 11 | 12 | 乘乃化小数而化小数而小数也。 13 | 乘者会甲而会乙而《《C调用》》名『yyDoubleMult』传甲与乙也。 14 | 15 | 表示乃化小数而字符串也。 16 | 表示者会甲而《《C调用》》名『yyDoubleToString』传甲也。 17 | 18 | 19 | 打印行于(表示于(乘于「一点二」于三点四))。 20 | 」 -------------------------------------------------------------------------------- /tests/optimizer/opt-2.yuyan: -------------------------------------------------------------------------------- 1 | 虑「 2 | 3 | 4 | 整数即「《《内建类型:整数》》」也。 5 | 爻即「《《内建类型:爻》》」也。 6 | 字符串即「《《内建类型:字符串》》」也。 7 | 「有」即「《《内建类型:有》》」也。 8 | 9 | 等乃化整数而化整数而爻也。 10 | 等者「《《内建函数:整数:相等》》」也。 11 | 12 | 〇等于〇乃化整数而化整数而爻也。 13 | 「〇等于〇」者等也。 14 | 术〇等于〇交无序七零零也。 15 | 16 | 17 | 18 | 加乃化整数而化整数而整数也。 19 | 加者会甲而会乙而《《C调用》》名『yyIntAdd』传甲与乙也。 20 | 21 | 〇+〇乃化整数而化整数而整数也。 22 | 「〇+〇」者加也。 23 | 术〇+〇交左序七零零也。 24 | 25 | 〇加〇乃化整数而化整数而整数也。 26 | 「〇加〇」者加也。 27 | 术〇加〇交左序七零零也。 28 | 29 | 减乃化整数而化整数而整数也。 30 | 减者「《《内建函数:整数:减》》」也。 31 | 32 | 〇减〇乃化整数而化整数而整数也。 33 | 「〇减〇」者减也。 34 | 术〇减〇交左序七零零也。 35 | 36 | 37 | 表示乃化整数而字符串也。 38 | 表示者会甲而《《C调用》》名『yyIntToString』传甲也。 39 | 40 | 41 | 打印行乃化字符串而有也。 42 | 打印行者会串而《《C调用》》名『yyPrintln』传串也。 43 | 44 | 45 | 计算乃化整数而整数也。 46 | 计算者会数而若数等于零则数否则数加(计算于数减一)也。 47 | 48 | 打印行于(表示于(计算于「一零」))。 49 | 50 | 」 -------------------------------------------------------------------------------- /tests/optimizer/opt-3.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 3 | 小数即「《《内建类型:小数》》」也。 4 | 5 | 乘乃化小数而化小数而小数也。 6 | 乘者会甲而会乙而《《C调用》》名『yyDoubleMult』传甲与乙也。 7 | 8 | 乘。 -------------------------------------------------------------------------------- /tests/optimizer/opt-4.yuyan: -------------------------------------------------------------------------------- 1 | 虑「 2 | 3 | 4 | 整数即「《《内建类型:整数》》」也。 5 | 爻即「《《内建类型:爻》》」也。 6 | 字符串即「《《内建类型:字符串》》」也。 7 | 「有」即「《《内建类型:有》》」也。 8 | 元即「《《内建有:元》》」也。 9 | 10 | 等乃化整数而化整数而爻也。 11 | 等者「《《内建函数:整数:相等》》」也。 12 | 13 | 〇等于〇乃化整数而化整数而爻也。 14 | 「〇等于〇」者等也。 15 | 术〇等于〇交无序七零零也。 16 | 17 | 18 | 19 | 加乃化整数而化整数而整数也。 20 | 加者会甲而会乙而《《C调用》》名『yyIntAdd』传甲与乙也。 21 | 22 | 〇+〇乃化整数而化整数而整数也。 23 | 「〇+〇」者加也。 24 | 术〇+〇交左序七零零也。 25 | 26 | 〇加〇乃化整数而化整数而整数也。 27 | 「〇加〇」者加也。 28 | 术〇加〇交左序七零零也。 29 | 30 | 减乃化整数而化整数而整数也。 31 | 减者「《《内建函数:整数:减》》」也。 32 | 33 | 〇减〇乃化整数而化整数而整数也。 34 | 「〇减〇」者减也。 35 | 术〇减〇交左序七零零也。 36 | 37 | 38 | 表示乃化整数而字符串也。 39 | 表示者会甲而《《C调用》》名『yyIntToString』传甲也。 40 | 41 | 42 | 打印行乃化字符串而有也。 43 | 打印行者会串而《《C调用》》名『yyPrintln』传串也。 44 | 45 | 46 | 计算乃化有而化有而化有而化有而化有而化有而化整数而整数也。 47 | 计算者会无而会无而会无而会无而会无而会无而会数而若数等于零则数否则数加(计算于无于无于无于无于无于无于数减一)也。 48 | 49 | 打印行于(表示于(计算于元于元于元于元于元于元于「一零」))。 50 | 51 | 」 -------------------------------------------------------------------------------- /tests/optimizer/opt-5.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 计算乃化有而化有而化有而化有而化有而化有而化整数而整数也。 4 | 计算者会无而会无而会无而会无而会无而会无而会数而若数等于零则数否则数加(计算于无于无于无于无于无于无于数减一)也。 5 | 6 | 打印行于(表示于(计算于元于元于元于元于元于元于「一零」))。 -------------------------------------------------------------------------------- /tests/optimizer/opt-6.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 小数即「《《内建类型:小数》》」也。 3 | 字符串即「《《内建类型:字符串》》」也。 4 | 「有」即「《《内建类型:有》》」也。 5 | 6 | 7 | 打印行乃化字符串而有也。 8 | 打印行者会串而《《C调用》》名『yyPrintln』传串也。 9 | 10 | 表示乃化小数而字符串也。 11 | 表示者会甲而《《C调用》》名『yyDoubleToString』传甲也。 12 | 13 | 14 | 甲者表示于「一点二」也。 15 | 乙者表示于「三点四」也。 16 | 打印行于(甲)。 17 | 打印行于乙。 18 | -------------------------------------------------------------------------------- /tests/optimizer/opt-7.yuyan: -------------------------------------------------------------------------------- 1 | 虑「 2 | 3 | 4 | 整数即「《《内建类型:整数》》」也。 5 | 爻即「《《内建类型:爻》》」也。 6 | 字符串即「《《内建类型:字符串》》」也。 7 | 「有」即「《《内建类型:有》》」也。 8 | 元即「《《内建有:元》》」也。 9 | 10 | 等乃化整数而化整数而爻也。 11 | 等者「《《内建函数:整数:相等》》」也。 12 | 13 | 〇等于〇乃化整数而化整数而爻也。 14 | 「〇等于〇」者等也。 15 | 术〇等于〇交无序七零零也。 16 | 17 | 18 | 19 | 加乃化整数而化整数而整数也。 20 | 加者会甲而会乙而《《C调用》》名『yyIntAdd』传甲与乙也。 21 | 22 | 〇+〇乃化整数而化整数而整数也。 23 | 「〇+〇」者加也。 24 | 术〇+〇交左序七零零也。 25 | 26 | 〇加〇乃化整数而化整数而整数也。 27 | 「〇加〇」者加也。 28 | 术〇加〇交左序七零零也。 29 | 30 | 减乃化整数而化整数而整数也。 31 | 减者「《《内建函数:整数:减》》」也。 32 | 33 | 〇减〇乃化整数而化整数而整数也。 34 | 「〇减〇」者减也。 35 | 术〇减〇交左序七零零也。 36 | 37 | 38 | 表示乃化整数而字符串也。 39 | 表示者会甲而《《C调用》》名『yyIntToString』传甲也。 40 | 41 | 42 | 打印行乃化字符串而有也。 43 | 打印行者会串而《《C调用》》名『yyPrintln』传串也。 44 | 45 | 46 | 甲者「 47 | 48 | 计算乃化整数而整数也。 49 | 计算者会数而若数等于零则数否则数加(计算于数减一)也。 50 | 」也。 51 | 52 | 观甲之书。 53 | 54 | 打印行于(表示于(计算于「一零」))。 55 | 56 | 」 -------------------------------------------------------------------------------- /tests/optimizer/opt-rec-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之语言核心之内建类型之书。 2 | 3 | 甲乃整数也。 4 | 甲者(甲;一)也。 5 | 「:这个需要调查,究竟甲的值是一还是多少?:」 -------------------------------------------------------------------------------- /tests/prim/fib-1.yuyan: -------------------------------------------------------------------------------- 1 | 「:用来debug 代码生成:」 2 | 整数即「《《内建类型:整数》》」也。 3 | 字符串者「《《内建类型:字符串》》」也。 4 | 「有」者「《《内建类型:有》》」也。 5 | 6 | 7 | 打印行乃化字符串而有也。 8 | 打印行者会串而《《C调用》》名『yyPrintln』传串也。 9 | 10 | 11 | 加乃化整数而化整数而整数也。 12 | 加者会甲而会乙而《《C调用》》名『yyIntAdd』传甲与乙也。 13 | 14 | 减乃化整数而化整数而整数也。 15 | 减者「《《内建函数:整数:减》》」也。 16 | 17 | 整数表示乃化整数而字符串也。 18 | 整数表示者会甲而《《C调用》》名『yyIntToString』传甲也。 19 | 20 | 斐氏数乃化整数而整数也。 21 | 斐氏数者会数而鉴数而有 22 | 零则零 23 | 或有一则一 24 | 或有其他则(加于(斐氏数于(减于数于一))于(斐氏数于(减于数于二)))也。 25 | 26 | 打印行于(整数表示于(斐氏数于一零))。 27 | 28 | -------------------------------------------------------------------------------- /tests/prim/fib-2.yuyan: -------------------------------------------------------------------------------- 1 | 「: 用来debug 代码生成 2 | 整数即「《《内建类型:整数》》」也。 3 | 字符串者「《《内建类型:字符串》》」也。 4 | 「有」者「《《内建类型:有》》」也。 5 | 6 | 7 | 打印行乃化字符串而有也。 8 | 打印行者会串而《《C调用》》名『yyPrintln』传串也。 9 | 10 | 11 | 加乃化整数而化整数而整数也。 12 | 加者会甲而会乙而《《C调用》》名『yyIntAdd』传甲与乙也。 13 | 14 | 减乃化整数而化整数而整数也。 15 | 减者「《《内建函数:整数:减》》」也。 16 | 17 | 整数表示乃化整数而字符串也。 18 | 整数表示者会甲而《《C调用》》名『yyIntToString』传甲也。 19 | 20 | 斐氏数乃化整数而整数也。 21 | 斐氏数者会数而鉴数而有 22 | 零则零 23 | 或有一则一 24 | 或有其他则(加于(斐氏数于(减于数于一))于(斐氏数于(减于数于二)))也。 :」 25 | 26 | 「: 打印行于(整数表示于(斐氏数于三))。 :」 27 | 28 | 甲乃化「《《内建类型:有》》」而「《《内建类型:有》》」也。 29 | 30 | 甲者会物而甲于物也。 31 | 32 | 甲于「《《内建有:元》》」。 -------------------------------------------------------------------------------- /tests/stdlib/builtin/builtin-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 甲立元类型也。 -------------------------------------------------------------------------------- /tests/stdlib/builtin/builtin-2.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 甲立元类型也。 -------------------------------------------------------------------------------- /tests/stdlib/builtin/builtin.success: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/stdlib/builtin/builtin.success -------------------------------------------------------------------------------- /tests/stdlib/builtin/prod-one-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 甲乃整数合整数也。 4 | 甲者三与一也。 5 | 6 | 打印行于(整数操作之表示于(甲中一))。 7 | 8 | -------------------------------------------------------------------------------- /tests/stdlib/builtin/prod-one.success: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /tests/stdlib/builtin/prod-three-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 甲乃整数合整数也。 4 | 甲者三与一也。 5 | 6 | 打印行于(整数操作之表示于(甲中零))。 7 | 8 | -------------------------------------------------------------------------------- /tests/stdlib/builtin/prod-three.success: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /tests/stdlib/builtin/prod-two-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 甲乃整数合整数也。 4 | 甲者三与二也。 5 | 6 | 打印行于(整数操作之表示于(甲中二))。 7 | 8 | -------------------------------------------------------------------------------- /tests/stdlib/builtin/prod-two.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/stdlib/builtin/prod-two.failure -------------------------------------------------------------------------------- /tests/stdlib/exception/error-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 甲乃爻也。 5 | 甲者异常之发生事故于『异常测试』也。 -------------------------------------------------------------------------------- /tests/stdlib/exception/error-2.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 《《内建函数:抛出异常字符串》》于《《内建类型:有》》于『异常测试』。 -------------------------------------------------------------------------------- /tests/stdlib/exception/error-3.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 打印行于(尝试运行于(会无而发生事故授以字符串于『异常』)于(会异常而发生事故授以字符串于异常附『测试』))。 -------------------------------------------------------------------------------- /tests/stdlib/exception/error-4.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 鉴『甲』而 5 | 有『甲』则 6 | (字符串也 7 | 尝试运行于(会无而 8 | 尝试运行于(会无而发生事故授以字符串于『异』) 9 | 于(会异而发生事故授以字符串于异附『常』) 10 | )于(会异常而发生事故于异常附『测试』) 11 | )。 -------------------------------------------------------------------------------- /tests/stdlib/exception/error-5.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 鉴(『甲』与『甲』)衔【】而 5 | 有乙则 6 | (鉴乙而 7 | 有(「丙」与「丁」)衔【】则 8 | (字符串也 9 | 尝试运行于(会无而 10 | 尝试运行于(会无而发生事故授以字符串于『异』) 11 | 于(会异而发生事故授以字符串于异附『常』) 12 | )于(会异常而发生事故于异常附『测试』) 13 | ) 14 | )。 -------------------------------------------------------------------------------- /tests/stdlib/exception/error-6.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 爻也 5 | 鉴(字符串列也【】)与(『甲』衔【】)而 6 | 有(【】)与(【】)则 7 | (发生事故于『一』) 8 | 或有(「尾」)与(「其他」)则 9 | (虑无者调试打印于「尾」而 10 | 发生事故于(整数表示于(长度于尾))附『测试异常』)。 -------------------------------------------------------------------------------- /tests/stdlib/exception/error.failure: -------------------------------------------------------------------------------- 1 | 测试 -------------------------------------------------------------------------------- /tests/stdlib/list/list-test-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 3 | 观标准库之书。 4 | 5 | 6 | 「数列」即整数列也。 7 | 8 | 「数列多」者多授以整数也。 9 | 「数列空」者空授以整数也。 10 | 11 | 「列甲」者【三,二,一】也。 12 | 13 | 「列乙」者滤授以整数于(会甲而「或者」于(二等于(甲))于(三等于(甲)))于「列甲」也。 14 | 15 | 打印行于(整数表示于(第N个于零于「列乙」))。 -------------------------------------------------------------------------------- /tests/stdlib/list/list-test.success: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /tests/stdlib/list/tabulate-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之数据结构之多态列之书。 3 | 寻观标准库之数据结构之字符串术之书。 4 | 寻观标准库之数据结构之整数操作之书。 5 | 寻观标准库之数据结构之小数操作之书。 6 | 寻观标准库之语言核心之内建类型之书。 7 | 寻观标准库之输入输出之笔之书。 8 | 寻观标准库之数学运算之随机之书。 9 | 10 | 11 | 12 | 13 | 上限者一零零零零零零零也。 14 | 矩阵长宽者(二零四八)也。 15 | 16 | 打印行于(整数表示于矩阵长宽)。 17 | 18 | 数列A者(打表于矩阵长宽于(会行而( 19 | 虑数者(随机之获取随机小数)于元而 20 | 虑无者(打印行于(『A,』附(整数表示于「行」)附『,』附(整数表示于「行」)附『,』附(「小数操作」之「小数表示」于数)))而 21 | 数)) 22 | )也。 23 | 「: 数列A者(打表于矩阵长宽于(会行而( 24 | 打表于矩阵长宽于(会列而( 25 | 虑数者(随机之获取随机小数)于元而 26 | 虑无者(打印行于(『A,』附(整数表示于「行」)附『,』附(整数表示于「列」)附『,』附(「小数操作」之「小数表示」于数)))而 27 | 数)) 28 | ) ) 29 | )也。 :」 30 | 「: 数列B者(打表于矩阵长宽于(会数而(打表于矩阵长宽于(会数而(随机之获取随机小数)于元))))也。 :」 -------------------------------------------------------------------------------- /tests/stdlib/list/tabulate-2.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之数据结构之多态列之书。 3 | 寻观标准库之数据结构之字符串术之书。 4 | 寻观标准库之数据结构之整数操作之书。 5 | 寻观标准库之数据结构之小数操作之书。 6 | 寻观标准库之语言核心之内建类型之书。 7 | 寻观标准库之输入输出之笔之书。 8 | 寻观标准库之数学运算之随机之书。 9 | 10 | 11 | 12 | 13 | 矩阵长宽者(二零四八)也。 14 | 15 | 打印行于(整数表示于矩阵长宽)。 16 | 17 | 数列A者(打表于一零零于(会行而( 18 | 打表于一于(会列而 19 | (打印行于(『A,』);打印行于(整数表示于「行」);打印行于(整数表示于「列」);行)) 20 | )))也。 21 | -------------------------------------------------------------------------------- /tests/stdlib/list/tabulate-4.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之语言核心之内建类型之书。 2 | 寻观标准库之数据结构之整数操作之书。 3 | 寻观标准库之输入输出之笔之书。 4 | 5 | 6 | 7 | 甲乃化整数而化(化整数而整数)而整数也。 8 | 甲者会数而会函而 9 | 虑「 10 | 递归乃化整数而整数也。 11 | 递归者会数而 12 | 虑无者打印行于(整数表示于数)而 13 | 若数等于九 14 | 则数 15 | 否则(函于(数加一))也。 16 | 17 | 递归于数 18 | 」也。 19 | 20 | 乙乃化整数而整数也。 21 | 乙者循乙以会数而甲于数于乙也。 22 | 23 | 打印行于(整数表示于(乙于零))。 -------------------------------------------------------------------------------- /tests/stdlib/list/tabulate.success: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/stdlib/list/tabulate.success -------------------------------------------------------------------------------- /tests/stdlib/strings/join-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 5 | 打印行于(以(特殊字符之新行)合并(获取字符于『三2一』))。 -------------------------------------------------------------------------------- /tests/stdlib/strings/join.success: -------------------------------------------------------------------------------- 1 | 三 2 | 2 3 | 一 -------------------------------------------------------------------------------- /tests/stdlib/strings/pattern-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻标准库之书。 3 | 观标准库之书。 4 | 5 | 6 | 甲者『三二』也。 7 | 鉴获取字符于甲而 8 | 有『三』衔乙则打印行于『三』。 -------------------------------------------------------------------------------- /tests/stdlib/strings/pattern-10.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 甲者『三二』也。 4 | 5 | 鉴(【甲,甲】)而 6 | 有『三二』衔『三二』衔【】则标准库之「打印行」于『三』 7 | 或有『三二』衔『三二』衔【】则标准库之「打印行」于『四』。 -------------------------------------------------------------------------------- /tests/stdlib/strings/pattern-2.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 甲者『三二』也。 3 | 4 | 鉴甲而 5 | 有『三二』则标准库之打印行于『三』。 -------------------------------------------------------------------------------- /tests/stdlib/strings/pattern-3.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 甲者三也。 3 | 4 | 鉴甲而 5 | 有3则标准库之「打印行」于『三』 6 | 或有三则标准库之「打印行」于『三』。 -------------------------------------------------------------------------------- /tests/stdlib/strings/pattern-4.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 甲者阳也。 4 | 5 | 鉴甲而 6 | 有《《内建爻:阴》》则标准库之「打印行」于『三』 7 | 或有《《内建爻:阳》》则标准库之「打印行」于『三』。 -------------------------------------------------------------------------------- /tests/stdlib/strings/pattern-5.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 甲者阳也。 4 | 5 | 鉴甲而 6 | 有阴则标准库之「打印行」于『三』 7 | 或有阳则标准库之「打印行」于『三』。 -------------------------------------------------------------------------------- /tests/stdlib/strings/pattern-6.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 甲乃爻也。 4 | 甲者阳也。 5 | 6 | 乙者整数合整数也。 7 | 8 | 鉴甲与甲而 9 | 有阳与阴则标准库之「打印行」于『三』 10 | 或有阳与阳则标准库之「打印行」于『三』。 -------------------------------------------------------------------------------- /tests/stdlib/strings/pattern-7.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 甲乃爻也。 4 | 甲者阳也。 5 | 6 | 7 | 8 | 鉴甲与甲而 9 | 有阳与阴则标准库之「打印行」于『二』 10 | 或有阳与阳则标准库之「打印行」于『三』。 -------------------------------------------------------------------------------- /tests/stdlib/strings/pattern-8.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 甲者『三二』也。 4 | 5 | 鉴(【甲,甲】)而 6 | 有『三二』衔『三二』衔【】则标准库之「打印行」于『三』。 -------------------------------------------------------------------------------- /tests/stdlib/strings/pattern-9.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之语言核心之内建类型之书。 2 | 寻观标准库之输入输出之笔之书。 3 | 4 | 甲立元类型也。 5 | 乙立甲也。 6 | 丙立化字符串而化甲而甲也。 7 | 8 | 9 | 10 | 丁乃化甲而字符串也。 11 | 丁者会甲而 12 | 鉴甲而 13 | 有乙则『』 14 | 或有「丙」于子于乙则『1』 15 | 或有「丙」于子于(丙于丑于寅)则『三』也。 16 | 17 | 18 | 打印行于(丁于(丙于『1』于(丙于『2』于(丙于『3』于乙))))。 -------------------------------------------------------------------------------- /tests/stdlib/strings/pattern.success: -------------------------------------------------------------------------------- 1 | 三 -------------------------------------------------------------------------------- /tests/stdlib/strings/split-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 5 | 打印行于(以(特殊字符之新行)合并(【『三』,『2』,『一』】))。 -------------------------------------------------------------------------------- /tests/stdlib/strings/split.success: -------------------------------------------------------------------------------- 1 | 三 2 | 2 3 | 一 -------------------------------------------------------------------------------- /tests/syntax/arithemetic/three-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 自然数立元类型也。 5 | 自零立自然数也。 6 | 进一立化自然数而自然数也。 7 | 8 | 加乃化自然数而化自然数而自然数也。 9 | 加者循加以会数甲而会数乙而 10 | 鉴数甲而 11 | 有自零则数乙 12 | 或有((进一)于(甲子))则进一于(「加」于甲子于「数乙」) 13 | 也 14 | 。 15 | 数一者进一于自零也。 16 | 数二者进一于数一也。 17 | 数三者进一于数二也。 18 | 19 | 数等于乃化自然数而化自然数而爻也。 20 | 数等于者循数等于以会数甲而会数乙而 21 | 鉴数甲衔数乙衔【】而 22 | 有自零衔自零衔【】则阳 23 | 或有((进一于「甲子」)衔(进一于「乙丑」)衔【】)则 24 | (「数等于」于甲子于乙丑) 25 | 或有其他则阴 26 | 也。 27 | 28 | 29 | 若「数等于」于(「加」于数一于「数二」)于「数三」 30 | 则写于『3』 31 | 否则写于『失败』。 32 | -------------------------------------------------------------------------------- /tests/syntax/arithemetic/three-2.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 打印行于(整数表示于(「具体列」之求和于【一,一,一】))。 -------------------------------------------------------------------------------- /tests/syntax/arithemetic/three-3.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 打印行于(整数表示于(从左折叠授以整数于(会甲而会乙而甲)于零于【三】)) -------------------------------------------------------------------------------- /tests/syntax/arithemetic/three.success: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /tests/syntax/empty-1.yuyan: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/empty-1.yuyan -------------------------------------------------------------------------------- /tests/syntax/empty-10.yuyan: -------------------------------------------------------------------------------- 1 | 乙者「 2 | 甲 者「。」也。 3 | 丙 乃「。」也。 4 | 」也 -------------------------------------------------------------------------------- /tests/syntax/empty-2.yuyan: -------------------------------------------------------------------------------- 1 | 。 2 | -------------------------------------------------------------------------------- /tests/syntax/empty-3.yuyan: -------------------------------------------------------------------------------- 1 | 。。。 2 | -------------------------------------------------------------------------------- /tests/syntax/empty-4.yuyan: -------------------------------------------------------------------------------- 1 | 甲者「。。。」也。 -------------------------------------------------------------------------------- /tests/syntax/empty-5.yuyan: -------------------------------------------------------------------------------- 1 | 乙者「甲者「。」也。」也 -------------------------------------------------------------------------------- /tests/syntax/empty-6.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 打印行于『』。 -------------------------------------------------------------------------------- /tests/syntax/empty-7.yuyan: -------------------------------------------------------------------------------- 1 | 寻empty-1之书。 2 | -------------------------------------------------------------------------------- /tests/syntax/empty-8.yuyan: -------------------------------------------------------------------------------- 1 | 寻empty-1之书。 2 | 观empty-1之书。 3 | -------------------------------------------------------------------------------- /tests/syntax/empty-9.yuyan: -------------------------------------------------------------------------------- 1 | 寻empty-2之书。 2 | 观empty-2之书。 3 | 寻empty-1之书。 4 | 观empty-1之书。 5 | -------------------------------------------------------------------------------- /tests/syntax/empty.success: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/empty.success -------------------------------------------------------------------------------- /tests/syntax/expression-construction/decl-ambiguous-parse-1.yuyan: -------------------------------------------------------------------------------- 1 | 观甲之书 2 | 3 | 甲者乙也。 -------------------------------------------------------------------------------- /tests/syntax/expression-construction/decl-ambiguous-parse.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/expression-construction/decl-ambiguous-parse.failure -------------------------------------------------------------------------------- /tests/syntax/expression-construction/decl-empty-name-1.yuyan: -------------------------------------------------------------------------------- 1 | 者也。 2 | -------------------------------------------------------------------------------- /tests/syntax/expression-construction/decl-empty-name.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/expression-construction/decl-empty-name.failure -------------------------------------------------------------------------------- /tests/syntax/expression-construction/decl-no-parse-1.yuyan: -------------------------------------------------------------------------------- 1 | 甲者乙。 2 | -------------------------------------------------------------------------------- /tests/syntax/expression-construction/decl-no-parse.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/expression-construction/decl-no-parse.failure -------------------------------------------------------------------------------- /tests/syntax/expression-construction/ecp-import-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻ecp-no-parse-1之书。 2 | -------------------------------------------------------------------------------- /tests/syntax/expression-construction/ecp-import-nonexistent-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻NONEXIST之书。 -------------------------------------------------------------------------------- /tests/syntax/expression-construction/ecp-import-nonexistent.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/expression-construction/ecp-import-nonexistent.failure -------------------------------------------------------------------------------- /tests/syntax/expression-construction/ecp-import.failure: -------------------------------------------------------------------------------- 1 | ecp-import -------------------------------------------------------------------------------- /tests/syntax/expression-construction/ecp-no-parse-1.yuyan: -------------------------------------------------------------------------------- 1 | 甲者乙有也。 2 | -------------------------------------------------------------------------------- /tests/syntax/expression-construction/ecp-no-parse-2.yuyan: -------------------------------------------------------------------------------- 1 | 甲者会而元也。 2 | -------------------------------------------------------------------------------- /tests/syntax/expression-construction/ecp-no-parse-3.yuyan: -------------------------------------------------------------------------------- 1 | 观不存在之书。 2 | -------------------------------------------------------------------------------- /tests/syntax/expression-construction/ecp-no-parse.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/expression-construction/ecp-no-parse.failure -------------------------------------------------------------------------------- /tests/syntax/expression-construction/parse-failure-1.yuyan: -------------------------------------------------------------------------------- 1 | 甲者也乙。 -------------------------------------------------------------------------------- /tests/syntax/expression-construction/parse-failure.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/expression-construction/parse-failure.failure -------------------------------------------------------------------------------- /tests/syntax/import/case-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻标准库之书。 4 | 观标准库之书。 5 | 6 | 7 | 8 | 字符者若阳则一零一 9 | 否则一零二也。 10 | -------------------------------------------------------------------------------- /tests/syntax/import/case.success: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/import/case.success -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 3 | 标准库之笔之写于『天地玄黄宇宙洪荒』。 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-10.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 3 | 标准库之笔之写于『天地玄黄宇宙洪荒』。 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-11.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之输入输出之笔之书。 2 | 3 | 笔之打印行于『天地玄黄宇宙洪荒』。 4 | 笔之打印行于『天地玄黄宇宙洪荒』。 5 | 笔之打印行于『天地玄黄宇宙洪荒』。 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-12.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 打印行乃化《《内建类型:字符串》》而《《内建类型:有》》也。 3 | 打印行者会串而《《C调用》》名『yyPrintln』传串也。 4 | 5 | 打印行于『天地玄黄宇宙洪荒』。 6 | 7 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-2.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之输入输出之笔之书。 2 | 3 | 打印行于『天地玄黄宇宙洪荒』。 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-3.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 打印行于『天地玄黄宇宙洪荒』。 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-4.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 5 | 甲者( 6 | 打印行于『天地玄黄宇宙洪荒』。 7 | )也。 8 | 9 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-5.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 我的打印乃化字符串而有也。 5 | 我的打印者会字而打印行于字也。 6 | 7 | 8 | 我的打印于『天地玄黄宇宙洪荒』。 9 | 10 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-6.yuyan: -------------------------------------------------------------------------------- 1 | 寻观标准库之输入输出之笔之书。 2 | 寻标准库之书。 3 | 观标准库之书。 4 | 5 | 我的打印乃化字符串而有也。 6 | 我的打印者会字而 7 | (虑( 8 | 字符者若阳则字否则字也。 9 | 。 10 | 打印行于字符 11 | ))也。 12 | 13 | 14 | 我的打印于『天地玄黄宇宙洪荒』。 15 | 16 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-7.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 打印行于(若阳则『天地玄黄宇宙洪荒』 5 | 否则『天地玄黄宇宙洪荒』)。 6 | 7 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-8.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 4 | 虑( 5 | 字符者(若阳则『天地玄黄宇宙洪荒』 6 | 否则『天地玄黄宇宙洪荒』)也。 7 | 打印行于字符 8 | ) -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-9.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 3 | 标准库之笔之打印行于『天地玄黄宇宙洪荒』。 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-f-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之笔之书。 2 | 3 | 4 | 甲者( 5 | 观标准库之笔之书。 6 | 打印行于『天地玄黄宇宙洪荒』。 7 | )也。 8 | 9 | 打印行于『天地玄黄宇宙洪荒』。 10 | 11 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-f-2.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之笔之书。 2 | 寻标准库之书。 3 | 4 | 5 | 甲者( 6 | 观标准库之笔之书。 7 | 打印行于『天地玄黄宇宙洪荒』。 8 | )也。 9 | 10 | 笔之打印行于『天地玄黄宇宙洪荒』。 11 | 12 | -------------------------------------------------------------------------------- /tests/syntax/import/hello-world-f.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/import/hello-world-f.failure -------------------------------------------------------------------------------- /tests/syntax/import/hello-world.success: -------------------------------------------------------------------------------- 1 | 天地玄黄宇宙洪荒 -------------------------------------------------------------------------------- /tests/syntax/import/import-failure-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻标准库之之书。 2 | -------------------------------------------------------------------------------- /tests/syntax/import/import-failure.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/import/import-failure.failure -------------------------------------------------------------------------------- /tests/syntax/import/import-success-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观「标准库」之书。 -------------------------------------------------------------------------------- /tests/syntax/import/import-success.success: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/import/import-success.success -------------------------------------------------------------------------------- /tests/syntax/import/sanity/b.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻a之书。 4 | 5 | a之A。 6 | 7 | 诵a之书。 -------------------------------------------------------------------------------- /tests/syntax/import/sanity/c.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 寻观诵b之书。 3 | 4 | dCe -------------------------------------------------------------------------------- /tests/syntax/literal-1.yuyan: -------------------------------------------------------------------------------- 1 | 『你好』。 2 | -------------------------------------------------------------------------------- /tests/syntax/literal.success: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/literal.success -------------------------------------------------------------------------------- /tests/syntax/num-1.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 3 | 上限者三十五也。 -------------------------------------------------------------------------------- /tests/syntax/num.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/num.failure -------------------------------------------------------------------------------- /tests/syntax/quotes/empty-quote-1.yuyan: -------------------------------------------------------------------------------- 1 | 「」。 -------------------------------------------------------------------------------- /tests/syntax/quotes/empty-quote-2.yuyan: -------------------------------------------------------------------------------- 1 | 「「」」 2 | -------------------------------------------------------------------------------- /tests/syntax/quotes/empty-quote-3.yuyan: -------------------------------------------------------------------------------- 1 | () 2 | -------------------------------------------------------------------------------- /tests/syntax/quotes/empty-quote-4.yuyan: -------------------------------------------------------------------------------- 1 | (()) 2 | -------------------------------------------------------------------------------- /tests/syntax/quotes/empty-quote.failure: -------------------------------------------------------------------------------- 1 | 不支持类型合成 -------------------------------------------------------------------------------- /tests/syntax/quotes/unclosed-literal-1.yuyan: -------------------------------------------------------------------------------- 1 | 『你好 -------------------------------------------------------------------------------- /tests/syntax/quotes/unclosed-literal.failure: -------------------------------------------------------------------------------- 1 | 未关闭的 -------------------------------------------------------------------------------- /tests/syntax/quotes/unclosed-quote-1.yuyan: -------------------------------------------------------------------------------- 1 | 「正 -------------------------------------------------------------------------------- /tests/syntax/quotes/unclosed-quote-2.yuyan: -------------------------------------------------------------------------------- 1 | 「正「正 -------------------------------------------------------------------------------- /tests/syntax/quotes/unclosed-quote-3.yuyan: -------------------------------------------------------------------------------- 1 | 「 -------------------------------------------------------------------------------- /tests/syntax/quotes/unclosed-quote-4.yuyan: -------------------------------------------------------------------------------- 1 | 「「 -------------------------------------------------------------------------------- /tests/syntax/quotes/unclosed-quote-5.yuyan: -------------------------------------------------------------------------------- 1 | 「正「正」 -------------------------------------------------------------------------------- /tests/syntax/quotes/unclosed-quote-6.yuyan: -------------------------------------------------------------------------------- 1 | 「「」 -------------------------------------------------------------------------------- /tests/syntax/quotes/unclosed-quote-7.yuyan: -------------------------------------------------------------------------------- 1 | 「 「 」 -------------------------------------------------------------------------------- /tests/syntax/quotes/unclosed-quote-8.yuyan: -------------------------------------------------------------------------------- 1 | 「 「 2 | 3 | 」 -------------------------------------------------------------------------------- /tests/syntax/quotes/unclosed-quote.failure: -------------------------------------------------------------------------------- 1 | 未关闭的 -------------------------------------------------------------------------------- /tests/syntax/typecheck/import-cyclic-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻import-cyclic-2之书。 2 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/import-cyclic-2.yuyan: -------------------------------------------------------------------------------- 1 | 寻import-cyclic-1之书。 2 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/import-cyclic-3.yuyan: -------------------------------------------------------------------------------- 1 | 寻import-cyclic-4之书。 2 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/import-cyclic-4.yuyan: -------------------------------------------------------------------------------- 1 | 寻import-cyclic-5之书。 2 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/import-cyclic-5.yuyan: -------------------------------------------------------------------------------- 1 | 寻import-cyclic-3之书。 2 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/import-cyclic-6.yuyan: -------------------------------------------------------------------------------- 1 | 寻import-cyclic-2之书。 2 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/import-cyclic.failure: -------------------------------------------------------------------------------- 1 | 循环引用 -------------------------------------------------------------------------------- /tests/syntax/typecheck/import-self-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻import-self-1之书。 2 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/import-self.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/typecheck/import-self.failure -------------------------------------------------------------------------------- /tests/syntax/typecheck/import-tc-1.yuyan: -------------------------------------------------------------------------------- 1 | 寻tc-1之书。 2 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/import-tc.failure: -------------------------------------------------------------------------------- 1 | import-tc-1.yuyan -------------------------------------------------------------------------------- /tests/syntax/typecheck/tc-1.yuyan: -------------------------------------------------------------------------------- 1 | 甲者有也。 2 | 乙乃甲也。 3 | 乙者也。 4 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/tc-2.yuyan: -------------------------------------------------------------------------------- 1 | 甲者有也。 2 | 乙乃甲也。 3 | 乙者也。 4 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/tc-3.yuyan: -------------------------------------------------------------------------------- 1 | 甲者有也。 2 | 乙乃甲也。 3 | 乙者有也。 4 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/tc-4.yuyan: -------------------------------------------------------------------------------- 1 | 甲者元也。 2 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/tc-5.yuyan: -------------------------------------------------------------------------------- 1 | 甲者元之首也。 2 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/tc-editable.yuyan: -------------------------------------------------------------------------------- 1 | 甲者有也。 2 | 乙乃甲也。 3 | 乙者有也。 4 | -------------------------------------------------------------------------------- /tests/syntax/typecheck/tc.failure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/syntax/typecheck/tc.failure -------------------------------------------------------------------------------- /tests/tutorial/tutorial-1.yuyan: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/tests/tutorial/tutorial-1.yuyan -------------------------------------------------------------------------------- /unescape.py: -------------------------------------------------------------------------------- 1 | import codecs 2 | import sys 3 | 4 | input_file = sys.argv[1] 5 | output_file = sys.argv[1] + ".unescape.ll" 6 | 7 | with open(input_file, 'rb') as infile: 8 | with open(output_file, 'wb') as outfile: 9 | while True: 10 | c = infile.read(1) 11 | if not c: 12 | break 13 | if c == b'\\': 14 | hex_str = infile.read(2) 15 | if len(hex_str) == 2 and all(c in b'0123456789ABCDEFabcdef' for c in hex_str): 16 | byte_val = int(hex_str, 16) 17 | outfile.write(bytes([byte_val])) 18 | else: 19 | outfile.write(c + hex_str) 20 | else: 21 | outfile.write(c) -------------------------------------------------------------------------------- /wasm_inspect.html: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /yybcvm/.gitignore: -------------------------------------------------------------------------------- 1 | build -------------------------------------------------------------------------------- /yybcvm/native/commandline.c: -------------------------------------------------------------------------------- 1 | #include "common_include.h" 2 | 3 | yyvalue yyGetCommandLineProgramName(){ 4 | return static_string_to_yyvalue(global_argv[0]); 5 | } 6 | 7 | 8 | yyvalue yyGetCommandLineArgs(){ 9 | 10 | if(global_argc < 2){ 11 | // yyvalue elems[] = {}; 12 | // return array_to_iso_addr(0, elems); 13 | return array_to_iso_addr(0, NULL); 14 | } 15 | 16 | yyvalue argPtrString[global_argc - 1]; 17 | 18 | for (int i = 0; i < global_argc - 1; i ++){ 19 | argPtrString[i] = static_string_to_yyvalue(global_argv[i+1]); 20 | } 21 | 22 | yyvalue result = array_to_iso_addr(global_argc - 1, argPtrString); 23 | return result; 24 | } -------------------------------------------------------------------------------- /yybcvm/native/cstdlib/cstdtime.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../common_include.h" 3 | 4 | 5 | #include 6 | 7 | 8 | yyvalue yyGetCurrentLocalDateTimeStr() { 9 | time_t t = time(NULL); 10 | char *result = ctime(&t); 11 | return malloc_string_to_yyvalue(strlen(result) + 1, result); 12 | } 13 | 14 | yyvalue yyGetCurrentLocalDateTimeFmt(yyvalue fmt) { 15 | time_t t = time(NULL); 16 | struct tm *tm = localtime(&t); 17 | int bufsz = yyvalue_get_strlen(fmt) * 2; 18 | char buffer[bufsz]; 19 | strftime(buffer, bufsz, yyvalue_to_string(fmt), tm); 20 | yyvalue ret = malloc_string_to_yyvalue(strlen(buffer) + 1, buffer); 21 | return ret; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /yybcvm/native/debug.c: -------------------------------------------------------------------------------- 1 | #include "common_include.h" 2 | 3 | yyvalue yyDebugLog0(char* str){ 4 | return 0; 5 | } 6 | yyvalue yyDebugLog1(char* str, yyvalue i1){ 7 | return 0; 8 | } 9 | yyvalue yyDebugLog2(char* str, yyvalue i1, yyvalue i2){ 10 | return 0; 11 | } 12 | yyvalue yyDebugLog3(char* str, yyvalue i1, yyvalue i2, yyvalue i3){ 13 | return 0; 14 | } -------------------------------------------------------------------------------- /yybcvm/native/debug_print.c: -------------------------------------------------------------------------------- 1 | #include "common_include.h" 2 | 3 | 4 | // void yy_debug_log_print_args(uint64_t num, const char *func_name, ...) { 5 | // va_list args; 6 | // va_start(args, func_name); 7 | // fprintf(stderr, "%s called with ", func_name); 8 | 9 | // yyvalue arg; 10 | // arg = va_arg(args, yyvalue); 11 | // fprintf(stderr, "ret = "); 12 | // yy_print_yyvalue(arg, 0); 13 | // fprintf(stderr, ", "); 14 | 15 | // for (int i = 1; i < num; i++) { 16 | // arg = va_arg(args, yyvalue); 17 | // fprintf(stderr, "arg %d = ", i); 18 | // yy_print_yyvalue(arg, 0); 19 | // if (i != num - 1) { 20 | // fprintf(stderr, ", "); 21 | // } 22 | // va_end(args); 23 | // } 24 | 25 | // fprintf(stderr, "\n"); 26 | // } 27 | -------------------------------------------------------------------------------- /yybcvm/native/debug_print.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef DEBUG_PRINT_H 3 | #define DEBUG_PRINT_H 4 | 5 | #include "common_include.h" 6 | void yy_print_yyvalue(yyvalue v, uint64_t depth); 7 | void yy_debug_log_print_args(uint64_t num, const char *func_name, ...); 8 | 9 | 10 | #define DEBUG_LOG(num, ...) \ 11 | do \ 12 | { \ 13 | yy_debug_log_print_args(num, __func__, __VA_ARGS__); \ 14 | } while (0) 15 | #endif -------------------------------------------------------------------------------- /yybcvm/native/entry_init.c: -------------------------------------------------------------------------------- 1 | 2 | #include "common_include.h" 3 | 4 | 5 | uv_loop_t *uv_global_loop; 6 | 7 | void optional_entry_initialization(){ 8 | // initialize garbage collection 9 | yy_gc_init(); 10 | // initialize uv default loop (can replace) 11 | uv_global_loop = uv_default_loop(); 12 | 13 | initialize_runtime_stack(); 14 | 15 | 16 | 17 | 18 | } -------------------------------------------------------------------------------- /yybcvm/native/memory_verifier.h: -------------------------------------------------------------------------------- 1 | #include "common_include.h" 2 | #include "garbage_collector.h" 3 | void verify_current_heap(); 4 | void verify_stack(); 5 | void verify_yyvalue(yyvalue arg, bool recursive, int depth); -------------------------------------------------------------------------------- /yybcvm/native/platforms/currentPlatform.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../common_include.h" 3 | 4 | 5 | yyvalue yyRunningOnWindows(){ 6 | #ifdef _WIN32 7 | return bool_to_yyvalue(true); 8 | #else 9 | return bool_to_yyvalue(false); 10 | #endif 11 | } 12 | 13 | yyvalue yyRunningOnMacOS(){ 14 | #ifdef __APPLE__ 15 | return bool_to_yyvalue(true); 16 | #else 17 | return bool_to_yyvalue(false); 18 | #endif 19 | } 20 | 21 | yyvalue yyRunningOnLinux(){ 22 | #ifdef __linux__ 23 | return bool_to_yyvalue(true); 24 | #else 25 | return bool_to_yyvalue(false); 26 | #endif 27 | } -------------------------------------------------------------------------------- /yybcvm/native/process_exit.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "common_include.h" 4 | 5 | 6 | yyvalue yyProcessExit(yyvalue exitStatusAddr){ 7 | int64_t st = yyvalue_to_int(exitStatusAddr); 8 | exit(st); 9 | return unit_to_yyvalue(); 10 | } -------------------------------------------------------------------------------- /yybcvm/native/time.c: -------------------------------------------------------------------------------- 1 | 2 | #include "common_include.h" 3 | 4 | // yyvalue yyCurrentNanosecondTime(){ 5 | // uint64_t currentTime = uv_hrtime(); 6 | // return int_to_yyvalue((int64_t) currentTime); 7 | // } 8 | 9 | yyvalue yyCurrentNanosecondTime() { 10 | struct timespec time; 11 | clock_gettime(CLOCK_MONOTONIC, &time); 12 | 13 | // Convert seconds and nanoseconds to nanoseconds 14 | int64_t nanoseconds = time.tv_sec * 1000000000 + time.tv_nsec; 15 | 16 | double nanoseconds_double = (double) nanoseconds; 17 | 18 | // Return the nanoseconds 19 | yyvalue ret = double_to_yyvalue(nanoseconds_double); 20 | return ret; 21 | } -------------------------------------------------------------------------------- /yybcvm/native/type_defs.h: -------------------------------------------------------------------------------- 1 | typedef __uint128_t yyvalue; 2 | // Define a function type for the pointer 3 | typedef void (*yy_function_type)(yyvalue, yyvalue); 4 | -------------------------------------------------------------------------------- /yybcvm/pygen/.gitignore: -------------------------------------------------------------------------------- 1 | output.c -------------------------------------------------------------------------------- /yylib/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "yuyan.executablePath": "./../yy" 3 | } -------------------------------------------------------------------------------- /yylib/design.yuyan: -------------------------------------------------------------------------------- 1 | 2 | 「: Vue/React 的 Template/JSX 方案:」 3 | 4 | 《《标题一》》 5 | 『豫言』 6 | 《《/标题一》》 7 | 8 | 「: 中文特色方案 :」 9 | 10 | 标题组件者 11 | 会标题内容而 12 | 标题一 13 | 性质「 14 | 字体大小者二二也。 15 | 字体者苹方也。 16 | 」 17 | 内含【 18 | 标题内容 19 | 】 20 | 也。 21 | 22 | 网页者 23 | 【 24 | 标题组件于(呈现于『豫言』) 25 | 】也。 -------------------------------------------------------------------------------- /yylib/工具包/数学绘图。豫: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 观标准库之书。 3 | 寻标准库之多态列之书。 4 | 观标准库之多态列之书。 5 | 6 | 7 | 以绘制折线图为 8 | 化(字符串注(保存文件名)) 9 | 而化(字符串注(标题)) 10 | 而化(字符串注(X轴名)) 11 | 而化(字符串注(Y轴名)) 12 | 而化((小数)列注(X值)) 13 | 而化(小数列列注(Y值们)) 14 | 而化(字符串列注(Y值标注)) 15 | 而有。 16 | 17 | 绘制折线图者 18 | 会(保存文件名) 19 | 而会(标题) 20 | 而会(X轴名) 21 | 而会(Y轴名) 22 | 而会(X值) 23 | 而会(Y值们) 24 | 而会(Y值标注) 25 | 而《《C调用》》名『yyMatPlotCreateLinePlot』传 26 | (保存文件名) 27 | 与(标题) 28 | 与(X轴名) 29 | 与(Y轴名) 30 | 与(X值) 31 | 与(Y值们) 32 | 与(Y值标注)也。 33 | -------------------------------------------------------------------------------- /yylib/总库。豫: -------------------------------------------------------------------------------- 1 | 寻标准库之书。 2 | 寻工具包之数学绘图之书。 -------------------------------------------------------------------------------- /yylib/拓展库/单元测试/总集。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻测试组件之书。 3 | 诵测试组件之书。 4 | 5 | 6 | 寻汇报结果之书。 7 | 诵汇报结果之书。 -------------------------------------------------------------------------------- /yylib/拓展库/单元测试/汇报结果。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 寻观测试组件之书。 4 | 5 | 汇报结果乃化有而有也。 6 | 汇报结果者会无而 7 | 进程之退出于(读引用于失败数)也。 -------------------------------------------------------------------------------- /yylib/拓展库/单元测试/测试组件。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻标准库之书。 4 | 观标准库之书。 5 | 6 | 成功数乃引用类于整数也。 7 | 成功数者新引用于零也。 8 | 9 | 失败数乃引用类于整数也。 10 | 失败数者新引用于零也。 11 | 12 | 打印当前成功失败数乃化有而有也。 13 | 打印当前成功失败数者会无而 14 | 打印行于『当前成功数:』附(表示于(读引用于成功数))附(『 当前失败数:』)附(表示于(读引用于失败数))也。 15 | 16 | 断言为阳乃化爻而有也。 17 | 断言为阳者会结果而 18 | 虑操作者若结果 19 | 则(写引用于成功数于((读引用于成功数)加一)) 20 | 否则(写引用于失败数于((读引用于失败数)加一)) 21 | 而(行于打印当前成功失败数)也。 22 | 23 | 断言串相等乃化字符串而化字符串而有也。 24 | 断言串相等者会期待而会实际而 25 | 虑结果者「串相等」于期待于实际而 26 | 虑操作者若结果 27 | 则(写引用于成功数于((读引用于成功数)加一)) 28 | 否则(写引用于失败数于((读引用于失败数)加一)) 29 | 而((打印当前成功失败数于元); 30 | 若结果则元否则(打印行于『期待:』附期待附『,实际:』附实际))也。 31 | 32 | 断言乃化爻而有也。 33 | 断言者断言为阳也。 -------------------------------------------------------------------------------- /yylib/拓展库/文本解析组合子/复杂组合子。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 寻观组合子数据结构之书。 3 | 寻观基础组合子之书。 4 | 寻观组合组合子之书。 5 | 寻观标准库之数据结构之字符流术之书。 6 | 7 | 完整解析乃承甲而化解析器于甲而化字符串而甲也。 8 | 完整解析者会器而会输入而 9 | 鉴运行解析器于(「顺序组合」于器于文件结束于(会结果而会无而结果))于(创建字符流于输入)而 10 | 有成功解析于「结果」于「空剩余」则( 11 | 结果 12 | ) 13 | 或有失败解析于「原因」于「剩余」则( 14 | 发生事故于原因附『。剩余输入:』附(字符流获取剩余字符串于剩余) 15 | ) 16 | 也。 17 | 18 | -------------------------------------------------------------------------------- /yylib/拓展库/文本解析组合子/总集。豫: -------------------------------------------------------------------------------- 1 | 寻基础组合子之书。 2 | 诵基础组合子之书。 3 | 寻复杂组合子之书。 4 | 诵复杂组合子之书。 5 | 寻组合子数据结构之书。 6 | 诵组合子数据结构之书。 7 | 寻组合组合子之书。 8 | 诵组合组合子之书。 -------------------------------------------------------------------------------- /yylib/拓展库/文本解析组合子/组合子数据结构。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 寻观标准库之数据结构之字符流术之书。 4 | 5 | 解析结果立化元类型而元类型也。 6 | 成功解析立承甲而化甲而化字符流「:剩余输入:」而解析结果于甲也。 7 | 失败解析立承甲而化字符串「:失败原因:」而化字符流「:剩余输入:」而解析结果于甲也。 8 | 9 | 10 | 解析器立化元类型而元类型也。 11 | 构造解析器立承甲而化(化字符流而解析结果于甲)而解析器于甲也。 12 | 13 | 运行解析器乃承甲而化解析器于甲而化字符流而解析结果于甲也。 14 | 运行解析器者会器而会输入而 15 | 鉴器而 16 | 有(构造解析器于「解析函数」)则(解析函数于输入)也。 17 | -------------------------------------------------------------------------------- /yylib/拓展库/癸象工具/总集。豫: -------------------------------------------------------------------------------- 1 | 寻癸象数据结构之书。 2 | 诵癸象数据结构之书。 3 | 寻癸象解析之书。 4 | 诵癸象解析之书。 5 | 6 | -------------------------------------------------------------------------------- /yylib/拓展库/癸象工具/癸象数据结构。测试。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 寻观总集之书。 3 | 4 | 寻观拓展库之单元测试之测试组件之书。 5 | 6 | 测试解析乃化字符串而有也。 7 | 测试解析者会输入而 8 | 「断言串相等」于输入于(癸象表示于(癸象解析于输入)) 9 | 也。 10 | 11 | 测试解析于『null』。 12 | 测试解析于『false』。 13 | 测试解析于『true』。 14 | 测试解析于『"ef"』。 15 | 测试解析于『10』。 16 | 测试解析于『12』。 17 | 测试解析于『1.2』。 18 | 测试解析于『12.12』。 19 | 测试解析于『[1,2,3]』。 20 | 测试解析于『{"fe":false}』。 21 | 测试解析于『[1.2,2.3,3,4.5,"ef",null,{"true":false}]』。 22 | 测试解析于『{"fe":{"fe\n":{}},"fe2\t":{},"fe3\"":[{}]}』。 23 | 测试解析于『{"源文件修改时间":1685988052,"依赖文件":[{"依赖路径":"/home/zc/yuyan/yylhb/标准库/语言核心/内建类型。豫","依赖修改时间":1685988052}]}』 -------------------------------------------------------------------------------- /yylib/拓展库/癸象工具/癸象解析。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 寻观癸象数据结构之书。 4 | 寻观癸象递归下降解析之书。 5 | 寻观癸象移位规约解析之书。 6 | 7 | 癸象解析乃化字符串而癸象也。 8 | 「: 癸象解析者癸象递归下降解析也。 :」 9 | 癸象解析者癸象移位规约解析也。 10 | -------------------------------------------------------------------------------- /yylib/拓展库/癸象工具/解析命令行。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 寻观总集之书。 3 | 4 | 寻观拓展库之单元测试之测试组件之书。 5 | 6 | 测试解析乃化字符串而有也。 7 | 测试解析者会输入而 8 | 「断言串相等」于输入于(癸象表示于(癸象解析于输入)) 9 | 也。 10 | 11 | 测试解析于(文件系统之读文件于『.yybuild.nosync/yylib/标准库/语言核心/内建类型.yyinfo.json』)。 -------------------------------------------------------------------------------- /yylib/拓展库/顺序标识符/顺序标识符。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻标准库之书。 3 | 观标准库之书。 4 | 5 | 整数引用者语言核心之引用之引用操作授以整数也。 6 | 7 | 内部存储者整数引用之创造于一也。 8 | 9 | 下个序数乃化有而整数也。 10 | 下个序数者会虚而 11 | ( 12 | 虑( 13 | 当前值者整数引用之读取于内部存储也。 14 | 整数引用之写于(一加当前值)于内部存储。 15 | 当前值 16 | ) 17 | )也。 18 | 19 | 下个字符序数乃化字符串而字符串也。 20 | 下个字符序数者会串而 21 | 串附(数据结构之整数操作之表示于(行于下个序数))也。 -------------------------------------------------------------------------------- /yylib/标准库/控制/惰性求值。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 4 | 「: 「惰性类型」者(遇元类型者甲而(化有而甲))也。 :」 5 | 6 | 行乃承甲而化(化有而甲)而甲也。 7 | 行者会乙而乙于元也。 8 | 9 | -------------------------------------------------------------------------------- /yylib/标准库/控制/组合子。豫: -------------------------------------------------------------------------------- 1 | 2 | 「: 其 相当于Ocaml中的 |> :」 3 | 〇其〇乃承甲而承乙而化甲而化(化甲而乙)而乙也。 4 | 〇其〇者会甲而会乙而乙于甲也。 5 | 6 | 术〇其〇交左序七零零也。 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /yylib/标准库/控制。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻控制之惰性求值之书。 3 | 4 | 惰性求值者惰性求值也。 5 | -------------------------------------------------------------------------------- /yylib/标准库/操作系统/命令行参数。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 寻观标准库之数据结构之多态列之书。 4 | 5 | 6 | 寻观标准库之数学运算之数组转换之书。 7 | 8 | 获取程序名乃化有而字符串也。 9 | 获取程序名者会甲而《《C调用》》名『yyGetCommandLineProgramName』传元也。 10 | 11 | 获取参数乃化有而字符串列也。 12 | 获取参数者会甲而「数组转多态列」于(《《C调用》》名『yyGetCommandLineArgs』传元)也。 13 | -------------------------------------------------------------------------------- /yylib/标准库/操作系统/时间。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 寻标准库之数据结构之整数操作之书。 4 | 寻标准库之数据结构之小数操作之书。 5 | 寻标准库之数学运算之转换之书。 6 | 7 | 获取当前纳秒时间乃化有而小数也。 8 | 获取当前纳秒时间者会甲而《《C调用》》名『yyCurrentNanosecondTime』传元也。 9 | 10 | 11 | 用时秒数表示乃化小数「:开始纳秒时间:」而化小数「:结束纳秒时间:」而字符串「:小数表示:」也。 12 | 用时秒数表示者会开始而会结束而 13 | 虑「总用时纳秒数」者(小数操作之减于结束于开始)而 14 | 虑「总用时秒数」者(小数操作之乘于((总用时纳秒数))于(零点零零零零零零零零一)) 15 | 而小数操作之表示于「总用时秒数」也。 16 | 17 | 18 | 当前日期时间格式表示乃化字符串而字符串也。 19 | 当前日期时间格式表示者会格式而《《C调用》》名『yyGetCurrentLocalDateTimeFmt』传格式也。 20 | 21 | 当前日期时间表示乃化有而字符串也。 22 | 当前日期时间表示者会无而《《C调用》》名『yyGetCurrentLocalDateTimeStr』传元也。 -------------------------------------------------------------------------------- /yylib/标准库/操作系统/系统名称。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 4 | 5 | 当前系统是微软Windows乃化有而爻也。 6 | 当前系统是微软Windows者会有而 7 | 《《C调用》》名『yyRunningOnWindows』传元也。 8 | 9 | 当前系统是苹果MacOS乃化有而爻也。 10 | 当前系统是苹果MacOS者会有而《《C调用》》名『yyRunningOnMacOS』传元也。 11 | 12 | 当前系统是Linux乃化有而爻也。 13 | 当前系统是Linux者会有而《《C调用》》名『yyRunningOnLinux』传元也。 14 | 15 | 16 | -------------------------------------------------------------------------------- /yylib/标准库/操作系统/进程。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 4 | 「: 注:退出将会退出当前程序。 :」 5 | 退出乃化整数而有也。 6 | 退出者会退出状态而《《C调用》》名『yyProcessExit』传退出状态也。 7 | 8 | -------------------------------------------------------------------------------- /yylib/标准库/操作系统。豫: -------------------------------------------------------------------------------- 1 | 寻操作系统之子进程之书。 2 | 寻操作系统之命令行参数之书。 3 | 寻操作系统之文件系统之书。 4 | 寻操作系统之进程之书。 5 | 寻操作系统之时间之书。 6 | 寻操作系统之路径之书。 7 | 寻操作系统之系统名称之书。 8 | 9 | 子进程者子进程也。 10 | 命令行参数者命令行参数也。 11 | 文件系统者文件系统也。 12 | 进程者进程也。 13 | 时间者时间也。 14 | 路径者路径也。 15 | 系统名称者系统名称也。 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /yylib/标准库/数学运算/具体列。豫: -------------------------------------------------------------------------------- 1 | 2 | 「:应当改名为求和:」 3 | 4 | 5 | 寻观标准库之数据结构之多态列之书。 6 | 7 | 寻观标准库之语言核心之内建类型之书。 8 | 9 | 寻观标准库之数据结构之整数操作之书。 10 | 寻标准库之数据结构之小数操作之书。 11 | 12 | 13 | 14 | 15 | 16 | 求和乃化整数列而整数也。 17 | 求和者会列而从左折叠于(会甲而会乙而「整数操作」之「加」于甲于(乙))于(零)于列也。 18 | 19 | 小数列求和乃化小数列而小数也。 20 | 小数列求和者会列而从左折叠于(会甲而会乙而「小数操作」之「加」于甲于(乙))于(零点零)于列也。 21 | 22 | -------------------------------------------------------------------------------- /yylib/标准库/数学运算/大小。豫: -------------------------------------------------------------------------------- 1 | 寻标准库之语言核心之内建类型之书。 2 | 观内建类型之书。 3 | 4 | 5 | 大小立元类型也。 6 | 大于关系立大小也。 7 | 小于关系立大小也。 8 | 等于关系立大小也。 -------------------------------------------------------------------------------- /yylib/标准库/数学运算/转换。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之语言核心之内建类型之书。 2 | 3 | 4 | 整数转小数乃化整数而小数也。 5 | 整数转小数者会甲而《《C调用》》名『yyIntToDouble』传甲也。 6 | 7 | 小数转整数乃化小数而整数也。 8 | 小数转整数者会甲而《《C调用》》名『yyDoubleToInt』传甲也。 -------------------------------------------------------------------------------- /yylib/标准库/数学运算/随机。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 4 | 「: 注:整数为上限。 :」 5 | 获取随机整数乃化整数而整数也。 6 | 获取随机整数者会甲而《《C调用》》名『yyGetRandomInt』传甲也。 7 | 8 | 9 | 获取随机小数乃化有而小数也。 10 | 获取随机小数者会甲而《《C调用》》名『yyGetRandomDouble』传元也。 -------------------------------------------------------------------------------- /yylib/标准库/数学运算。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻数学运算之转换之书。 3 | 寻数学运算之具体列之书。 4 | 寻数学运算之随机之书。 5 | 寻数学运算之大小之书。 6 | 寻数学运算之数组转换之书。 7 | 8 | 9 | 转换者转换也。 10 | 具体列者具体列也。 11 | 随机者随机也。 12 | 大小者大小也。 13 | 数组转换者数组转换也。 -------------------------------------------------------------------------------- /yylib/标准库/数据结构/函数操作。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 柯里化乃承甲而承乙而承丙而化(化(甲合乙)而丙)而(化甲而化乙而丙)也。 6 | 柯里化者会函而会甲而会乙而函于(甲与乙)也。 7 | 8 | 逆柯里化乃承甲而承乙而承丙而化(化甲而化乙而丙)而(化甲合乙而丙)也。 9 | 逆柯里化者会函而会甲及乙而函于(甲及乙中零)于(甲及乙中一)也。 -------------------------------------------------------------------------------- /yylib/标准库/数据结构/可选值。测试。豫: -------------------------------------------------------------------------------- 1 | 2 | 「: 寻观标准库之语言核心之内建类型之书。 3 | 寻观标准库之输入输出之笔之书。 4 | 寻观可选值之书。 5 | 寻观整数操作之书。 :」 6 | 寻观标准库之书。 7 | 8 | 寻观拓展库之单元测试之测试组件之书。 9 | 10 | 打印行于『开始』。 11 | 可零乃或可有整数也。 12 | 可零者可无也。 13 | 打印行于『零』。 14 | 可二乃或可有整数也。 15 | 可二者可有一也。 16 | 打印行于『二』。 17 | 可一乃或可有(或可有整数)也。 18 | 可一者可有(可有(一))也。 19 | 打印行于『一』。 20 | 21 | 内容者(「获取可有内容」于「可二」)也。 22 | 打印行于『四』。 23 | 结果者内容等于一也。 24 | 打印行于『五』。 25 | 26 | 断言于(结果)。 27 | 打印行于『六』。 -------------------------------------------------------------------------------- /yylib/标准库/数据结构/可选值。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 4 | 寻观标准库之语言核心之异常之书。 5 | 6 | 可选值类立化元类型而元类型也。 7 | 「或可有〇」号化元类型而元类型也。 8 | 「或可有〇」即可选值类也。 9 | 术或可有〇交无序七零零也。 10 | 可有立(承甲而化甲者物而或可有甲)也。 「:把此处改为号可导致无限死循环:」 11 | 「可有〇」即可有也。 12 | 术可有〇交无序七零零也。 13 | 可无立承甲而或可有甲也。 14 | 15 | 获取可有内容乃承甲而化或可有甲而甲也。 16 | 获取可有内容者受甲而会可而 17 | 鉴「可」而 18 | 有(「可有」于物)则物 19 | 或有(可无)则(甲也(发生事故于『试图从可无中获取信息』))也。 20 | 21 | 可有态射乃承甲而承乙而化或可有甲而化(化甲而乙)而或可有乙也。 22 | 「可有态射」者会可而会射而 23 | 鉴「可」而 24 | 有(可有物)则(可有(射于物)) 25 | 或有(可无)则(可无)也。 26 | 27 | 有吗乃承甲而化或可有甲而爻也。 28 | 有吗者受甲而会可而 29 | 鉴「可」而 30 | 有(「可有」于物)则阳 31 | 或有(可无)则(阴)也。 32 | 33 | 可选值相等乃承甲而化(化甲而化甲而爻)而化或可有甲而化或可有甲而爻也。 34 | 可选值相等者会相等而会「可甲」而会可乙而 35 | 鉴(可甲与可乙)而 36 | 有((可有「甲物」)与(可有「乙物」))则(「相等」于「甲物」于「乙物」) 37 | 或有((可无)与(可无))则阳 38 | 或有「其他」则阴也。 -------------------------------------------------------------------------------- /yylib/标准库/数据结构/多态列。测试。豫: -------------------------------------------------------------------------------- 1 | 2 | 「: 寻标准库之书。 3 | 观标准库之书。 4 | 5 | 寻观拓展库之单元测试之测试组件之书。 :」 6 | 7 | 8 | 寻观标准库之语言核心之内建类型之书。 9 | 寻观标准库之输入输出之笔之书。 10 | 11 | 12 | 寻观标准库之书。 13 | 14 | 寻观整数操作之书。 15 | 寻观拓展库之单元测试之测试组件之书。 16 | 17 | 18 | 打印行于『开始』。 19 | 列零乃「列」于整数也。 20 | 列零者空也。 21 | 打印行于『零』。 22 | 列二乃「列」于整数也。 23 | 打印行于『三』。 24 | 列二者(多于一于空)也。 25 | 打印行于『二』。 26 | 列一乃「列」于整数也。 27 | 列一者多于一于(多于一于空)也。 28 | 打印行于『一』。 29 | 30 | 断言于(「列相等」于「等」于(移除重复于「等」于「列一」)于「列二」)。 31 | 断言于(「列相等」于「等」于(移除重复于「等」于「列一」)于(态射于(会数而数)于「列二」))。 32 | 断言于(「整数相等」于(第N个于零于「列一」)于「一」)。 33 | 34 | 35 | 36 | 37 | 节点立元类型也。 38 | 式节点立化节点列而节点也。 39 | 40 | 41 | 虑分隔符者『,』而 42 | 虑当前输入者【】而 43 | 虑栈尾者【】而 44 | 打印行于(整数表示于(长度于((分隔符与((当前输入)接(【式节点于【】】)))衔栈尾)))。 -------------------------------------------------------------------------------- /yylib/标准库/数据结构/多态列工具。子集。测试。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 寻观拓展库之单元测试之测试组件之书。 5 | 6 | 断言于(「是子集」于「整数相等」于(【1,2】)于(【1,2,3】))。 -------------------------------------------------------------------------------- /yylib/标准库/数据结构/字符串术。测试。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观字符串术之书。 3 | 寻观爻术之书。 4 | 寻观标准库之输入输出之笔之书。 5 | 寻观拓展库之单元测试之测试组件之书。 6 | 7 | 串一者『〇列』也。 8 | 串二者『甲甲〇』也。 9 | 10 | 打印行于(爻表示于(『〇』是「串一」的开头))。 11 | 断言于((『〇』是「串一」的开头))。 12 | 断言于(非于(『〇』是「串一」的结尾))。 13 | 断言于(非于(『〇』是「串二」的开头))。 14 | 断言于((『〇』是「串二」的结尾))。 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /yylib/标准库/数据结构/小数操作。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之语言核心之内建类型之书。 2 | 3 | 4 | 5 | 加乃化小数而化小数而小数也。 6 | 加者会甲而会乙而《《C调用》》名『yyDoubleAdd』传甲与乙也。 7 | 8 | 9 | 乘乃化小数而化小数而小数也。 10 | 乘者会甲而会乙而《《C调用》》名『yyDoubleMult』传甲与乙也。 11 | 12 | 除以乃化小数而化小数而小数也。 13 | 除以者会甲而会乙而《《C调用》》名『yyDoubleDiv』传甲与乙也。 14 | 15 | 16 | 减乃化小数而化小数而小数也。 17 | 减者会甲而会乙而《《C调用》》名『yyDoubleSub』传甲与乙也。 18 | 19 | 小数表示乃化小数而字符串也。 20 | 小数表示者会甲而《《C调用》》名『yyDoubleToString』传甲也。 21 | 22 | 表示乃化小数而字符串也。 23 | 表示者会甲而《《C调用》》名『yyDoubleToString』传甲也。 24 | 25 | 26 | 27 | 理解小数乃化字符串而小数也。 28 | 理解小数者会甲而《《C调用》》名『yyStringToDouble』传甲也。 -------------------------------------------------------------------------------- /yylib/标准库/数据结构/爻术。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之语言核心之内建类型之书。 3 | 4 | 5 | 6 | 「: 注 (booleans。 7 | 爻者夫阴表有亦夫阳表有也。 8 | 阳乃爻也。 9 | 阴乃爻也。 10 | 阳者「阳」临元也。 11 | 阴者阴临元也。 12 | )。 :」 13 | 14 | 15 | 「: 注 not。 :」 16 | 非乃化爻而爻也。 17 | 非者会甲而若甲则阴否则阳也。 18 | 19 | 「: 注 and。 :」 20 | 且乃化爻而化爻而爻也。 21 | 且者会甲而会乙而若甲则(若乙则阳否则(阴))否则阴也。 22 | 23 | 〇且〇乃化爻而化爻而爻也。 24 | 「〇且〇」者且也。 25 | 术〇且〇交左序七零零也。 26 | 27 | 「: 注 or。 :」 28 | 「或者」乃化爻而化爻而爻也。 29 | 「或者」者会甲而会乙而 若甲则阳否则(若乙则阳否则(阴))也。 30 | 31 | 32 | 33 | 爻表示乃化爻而字符串也。 34 | 爻表示者会输入而 35 | 若输入则『阳』否则『阴』也。 36 | 37 | 爻相等乃化爻而化爻而爻也。 38 | 爻相等者会甲而会乙而 39 | 若甲则(若乙则阳否则(阴))否则(若乙则阴否则(阳))也。 -------------------------------------------------------------------------------- /yylib/标准库/数据结构/特殊字符。豫: -------------------------------------------------------------------------------- 1 | 2 | 新行者『 3 | 』也。 4 | 5 | 制表者『 』也。 6 | -------------------------------------------------------------------------------- /yylib/标准库/数据结构。豫: -------------------------------------------------------------------------------- 1 | 寻数据结构之多态列之书。 2 | 多态列者多态列也。 3 | 寻数据结构之多态列工具之书。 4 | 多态列工具者多态列工具也。 5 | 寻数据结构之爻术之书。 6 | 爻术者爻术也。 7 | 寻数据结构之字符串术之书。 8 | 字符串术者字符串术也。 9 | 寻数据结构之字符流术之书。 10 | 字符流术者字符流术也。 11 | 寻数据结构之整数操作之书。 12 | 整数操作者整数操作也。 13 | 寻数据结构之特殊字符之书。 14 | 特殊字符者特殊字符也。 15 | 寻数据结构之对子术之书。 16 | 对子术者对子术也。 17 | 寻数据结构之字典术之书。 18 | 字典术者字典术也。 19 | 寻数据结构之可选值之书。 20 | 可选值者可选值也。 21 | 寻数据结构之小数操作之书。 22 | 小数操作者小数操作也。 23 | 寻数据结构之列表搜索之书。 24 | 列表搜索者列表搜索也。 25 | 寻数据结构之函数操作之书。 26 | 「函数操作」者函数操作也。 27 | 28 | 诵对子术之书。 29 | -------------------------------------------------------------------------------- /yylib/标准库/语言核心/不安全。豫: -------------------------------------------------------------------------------- 1 | 「:这里的函数调用都不安全,可能会产生运行时错误,请谨慎使用:」 2 | 3 | 4 | 5 | 不安全转换乃承甲而承乙而化甲而乙也。 6 | 不安全转换者会物而《《C调用》》名『yy_豫言不安全转换』传物也。 -------------------------------------------------------------------------------- /yylib/标准库/语言核心/内建类型。豫: -------------------------------------------------------------------------------- 1 | 字符串即「《《内建类型:字符串》》」也。 2 | 整数即「《《内建类型:整数》》」也。 3 | 小数即「《《内建类型:小数》》」也。 4 | 动态分类值即「《《内建类型:动态分类值》》」也。 5 | 「有」即「《《内建类型:有》》」也。 6 | 「: 无者「《《内建类型:无》》」也。 :」 7 | 爻即「《《内建类型:爻》》」也。 8 | 元类型即「《《内建类型:元类型》》」也。 9 | 类型即「《《内建类型:元类型》》」也。 10 | 阳即「《《内建爻:阳》》」也。 11 | 阴即「《《内建爻:阴》》」也。 12 | 元即「《《内建有:元》》」也。 13 | 14 | -------------------------------------------------------------------------------- /yylib/标准库/语言核心/动态分类。豫: -------------------------------------------------------------------------------- 1 | 「: 寻内建类型之书。 2 | 观内建类型之书。 :」 3 | 4 | 5 | 「: 注:以新建动态分类字符串为化元类型者乙而化字符串而夫创造值表(化乙而(动态分类值)) 6 | 合夫分析值表(化元类型者丙而化(夫值表动态分类值合夫符合表((化乙而(丙)) )合夫不符合表((化(有)而(丙))))而丙)。 :」 7 | 「: 「新建动态分类字符串」乃(化元类型者乙而化字符串而 8 | 「 9 | 创造值乃(化乙而(动态分类值))也。 10 | 分析值乃(化元类型者丙而化「 11 | 值乃动态分类值也。 12 | 符合乃化乙而丙也。 13 | 不符合乃化有而丙也。 14 | 」而丙)也。 15 | 」)也。 16 | 新建动态分类字符串者《《内建函数:新建动态分类》》也。 :」 -------------------------------------------------------------------------------- /yylib/标准库/语言核心/续延。豫: -------------------------------------------------------------------------------- 1 | 2 | 「: 寻内建类型之书。 3 | 观内建类型之书。 :」 4 | 5 | 「: 以当前续延调用乃(承乙而化(化(承丙而化乙而(丙))而乙)而乙)也。 6 | 以当前续延调用者受乙而(《《内建函数:以当前续延调用》》)授以乙也。 :」 7 | -------------------------------------------------------------------------------- /yylib/标准库/语言核心。豫: -------------------------------------------------------------------------------- 1 | 寻语言核心之内建类型之书。 2 | 内建类型者内建类型也。 3 | 寻语言核心之续延之书。 4 | 续延者续延也。 5 | 寻语言核心之动态分类之书。 6 | 动态分类者动态分类也。 7 | 寻语言核心之异常之书。 8 | 异常者异常也。 9 | 寻语言核心之引用之书。 10 | 引用者引用也。 11 | 寻语言核心之不安全之书。 12 | 不安全者不安全也。 13 | -------------------------------------------------------------------------------- /yylib/标准库/输入输出/笔。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之语言核心之内建类型之书。 2 | 3 | 4 | 5 | 打印乃化字符串而有也。 6 | 打印者会串而《《C调用》》名『yyPrintStr』传串也。 7 | 8 | 打印行乃化字符串而有也。 9 | 打印行者会串而《《C调用》》名『yyPrintln』传串也。 10 | 11 | 标准错误打印行乃化字符串而有也。 12 | 标准错误打印行者会串而《《C调用》》名『yyPrintlnStdErr』传串也。 13 | 14 | 写乃化字符串而有也。 15 | 写者会串而《《C调用》》名『yyPrintln』传串也。 16 | 17 | 调试打印乃(承乙而化字符串而化乙而有)也。 18 | 调试打印者受乙而会名而会物而《《C调用》》名『yyPrintGeneric』传(名与物)也。 19 | 20 | 「: 注:设写为__BUILTIN_STRING_PRINT。 21 | 注:设新行为__BUILTIN_STRING_NEWLINE于元。 22 | 注:设续为__BUILTIN_STRING_APPEND。 23 | 注:设〇续〇续也。 24 | 注:术〇续以〇交左序一零零零也。 25 | 注:写于『你好!FFI! 26 | 』。 27 | 注:『你好!FFI! 28 | 』。 :」 29 | -------------------------------------------------------------------------------- /yylib/标准库/输入输出。豫: -------------------------------------------------------------------------------- 1 | 寻输入输出之笔之书。 2 | 笔者笔也。 -------------------------------------------------------------------------------- /yylib/标准库。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻标准库之操作系统之书。 4 | 寻标准库之控制之书。 5 | 寻标准库之数学运算之书。 6 | 寻标准库之数据结构之书。 7 | 寻标准库之输入输出之书。 8 | 寻标准库之语言核心之书。 9 | 10 | 控制者控制也。 11 | 操作系统者操作系统也。 12 | 数学运算者数学运算也。 13 | 数据结构者数据结构也。 14 | 输入输出者输入输出也。 15 | 语言核心者语言核心也。 16 | 17 | 诵操作系统之书。 18 | 诵控制之书。 19 | 诵数学运算之书。 20 | 诵数据结构之书。 21 | 诵输入输出之书。 22 | 诵语言核心之书。 23 | 24 | 寻豫言标准内核之书。 25 | 诵豫言标准内核之书。 -------------------------------------------------------------------------------- /yylib/豫言标准内核。豫: -------------------------------------------------------------------------------- 1 | 「:所有的库都会导入这个内核:」 2 | 3 | 4 | 5 | 6 | 寻标准库之语言核心之内建类型之书 。 7 | 寻标准库之语言核心之引用之书。 8 | 寻标准库之语言核心之异常之书。 9 | 寻标准库之数据结构之多态列之书 。 10 | 寻标准库之数据结构之多态列工具之书 。 11 | 寻标准库之数据结构之字符串术之书 。 12 | 寻标准库之数据结构之爻术之书 。 13 | 寻标准库之数据结构之整数操作之书 。 14 | 寻标准库之数据结构之可选值之书。 15 | 寻标准库之数据结构之字典术之书。 16 | 寻标准库之控制之惰性求值之书。 17 | 寻标准库之输入输出之笔之书 。 18 | 19 | 20 | 诵内建类型之书 。 21 | 诵引用之书。 22 | 诵异常之书。 23 | 诵多态列之书 。 24 | 诵多态列工具之书。 25 | 诵字符串术之书 。 26 | 诵爻术之书 。 27 | 诵整数操作之书 。 28 | 诵可选值之书。 29 | 诵字典术之书。 30 | 诵惰性求值之书。 31 | 诵笔之书 。 32 | -------------------------------------------------------------------------------- /单元测试/优化/检查函数逃逸测试。豫: -------------------------------------------------------------------------------- 1 | 「: 2 | 寻观标准库之书。 3 | 4 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 5 | 寻观豫言编译器之编译数据之抽象绑定树结构之静态单例类型处理之书。 6 | 7 | 8 | 9 | 10 | 11 | 寻观豫言编译器之编译数据之操作符之操作符数据结构之书。 12 | 寻观豫言编译器之编译数据之抽象绑定树结构之命名环境术之书。 13 | 寻观豫言编译器之编译数据之编译配置之全局配置之书。 14 | 寻观豫言编译器之编译步骤之求值正则变换之重新正则变换之书。 15 | 寻观豫言编译器之编译步骤之优化之函数单次内联工具之书。 16 | 17 | 寻观拓展库之单元测试之测试组件之书。 18 | 19 | 式者式节点于「内联虑」于【式节点于(函数调用于显式)于【自由变量于『甲』,自由变量于『甲』】,绑定于(可有『结果』)于(绑定变量于一)】也。 20 | 21 | 断言于(检查函数内联逃逸于『甲』于式)。 22 | 断言于(非于((非于(检查函数内联逃逸于『甲』于式)) 23 | 且((自由变量在式出现次数于『甲』于「式」)等于一) 24 | ))。 25 | 26 | 27 | 28 | :」 29 | -------------------------------------------------------------------------------- /单元测试/词法解析/检查词法解析。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 4 | 寻观豫言编译器之编译步骤之语法分析之具体语法树之书。 5 | 6 | 寻观豫言编译器之编译步骤之语法分析之词法解析之书。 7 | 8 | 9 | 寻观豫言编译器之编译数据之编译配置之全局配置之书。 10 | 11 | 寻观拓展库之单元测试之测试组件之书。 12 | 13 | 写引用于打印非常详细调试信息于阳。 14 | 打印行于(「表达式列表示」于(词法解析顶层于『甲「。乙。」』))。 15 | -------------------------------------------------------------------------------- /测试文件.txt: -------------------------------------------------------------------------------- 1 | 乙AB「\n1\n2 -------------------------------------------------------------------------------- /豫言编译器/文档/equlity_checking_notes.md: -------------------------------------------------------------------------------- 1 | Equality Checking: 2 | 3 | 4 | 1. Free Vars 5 | 6 | ``` 7 | bool : {type | [] -> [bool] } |- bool : {type | [] -> [bool]} 8 | -------------------------------------------------------------- 9 | bool : {type | [] -> [bool] } |- bool = [bool] : type 10 | ``` 11 | 12 | 13 | 2. Coercion of Static Extents 14 | 15 | ``` 16 | bool : {type | [] -> [bool] }, false : { <| [bool] |> | [] -> [false]} |- 17 | 18 | 19 | |- false : { <| bool |> | [] -> [false]} 20 | ----------------------------------------------------------------------------------------------------- 21 | |- out([false], false) : <| bool |> 22 | ``` -------------------------------------------------------------------------------- /豫言编译器/文档/希腊字母音译表.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/豫言编译器/文档/希腊字母音译表.png -------------------------------------------------------------------------------- /豫言编译器/文档/翻译列表.txt: -------------------------------------------------------------------------------- 1 | Token 符记 2 | Lexer 词法分析器 3 | -------------------------------------------------------------------------------- /豫言编译器/文档/英文字母翻译.md: -------------------------------------------------------------------------------- 1 | 根据《代微積拾級》 2 | 我们采取以下的方式表示英文字母 3 | 4 | A - J 甲 - 癸 5 | K - V 子 - 亥 6 | W X Y Z 物 天 地 人 7 | 8 | 9 | 参考: 10 | https://zhuanlan.zhihu.com/p/34925663 11 | 12 | 13 | 音译翻译: 14 | 15 | A - 阿 16 | B - 比 17 | C - 西 18 | D - 迪 19 | E - 伊 20 | F - 艾弗 21 | G - 吉 22 | H - 艾尺 23 | I - 艾 24 | J - 杰 25 | K - 开 26 | L - 艾勒 27 | M - 艾马 28 | N - 艾娜 29 | O - 哦 30 | P - 屁 31 | Q - 艾克 32 | R - 艾儿 33 | S - 艾丝 34 | T - 提 35 | U - 优 36 | V - 维 37 | W - 豆贝尔维 38 | X - 艾克斯 39 | Y - 吾艾 40 | Z - 贼德 -------------------------------------------------------------------------------- /豫言编译器/文档/递归处理.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuyan-lang/yuyan/a06cc1cc43fb44c9616169532eff3c97cb2ae865/豫言编译器/文档/递归处理.jpg -------------------------------------------------------------------------------- /豫言编译器/编译数据/抽象绑定树结构/抽象语法树/内建常量数据。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻标准库之书。 4 | 观标准库之书。 5 | 6 | 7 | 8 | 内建常量立元类型也。 9 | 内建类型字符串立内建常量也。 10 | 内建类型整数立内建常量也。 11 | 内建类型小数立内建常量也。 12 | 内建类型动态分类值立内建常量也。 13 | 内建类型有立内建常量也。 14 | 内建类型爻立内建常量也。 15 | 内建类型元类型立内建常量也。 16 | 内建爻阳立内建常量也。 17 | 内建爻阴立内建常量也。 18 | 内建有元立内建常量也。 19 | 内建函数抛出异常立内建常量也。 20 | 内建函数尝试运行立内建常量也。 21 | 内建函数整数相等立内建常量也。 22 | 内建函数整数大于立内建常量也。 23 | 内建函数整数减立内建常量也。 24 | 内建函数以当前续延调用立内建常量也。 25 | 26 | 所有内建常量者 27 | 【 28 | 「内建类型字符串」 , 29 | 「内建类型整数」 , 30 | 「内建类型小数」 , 31 | 「内建类型动态分类值」 , 32 | 「内建类型有」 】 33 | 接【 34 | 「内建类型爻」 , 35 | 「内建类型元类型」 , 36 | 「内建爻阳」 , 37 | 「内建爻阴」 , 38 | 「内建有元」 】接【 39 | 「内建函数抛出异常」, 40 | 「内建函数尝试运行」, 41 | 「内建函数整数相等」 , 42 | 「内建函数整数大于」 】接【 43 | 「内建函数整数减」 , 44 | 「内建函数以当前续延调用」 45 | 「: , 「内建函数新建动态分类」 :」 46 | 「: ,「内建类型新的外部类型」 :」 47 | 】也。 48 | -------------------------------------------------------------------------------- /豫言编译器/编译数据/抽象绑定树结构/抽象语法树/内建常量表示方法。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻标准库之书。 4 | 观标准库之书。 5 | 6 | 7 | 寻观内建常量数据之书。 8 | 9 | 内建常量表示乃化内建常量而字符串也。 10 | 内建常量表示者会量而 11 | 鉴量而 12 | 有「内建类型字符串」 则『《《内建类型:字符串》》』 13 | 或有「内建类型整数」 则『《《内建类型:整数》》』 14 | 或有「内建类型小数」 则『《《内建类型:小数》》』 15 | 或有「内建类型动态分类值」 则『《《内建类型:动态分类值》》』 16 | 或有「内建类型有」 则『《《内建类型:有》》』 17 | 或有「内建类型爻」 则『《《内建类型:爻》》』 18 | 或有「内建类型元类型」 则『《《内建类型:元类型》》』 19 | 或有「内建爻阳」 则『《《内建爻:阳》》』 20 | 或有「内建爻阴」 则『《《内建爻:阴》》』 21 | 或有「内建有元」 则『《《内建有:元》》』 22 | 或有「内建函数抛出异常」 则『《《内建函数:抛出异常字符串》》』 23 | 或有「内建函数尝试运行」 则『《《内建函数:尝试运行字符串》》』 24 | 或有「内建函数整数相等」 则『《《内建函数:整数:相等》》』 25 | 或有「内建函数整数大于」 则『《《内建函数:整数:大于》》』 26 | 或有「内建函数整数减」 则『《《内建函数:整数:减》》』 27 | 或有「内建函数以当前续延调用」 则『《《内建函数:以当前续延调用》》』 28 | 也。 29 | -------------------------------------------------------------------------------- /豫言编译器/编译数据/抽象绑定树结构/抽象语法树/复杂度计算。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 4 | 寻观抽象语法树数据之书。 5 | 寻观抽象语法树基础操作之书。 6 | 寻观抽象语法树表示之书。 7 | 8 | 9 | 10 | 11 | 12 | 计算表达式复杂度乃化表达式而整数也。 13 | 计算表达式复杂度者循计算表达式复杂度以会式而 14 | 虑递归者「计算表达式复杂度」而 15 | 鉴式而 16 | 有自由变量于名则零 17 | 或有绑定变量于「序数」则零 18 | 或有绑定于名于「下式」则(递归于下式) 19 | 或有式节点于「名称」于「式列」则一加(「具体列」之求和于(态射于递归于「式列」)) 20 | 或有「其他」则发生事故于『未有487』也。 -------------------------------------------------------------------------------- /豫言编译器/编译数据/抽象绑定树结构/抽象语法树/总集。豫: -------------------------------------------------------------------------------- 1 | 寻内建常量数据之书。 2 | 诵内建常量数据之书。 3 | 寻内建常量表示方法之书。 4 | 诵内建常量表示方法之书。 5 | 寻抽象语法友好表示方法之书。 6 | 诵抽象语法友好表示方法之书。 7 | 寻抽象语法树基础操作之书。 8 | 诵抽象语法树基础操作之书。 9 | 寻序列化之序列化总集之书。 10 | 诵序列化总集之书。 11 | 寻抽象语法树数据之书。 12 | 诵抽象语法树数据之书。 13 | 寻抽象语法树方法之书。 14 | 诵抽象语法树方法之书。 15 | 寻抽象语法树相等方法之书。 16 | 诵抽象语法树相等方法之书。 17 | 寻抽象语法树表示之书。 18 | 诵抽象语法树表示之书。 19 | 寻操作符结合性数据之书。 20 | 诵操作符结合性数据之书。 21 | 寻结构名称操作数据之书。 22 | 诵结构名称操作数据之书。 23 | 寻副作用检查之书。 24 | 诵副作用检查之书。 25 | 寻复杂度计算之书。 26 | 诵复杂度计算之书。 27 | -------------------------------------------------------------------------------- /豫言编译器/编译数据/抽象绑定树结构/抽象语法树/操作符结合性数据。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 寻标准库之书。 6 | 观标准库之书。 7 | 8 | 9 | 10 | 操作符结合性立元类型也。 11 | 左结合立「操作符结合性」也。 12 | 右结合立「操作符结合性」也。 13 | 无结合立「操作符结合性」也。 14 | 15 | 操作符结合性表示乃化「操作符结合性」而字符串也。 16 | 操作符结合性表示者会结而鉴结而 17 | 有「左结合」则『左』 18 | 或有「右结合」则『右』 19 | 或有「无结合」则『无』也。 20 | -------------------------------------------------------------------------------- /豫言编译器/编译数据/抽象绑定树结构/抽象语法树/结构名称操作数据。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻标准库之书。 4 | 观标准库之书。 5 | 6 | 7 | 结构名称操作立元类型也。「:寻观诵:」 8 | 结构寻立结构名称操作也。 9 | 结构寻观立结构名称操作也。 10 | 结构寻观诵立结构名称操作也。 11 | 结构寻诵立结构名称操作也。 12 | 结构观立结构名称操作也。 13 | 结构观诵立结构名称操作也。 14 | 结构诵立结构名称操作也。 15 | 16 | 17 | 结构名称操作表示乃化结构名称操作而字符串也。 18 | 结构名称操作表示者会名称而 19 | 鉴名称而 20 | 有结构寻则『寻』 21 | 或有结构寻观则『寻观』 22 | 或有结构寻观诵则『寻观诵』 23 | 或有结构寻诵则『寻诵』 24 | 或有结构观则『观』 25 | 或有结构观诵则『观诵』 26 | 或有结构诵则『诵』也。 27 | -------------------------------------------------------------------------------- /豫言编译器/编译数据/操作符/内建操作符/总集。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻标准库之书。 3 | 观标准库之书。 4 | 5 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 6 | 7 | 8 | 9 | 10 | 寻观拓展库之顺序标识符之顺序标识符之书。 11 | 12 | 寻观豫言编译器之编译数据之操作符之操作符数据结构之书。 13 | 寻观豫言编译器之编译数据之操作符之操作符操作之书。 14 | 寻观文言符集之书。 15 | 寻观现代汉语符集之书。 16 | 17 | 18 | 内建符者态射于(会量而 19 | 构造表达式操作符于【字符串组件于(内建常量表示于量)】 20 | 于(行于下个序数)于(会式列而 (可有(内建于(量)))) 21 | 于(内建常量表示于量) 22 | )于所有内建常量 23 | 也。 24 | 25 | 26 | 27 | 默认操作符乃操作符集也。 28 | 默认操作符者(「文言符集」接「现代汉语符集」接 29 | 内建符)与( 30 | (态射于(会二符而((操作符合操作符也二符);(获取标号于(二符中零))与(获取标号于(二符中一))))于( 31 | 文言优先级接现代汉语优先级 32 | )) 33 | 与 34 | (态射于获取标号于内建符)接【】 35 | )与元也。 36 | 37 | -------------------------------------------------------------------------------- /豫言编译器/编译数据/文件管理/编译文件信息。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻标准库之书。 4 | 观标准库之书。 5 | 6 | 7 | 8 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 9 | 10 | 11 | 编译单元立元类型也。 12 | 已从缓存加载立化(或可有表达式「:抽象语法:」) 13 | 而化(或可有表达式「:正则签名:」) 14 | 而化(字符串列「:依赖路径:」) 15 | 而化(或可有表达式「:正规形式:」) 16 | 而化或可有(有) 17 | 而编译单元也。 18 | 已编译立化(表达式「:抽象语法:」) 19 | 而化(表达式「:正则签名:」) 20 | 而化(字符串列「:依赖路径:」) 21 | 而化(表达式「:正规形式:」) 22 | 而化或可有(有) 23 | 而编译单元也。 24 | 正在编译立编译单元也。 25 | 尚未编译立编译单元也。 26 | -------------------------------------------------------------------------------- /豫言编译器/编译数据/编译配置/编译期属性读取。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观全局配置之书。 3 | 寻观标准库之书。 4 | 5 | 6 | 读编译属性乃化字符串而字符串也。 7 | 读编译属性者会名而 8 | 鉴(「列表搜索」之「列表查找」于(读引用于「编译期属性」)于名)而 9 | 有「可无」则(发生事故于『编译属性不存在』附名) 10 | 或有(可有「值」)则值也。 -------------------------------------------------------------------------------- /豫言编译器/编译步骤/代码生成/主程序生成入口。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 寻观低级虚拟机之主程序生成之书。 3 | 4 | 寻观豫言编译器之编译数据之编译配置之全局配置之书。 5 | 6 | 条件生成可执行程序并执行乃化字符串「:输入文件路径:」而整数「:退出状态:」也。 7 | 条件生成可执行程序并执行者会输入路径而 8 | 若(「或者」于(读引用于仅执行类型检查) 9 | 于(读引用于仅执行语法分析)) 10 | 则零 11 | 否则( 12 | 鉴(读引用于目标平台)而 13 | 有『llvm』则( 14 | 低级虚拟机生成可执行程序并执行于输入路径 15 | ) 16 | 或有「其他」则(发生事故于『不认识的目标平台:』附「其他」) 17 | ) 18 | 也。 19 | -------------------------------------------------------------------------------- /豫言编译器/编译步骤/代码生成/低级虚拟机/目标信息。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 寻观豫言编译器之编译数据之编译配置之全局配置之书。 3 | 4 | 获取目标三元组字符串乃化有而字符串也。 5 | 获取目标三元组字符串者会无而 6 | 鉴(读引用于「覆写目标三元组」) 7 | 而有(可有「目标」)则(目标附『「:换行:」』) 8 | 或有(「可无」)则( 9 | 虑输出者操作系统之子进程之获取输出于『clang』于【『-dumpmachine』】 10 | 而输出之「标准输出」 「:TODO不加括号应该也可以,但目前的parser有问题,需要调查:」 11 | )也。 -------------------------------------------------------------------------------- /豫言编译器/编译步骤/代码生成准备变换/顶层。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 4 | 5 | 寻观代码生成准备变换之书。 6 | 7 | 8 | 9 | 代码生成准备变换顶层乃化字符串而化表达式树组而表达式树组也。 10 | 代码生成准备变换顶层者会全局路径而会组而 11 | 打表态射于组于(会元素而 12 | (元素中零)与(元素中一)与((代码生成准备变换单函数顶层于(元素中零)于((元素中二) 13 | ))) 14 | )也。 -------------------------------------------------------------------------------- /豫言编译器/编译步骤/优化/优化统计信息。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 当前优化数量者新引用于零也。 5 | 6 | 记录优化乃化有而有也。 7 | 记录优化者会无而写引用于「当前优化数量」于((读引用于当前优化数量)加一)也。 -------------------------------------------------------------------------------- /豫言编译器/编译步骤/优化/树组优化框架。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 寻观豫言编译器之编译数据之操作符之操作符数据结构之书。 3 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 4 | 寻观基础工具之表达式带定义操作之书。 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 处理闭包函数定义乃化表达式「:函数式:」而 13 | 化(化命名环境而化表达式而表达式)而 14 | 表达式「:最终返回的绑定式:」也。 15 | 处理闭包函数定义者会式而会递归函数而 16 | 鉴式而 17 | 有(式节点于(拉姆达抽象于(「多参数形」于「个数」))于「多绑定」衔【】)则 18 | 式节点于(拉姆达抽象于(「多参数形」于「个数」))于(带定义多绑定递归于个数于【】于占位式于多绑定于递归函数)衔【】 19 | 或有「其他」则发生事故于『期待拉姆达抽象二参数,却得到了』附(表达式表示于式) 20 | 也。 -------------------------------------------------------------------------------- /豫言编译器/编译步骤/优化/结构组件优化。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 寻观标准库之书。 5 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 6 | 7 | 寻观豫言编译器之编译数据之编译配置之编译期输出之书。 8 | 9 | 寻观豫言编译器之编译数据之抽象绑定树结构之命名环境术之书。 10 | 寻观拓展库之顺序标识符之顺序标识符之书。 11 | 12 | 13 | 寻观优化统计信息之书。 14 | 15 | 结构组件优化乃化表达式 16 | 而表达式「:标注后的类和物:」也。 17 | 结构组件优化者循「结构组件优化」以会式而 18 | 虑递归者「结构组件优化」而 19 | 鉴式而 20 | 有(式节点于(结构节点于「可无」)于「当前式」衔「剩余式」衔【】)则( 21 | 若(表达式无副作用于当前式) 22 | 则(递归于「剩余式」) 23 | 否则(式节点于(结构节点于「可无」)于「当前式」衔「剩余式」衔【】) 24 | ) 25 | 或有「其他」则表达式统一操作于「递归」于式 26 | 也。 27 | 28 | 结构组件优化顶层乃化表达式而表达式也。 29 | 结构组件优化顶层者会式而 30 | 「结构组件优化」于式也。 -------------------------------------------------------------------------------- /豫言编译器/编译步骤/优化/结构顶层绑定优化。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 寻观标准库之书。 4 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 5 | 6 | 结构顶层绑定优化顶层乃化字符串而化表达式而表达式也。 7 | 结构顶层绑定优化顶层者会路径而会式而 8 | 鉴式而 9 | 有(式节点于(结构递归节点于「标签们」)于「递归结构参」衔【】)则 10 | (式节点于(结构递归节点于「标签们」)于(进行无名抽象于(式替换于(式节点于(文件引用节点于路径)于【】)于「递归结构参」))衔【】) 11 | 或有「其他」则( 12 | 发生事故于『期待结构递归顶层265』 13 | ) 14 | 也。 -------------------------------------------------------------------------------- /豫言编译器/编译步骤/类型标注擦除/转换擦除顶层。豫: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 6 | 7 | 8 | 寻观豫言编译器之编译数据之编译配置之全局配置之书。 9 | 寻观豫言编译器之编译数据之编译配置之编译期输出之书。 10 | 11 | 12 | 寻观豫言编译器之编译步骤之总体过程之编译文件缓存工具之书。 13 | 14 | 15 | 寻观标准库之书。 16 | 寻观豫言编译器之编译步骤之优化之前优化入口之书。 17 | 寻观豫言编译器之编译步骤之优化之跨文件优化之跨文件优化入口之书。 18 | 19 | 寻观对子转换之书。 20 | 寻观类型擦除之书。 21 | 寻观结构类型擦除之书。 22 | 寻观模式匹配转换处理之书。 23 | 寻观结构组件函数化之书。 24 | 寻观当前续延调用转换之书。 25 | 26 | 转换擦除顶层乃化字符串而化表达式而表达式也。 27 | 转换擦除顶层者会路径而会式而 28 | 虑式者「模式匹配转换顶层」于式而 29 | 虑式者「类型擦除顶层」于式而 30 | 虑式者「进行对子转换」于式而 31 | 虑式者「结构类型擦除顶层」于式而 32 | 虑式者(当前续延调用转换于式)而 33 | 「: 虑无者(若读引用于「「保存编译期中间产物」」 34 | 则写缓存于路径于『擦除中前优化前形式』于式 35 | 否则元)而 36 | 虑式者「所有跨文件优化前优化步骤」于式而 :」 37 | 式 38 | 也。 39 | 40 | -------------------------------------------------------------------------------- /豫言编译器/编译步骤/类型检查/派函数操作。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 3 | 「: :」 4 | 。 5 | 6 | 7 | 8 | 9 | 10 | 应用函数乃化参数形式而化表达式而化表达式而或可有表达式也。 11 | 应用函数者会期待形而会函而会参而 12 | 鉴函而 13 | 有(式节点于(拉姆达抽象带类型于形)于「抽象类型」衔「函体」衔【】)则 14 | 若「参式相等」于期待形于形 15 | 则可有(式替换于参于函体) 16 | 否则(发生事故于『形式不统一,检查类型检查方法』) 17 | 或有其他则(可无) 18 | 也。 19 | -------------------------------------------------------------------------------- /豫言编译器/编译步骤/语法分析/函数合集。豫: -------------------------------------------------------------------------------- 1 | 2 | 「:实现module level recursion的特殊方法:」 3 | 4 | 寻标准库之书。 5 | 观标准库之书。 6 | 7 | 8 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 9 | 寻观豫言编译器之编译数据之抽象绑定树结构之粗语法树之书。 10 | 11 | 12 | 13 | 寻观豫言编译器之编译数据之操作符之操作符数据结构之书。 14 | 15 | 16 | 「: 分析树即具体语法树之结构语法之语法分析树也。 :」 17 | 18 | 「: 表达式即抽象语法之表达式也。 :」 19 | 操作符即操作符数据结构之操作符也。 20 | 21 | 解表达式类型即化「符列环境」而化表达式列而表达式也。 22 | 23 | 解表达式引用乃引用类于解表达式类型也。 24 | 解表达式引用者新引用于(解表达式类型也会列而发生事故于『尚未设置具体值』)也。 25 | 26 | 抽象语法解析编译单元类型即化「符列环境」而化粗声明列而表达式也。 27 | 抽象语法解析编译单元引用者新引用于(抽象语法解析编译单元类型也会符列而会声明而发生事故于『尚未设置具体值』)也。 28 | 29 | 30 | 粗分析编译单元类型即化表达式列而粗声明列也。 31 | 粗分析编译单元引用者新引用于(粗分析编译单元类型也会输入而发生事故于『尚未设置具体值』)也。 32 | 33 | 「: 进行编译类型即化字符串而有也。 34 | 进行编译引用者新引用于(进行编译类型也会路径而发生事故于『尚未设置具体值』)也。 :」 35 | 36 | 编译全局主模块类型即化字符串而有也。 37 | 编译全局主模块引用者新引用于(编译全局主模块类型也会路径而发生事故于『尚未设置具体值41』)也。 38 | -------------------------------------------------------------------------------- /豫言编译器/编译步骤/语法分析/符记。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻标准库之书。 3 | 观标准库之书。 4 | 5 | 令符立元类型也。 6 | 令符开始立令符也。 7 | 「令符左直角括号」立令符也。 8 | 「令符左圆括号」立令符也。 9 | 令符字符串开始立化字符串而令符也。 10 | 「令符句号」立令符也。 11 | 「令符注释开始」立令符也。 12 | 令符转义序列开始立化字符串而令符也。 13 | 14 | 令符表示乃化令符而字符串也。 15 | 令符表示者会符而 16 | 鉴符而 17 | 有「令符开始」则『(开始符)』 18 | 或有「令符左直角括号」则『「』 19 | 或有「令符左圆括号」则『(』 20 | 或有「令符字符串开始」于串则『『』 21 | 或有「令符句号」则『。』 22 | 或有「令符注释开始」则『「:「::」』 23 | 或有「令符转义序列开始」于「序列」则『「:「::」』 24 | 或有「其他」则『未有25』也。 25 | 26 | -------------------------------------------------------------------------------- /豫言编译器/编译步骤/语法分析/粗语法分析。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 寻观具体语法树之书。 4 | 5 | 寻函数合集之书。 6 | 寻观豫言编译器之编译数据之抽象绑定树结构之粗语法树之书。 7 | 寻观豫言编译器之编译数据之编译配置之编译期输出之书。 8 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 9 | 10 | 11 | 寻观粗语法分析语句之书。 12 | 寻观粗语法分析数据结构之书。 13 | 14 | 15 | 「:unif bug:」 16 | 「: 语法分析树即语之语法分析树也。 :」 17 | 18 | 19 | 20 | 「:第一层式连续结构,第二层是连续表达式:」 21 | 修正语法分析树结构乃化表达式列而(表达式)列列也。 22 | 修正语法分析树结构者会树而 23 | 鉴树而 24 | 有(式节点于具体连续语句节点于「语句们」)衔【】则 25 | (打表态射于语句们于( 26 | 会具体语句而 27 | 鉴具体语句而 28 | 有(式节点于具体连续表达式节点于「内容们」)则内容们 29 | 或有「其他」则发生事故于『具体连续语句内容必须是连续表达式』 30 | )) 31 | 或有「其他」则【树】也。 32 | 33 | 34 | 35 | 粗分析编译单元乃化表达式列而粗声明列也。 36 | 粗分析编译单元者会树而 37 | 滤于(会粗声明而 38 | 鉴粗声明而 39 | 有(「粗直接表达式」于(空))则阴 40 | 或有「其他」则阳) 41 | 于(态射于(粗分析语句于(粗栈素列也【】))于(修正语法分析树结构于树))也。 42 | 43 | 44 | 写引用于(「函数合集」之粗分析编译单元引用)于粗分析编译单元。 45 | -------------------------------------------------------------------------------- /豫言编译器/编译步骤/闭包转换/闭包转换顶层。豫: -------------------------------------------------------------------------------- 1 | 2 | 寻观标准库之书。 3 | 4 | 寻观豫言编译器之编译数据之抽象绑定树结构之抽象语法树之总集之书。 5 | 寻观正则前闭包转换之书。 6 | 寻观豫言编译器之编译步骤之优化之前优化入口之书。 7 | 寻观全局结构变量储存变换之书。 8 | 寻观函数提升之书。 9 | 10 | 寻观豫言编译器之编译数据之编译配置之编译期输出之书。 11 | 12 | 前闭包转换顶层乃化字符串而化表达式而(字符串合爻合表达式)列也。 13 | 前闭包转换顶层者会路径而会式而 14 | 虑无者编译调试打印行于『cloconv_progress』于(会无而『开始处理』)而 15 | 虑式者( 「所有闭包转换前优化步骤」于路径于式)而 16 | 虑无者编译调试打印行于『cloconv_progress』于(会无而『优化完成』)而 17 | 虑式者(前闭包转换于式)而 18 | 虑无者编译调试打印行于『cloconv_progress』于(会无而『转换完成』)而 19 | 虑式者(全局结构变量储存转换于路径于式)而 20 | 虑无者编译调试打印行于『cloconv_progress』于(会无而『存储完成』)而 21 | 虑式者函数提升顶层于路径于式而 22 | 虑无者编译调试打印行于『cloconv_progress』于(会无而『提升完成』)而 23 | 式也。 24 | -------------------------------------------------------------------------------- /豫言编译器/编译辅助工具/命令行/compare.hs: -------------------------------------------------------------------------------- 1 | 2 | processCmdLineArgs : List String -> Unit 3 | processCmdLineArgs = \arguments -> 4 | case arguments of 5 | [] -> () 6 | | "--"::t -> (runtimeCommandLineArgs := t) 7 | | "-v" :: t -> (debugPrintRoughMessages := True; processCmdLineArgs t) 8 | | "-vv" :: t -> (debugPrintDetailedMessages := True; 9 | debugPrintRoughMessages := True; 10 | processCmdLineArgs t 11 | ) 12 | | arg :: t -> ( 13 | if (String.startsWith arg "-") 14 | then raise Fail "Unrecognized Command Line Option : " ^ ar 15 | else (filesToCompile := (!filesToCompile) @ [arg]; 16 | processCmdLineArgs t 17 | ) 18 | ) 19 | -------------------------------------------------------------------------------- /豫言编译器/编译辅助工具/命令行/版本管理。豫: -------------------------------------------------------------------------------- 1 | 寻观标准库之书。 2 | 3 | 当前豫言版本者『v0.1.0rc2+0019』也。 4 | -------------------------------------------------------------------------------- /运行时支持库/native/commandline.c: -------------------------------------------------------------------------------- 1 | #include "common_include.h" 2 | 3 | yyvalue yyGetCommandLineProgramName(){ 4 | return static_string_to_yyvalue(global_argv[0]); 5 | } 6 | 7 | 8 | yyvalue yyGetCommandLineArgs(){ 9 | 10 | if(global_argc < 2){ 11 | yyvalue elems[] = {}; 12 | return array_to_iso_addr(0, elems); 13 | } 14 | 15 | yyvalue argPtrString[global_argc - 1]; 16 | 17 | for (int i = 0; i < global_argc - 1; i ++){ 18 | argPtrString[i] = static_string_to_yyvalue(global_argv[i+1]); 19 | } 20 | 21 | yyvalue result = array_to_iso_addr(global_argc - 1, argPtrString); 22 | return result; 23 | } -------------------------------------------------------------------------------- /运行时支持库/native/cstdlib/cstdtime.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../common_include.h" 3 | 4 | 5 | #include 6 | 7 | 8 | yyvalue yyGetCurrentLocalDateTimeStr() { 9 | time_t t = time(NULL); 10 | char *result = ctime(&t); 11 | return malloc_string_to_yyvalue(strlen(result) + 1, result); 12 | } 13 | 14 | yyvalue yyGetCurrentLocalDateTimeFmt(yyvalue fmt) { 15 | time_t t = time(NULL); 16 | struct tm *tm = localtime(&t); 17 | int bufsz = yyvalue_get_strlen(fmt) * 2; 18 | char buffer[bufsz]; 19 | strftime(buffer, bufsz, yyvalue_to_string(fmt), tm); 20 | yyvalue ret = malloc_string_to_yyvalue(strlen(buffer) + 1, buffer); 21 | return ret; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /运行时支持库/native/debug.c: -------------------------------------------------------------------------------- 1 | #include "common_include.h" 2 | 3 | yyvalue yyDebugLog0(char* str){ 4 | return 0; 5 | } 6 | yyvalue yyDebugLog1(char* str, yyvalue i1){ 7 | return 0; 8 | } 9 | yyvalue yyDebugLog2(char* str, yyvalue i1, yyvalue i2){ 10 | return 0; 11 | } 12 | yyvalue yyDebugLog3(char* str, yyvalue i1, yyvalue i2, yyvalue i3){ 13 | return 0; 14 | } -------------------------------------------------------------------------------- /运行时支持库/native/debug_print.c: -------------------------------------------------------------------------------- 1 | #include "common_include.h" 2 | 3 | 4 | void yy_debug_log_print_args(uint64_t num, const char *func_name, ...) { 5 | va_list args; 6 | va_start(args, func_name); 7 | fprintf(stderr, "%s called with ", func_name); 8 | 9 | yyvalue arg; 10 | arg = va_arg(args, yyvalue); 11 | fprintf(stderr, "ret = "); 12 | yy_print_yyvalue(arg, 0); 13 | fprintf(stderr, ", "); 14 | 15 | for (int i = 1; i < num; i++) { 16 | arg = va_arg(args, yyvalue); 17 | fprintf(stderr, "arg %d = ", i); 18 | yy_print_yyvalue(arg, 0); 19 | if (i != num - 1) { 20 | fprintf(stderr, ", "); 21 | } 22 | va_end(args); 23 | } 24 | 25 | fprintf(stderr, "\n"); 26 | } 27 | -------------------------------------------------------------------------------- /运行时支持库/native/debug_print.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef DEBUG_PRINT_H 3 | #define DEBUG_PRINT_H 4 | 5 | #include "common_include.h" 6 | void yy_print_yyvalue(yyvalue v, uint64_t depth); 7 | void yy_debug_log_print_args(uint64_t num, const char *func_name, ...); 8 | 9 | 10 | #define DEBUG_LOG(num, ...) \ 11 | do \ 12 | { \ 13 | yy_debug_log_print_args(num, __func__, __VA_ARGS__); \ 14 | } while (0) 15 | #endif -------------------------------------------------------------------------------- /运行时支持库/native/entry_init.c: -------------------------------------------------------------------------------- 1 | 2 | #include "common_include.h" 3 | 4 | 5 | uv_loop_t *uv_global_loop; 6 | 7 | void optional_entry_initialization(){ 8 | // initialize garbage collection 9 | yy_gc_init(); 10 | // initialize uv default loop (can replace) 11 | uv_global_loop = uv_default_loop(); 12 | 13 | 14 | 15 | } -------------------------------------------------------------------------------- /运行时支持库/native/memory_verifier.h: -------------------------------------------------------------------------------- 1 | #include "common_include.h" 2 | #include "garbage_collector.h" 3 | void verify_current_heap(); 4 | void verify_stack(); 5 | void verify_yyvalue(yyvalue arg, bool recursive, int depth); -------------------------------------------------------------------------------- /运行时支持库/native/platforms/currentPlatform.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../common_include.h" 3 | 4 | 5 | yyvalue yyRunningOnWindows(){ 6 | #ifdef _WIN32 7 | return bool_to_yyvalue(true); 8 | #else 9 | return bool_to_yyvalue(false); 10 | #endif 11 | } 12 | 13 | yyvalue yyRunningOnMacOS(){ 14 | #ifdef __APPLE__ 15 | return bool_to_yyvalue(true); 16 | #else 17 | return bool_to_yyvalue(false); 18 | #endif 19 | } 20 | 21 | yyvalue yyRunningOnLinux(){ 22 | #ifdef __linux__ 23 | return bool_to_yyvalue(true); 24 | #else 25 | return bool_to_yyvalue(false); 26 | #endif 27 | } -------------------------------------------------------------------------------- /运行时支持库/native/process_exit.c: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "common_include.h" 4 | 5 | 6 | yyvalue yyProcessExit(yyvalue exitStatusAddr){ 7 | int64_t st = yyvalue_to_int(exitStatusAddr); 8 | exit(st); 9 | return unit_to_yyvalue(); 10 | } -------------------------------------------------------------------------------- /运行时支持库/native/time.c: -------------------------------------------------------------------------------- 1 | 2 | #include "common_include.h" 3 | 4 | // yyvalue yyCurrentNanosecondTime(){ 5 | // uint64_t currentTime = uv_hrtime(); 6 | // return int_to_yyvalue((int64_t) currentTime); 7 | // } 8 | 9 | yyvalue yyCurrentNanosecondTime() { 10 | struct timespec time; 11 | clock_gettime(CLOCK_MONOTONIC, &time); 12 | 13 | // Convert seconds and nanoseconds to nanoseconds 14 | int64_t nanoseconds = time.tv_sec * 1000000000 + time.tv_nsec; 15 | 16 | double nanoseconds_double = (double) nanoseconds; 17 | 18 | // Return the nanoseconds 19 | yyvalue ret = double_to_yyvalue(nanoseconds_double); 20 | return ret; 21 | } -------------------------------------------------------------------------------- /运行时支持库/native/type_defs.h: -------------------------------------------------------------------------------- 1 | typedef __uint128_t yyvalue; 2 | // Define a function type for the pointer 3 | typedef void (*yy_function_type)(yyvalue, yyvalue); 4 | --------------------------------------------------------------------------------