phyx 1.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. phyx-1.6.1/LICENSE +21 -0
  2. phyx-1.6.1/MANIFEST.in +10 -0
  3. phyx-1.6.1/PKG-INFO +154 -0
  4. phyx-1.6.1/README.md +129 -0
  5. phyx-1.6.1/docs/cookbook.md +178 -0
  6. phyx-1.6.1/docs/guide.md +273 -0
  7. phyx-1.6.1/docs/index.md +32 -0
  8. phyx-1.6.1/docs/python.md +116 -0
  9. phyx-1.6.1/docs/rationale.md +64 -0
  10. phyx-1.6.1/docs/reference.md +252 -0
  11. phyx-1.6.1/docs/remaining.md +78 -0
  12. phyx-1.6.1/docs/spec.md +126 -0
  13. phyx-1.6.1/docs/stdlib.md +113 -0
  14. phyx-1.6.1/docs/toolchain.md +175 -0
  15. phyx-1.6.1/docs/tour.md +138 -0
  16. phyx-1.6.1/editors/README.md +65 -0
  17. phyx-1.6.1/editors/ftdetect/phyx.vim +1 -0
  18. phyx-1.6.1/editors/language-configuration.json +12 -0
  19. phyx-1.6.1/editors/package.json +49 -0
  20. phyx-1.6.1/editors/phyx.tmLanguage.json +75 -0
  21. phyx-1.6.1/editors/syntax/phyx.vim +29 -0
  22. phyx-1.6.1/examples/01_welcome.phyx +13 -0
  23. phyx-1.6.1/examples/02_compleation.phyx +19 -0
  24. phyx-1.6.1/examples/03_abilities.phyx +29 -0
  25. phyx-1.6.1/examples/04_herd.phyx +39 -0
  26. phyx-1.6.1/examples/05_mistakes.phyx +30 -0
  27. phyx-1.6.1/examples/06_ask.phyx +26 -0
  28. phyx-1.6.1/examples/07_ascii.phyx +15 -0
  29. phyx-1.6.1/examples/08_vertical.vphyx +74 -0
  30. phyx-1.6.1/examples/09_sieve.phyx +18 -0
  31. phyx-1.6.1/examples/10_command.phyx +15 -0
  32. phyx-1.6.1/examples/11_machine.phyx +35 -0
  33. phyx-1.6.1/examples/12_sort.phyx +18 -0
  34. phyx-1.6.1/examples/13_notes.phyx +8 -0
  35. phyx-1.6.1/examples/14_compleat.phyx +10 -0
  36. phyx-1.6.1/examples/15_conjugation.phyx +10 -0
  37. phyx-1.6.1/examples/lib_as/311/231r/316/270.phyx +2 -0
  38. phyx-1.6.1/examples/lib_/305/245ewn.phyx +2 -0
  39. phyx-1.6.1/phyx/__init__.py +37 -0
  40. phyx-1.6.1/phyx/__main__.py +5 -0
  41. phyx-1.6.1/phyx/ast.py +139 -0
  42. phyx-1.6.1/phyx/builtins.py +485 -0
  43. phyx-1.6.1/phyx/cli.py +619 -0
  44. phyx-1.6.1/phyx/compiler.py +879 -0
  45. phyx-1.6.1/phyx/conjugation.py +142 -0
  46. phyx-1.6.1/phyx/errors.py +84 -0
  47. phyx-1.6.1/phyx/fmt.py +93 -0
  48. phyx-1.6.1/phyx/fonts.py +141 -0
  49. phyx-1.6.1/phyx/hints.py +358 -0
  50. phyx-1.6.1/phyx/interpreter.py +379 -0
  51. phyx-1.6.1/phyx/lexer.py +260 -0
  52. phyx-1.6.1/phyx/lib/as/311/231r/316/270.phyx +26 -0
  53. phyx-1.6.1/phyx/lib/compleat.phyx +4 -0
  54. phyx-1.6.1/phyx/lib//305/245ewn.phyx +37 -0
  55. phyx-1.6.1/phyx/lint.py +193 -0
  56. phyx-1.6.1/phyx/numerals.py +55 -0
  57. phyx-1.6.1/phyx/parser.py +574 -0
  58. phyx-1.6.1/phyx/paths.py +116 -0
  59. phyx-1.6.1/phyx/render.py +214 -0
  60. phyx-1.6.1/phyx/repl.py +232 -0
  61. phyx-1.6.1/phyx/testing.py +123 -0
  62. phyx-1.6.1/phyx/values.py +176 -0
  63. phyx-1.6.1/phyx/vertical.py +66 -0
  64. phyx-1.6.1/phyx/vocabulary.py +140 -0
  65. phyx-1.6.1/phyx.egg-info/PKG-INFO +154 -0
  66. phyx-1.6.1/phyx.egg-info/SOURCES.txt +88 -0
  67. phyx-1.6.1/phyx.egg-info/dependency_links.txt +1 -0
  68. phyx-1.6.1/phyx.egg-info/entry_points.txt +5 -0
  69. phyx-1.6.1/phyx.egg-info/top_level.txt +1 -0
  70. phyx-1.6.1/pyproject.toml +45 -0
  71. phyx-1.6.1/setup.cfg +4 -0
  72. phyx-1.6.1/tests/phyx/test_as/311/231r/316/270.phyx +7 -0
  73. phyx-1.6.1/tests/phyx/test_compleat.phyx +4 -0
  74. phyx-1.6.1/tests/phyx/test_conjugation.phyx +3 -0
  75. phyx-1.6.1/tests/phyx/test_core_ability.phyx +5 -0
  76. phyx-1.6.1/tests/phyx/test_core_list.phyx +5 -0
  77. phyx-1.6.1/tests/phyx/test_core_loop.phyx +10 -0
  78. phyx-1.6.1/tests/phyx/test_core_must.phyx +4 -0
  79. phyx-1.6.1/tests/phyx/test_speak.phyx +2 -0
  80. phyx-1.6.1/tests/phyx/test_/305/245ewn.phyx +13 -0
  81. phyx-1.6.1/tests/test_conjugation.py +105 -0
  82. phyx-1.6.1/tests/test_docs.py +68 -0
  83. phyx-1.6.1/tests/test_dx.py +254 -0
  84. phyx-1.6.1/tests/test_interpreter.py +357 -0
  85. phyx-1.6.1/tests/test_lexer.py +103 -0
  86. phyx-1.6.1/tests/test_machine.py +37 -0
  87. phyx-1.6.1/tests/test_parser.py +191 -0
  88. phyx-1.6.1/tests/test_repl.py +96 -0
  89. phyx-1.6.1/tests/test_stdlib.py +225 -0
  90. phyx-1.6.1/tests/test_tools.py +219 -0
phyx-1.6.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Brage
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
phyx-1.6.1/MANIFEST.in ADDED
@@ -0,0 +1,10 @@
1
+ include phyx/lib/*.phyx
2
+ include editors/*.json
3
+ include editors/package.json
4
+ include editors/README.md
5
+ include editors/syntax/phyx.vim
6
+ include editors/ftdetect/phyx.vim
7
+ include docs/*.md
8
+ include examples/*.phyx
9
+ include examples/*.vphyx
10
+ include tests/phyx/*.phyx
phyx-1.6.1/PKG-INFO ADDED
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: phyx
3
+ Version: 1.6.1
4
+ Summary: φyrx (PhyrxScript / PhyrexianScript) — a programming language written in Phyrexian
5
+ Author: Brage
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Brage1025/phyrexianscript
8
+ Project-URL: Documentation, https://github.com/Brage1025/phyrexianscript/tree/main/docs
9
+ Project-URL: Issues, https://github.com/Brage1025/phyrexianscript/issues
10
+ Keywords: esolang,phyrexian,mtg,interpreter,conlang,language,phyx,phyrx,phyrxscript,phyrexianscript
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Software Development :: Interpreters
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Dynamic: license-file
25
+
26
+ # φyrx
27
+
28
+ **Also known as PhyrxScript and PhyrexianScript.**
29
+
30
+ φyrx is a programming language written in Phyrexian. Its orthography, vocabulary, and grammar are not invented: they come from the community [Phyrexian Dictionary](https://fxbuson.github.io/PhyrexianDictionary/) (tutorial chapters 1–3). A program is a sequence of Phyrexian sentences. The verb comes last. Numbers are hexadecimal. Text is read in vertical columns.
31
+
32
+ The toolchain is a small Python 3.11+ interpreter with no third-party dependencies. The language and interpreter are **MIT**. The optional font and dictionary JSON are **GPL-3.0** and are fetched, not vendored. Source: [github.com/Brage1025/phyrexianscript](https://github.com/Brage1025/phyrexianscript).
33
+
34
+ ```
35
+ python -m phyx examples/01_welcome.phyx
36
+ ```
37
+
38
+ ```
39
+ šdeχd-keθəɢð
40
+ x: 5 x+10: 15
41
+ jnaķm
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Names
47
+
48
+ | Name | Use |
49
+ | --- | --- |
50
+ | **φyrx** | native short name (romanised `phyx`) |
51
+ | **PhyrxScript** | English name of the language |
52
+ | **PhyrexianScript** | full English name; also this project’s folder |
53
+
54
+ All three name the same language. After `pip install -e .` the commands `phyx`, `phyrx`, `phyrxscript`, and `phyrexianscript` are the same toolchain.
55
+
56
+ ---
57
+
58
+ ## Install
59
+
60
+ ```
61
+ pip install phyx
62
+ phyx examples/01_welcome.phyx
63
+ ```
64
+
65
+ From this folder, without the index:
66
+
67
+ ```
68
+ cd PhyrexianScript
69
+ python -m phyx examples/01_welcome.phyx # no install required
70
+ pip install -e . # optional: phyx on PATH
71
+ phyx examples/01_welcome.phyx
72
+ ```
73
+
74
+ Cursor / VS Code: install the extension from `editors/` (see [editors/README.md](editors/README.md)). There is no marketplace listing yet.
75
+
76
+ Typing `ţ` is painful. `--ascii` lets a capital stand for the special letter it resembles (`TTE''` → `ţə''`):
77
+
78
+ ```
79
+ python -m phyx --ascii examples/07_ascii.phyx
80
+ python -m phyx fetch # official Phyrexian font + dictionary
81
+ python -m phyx render examples/01_welcome.phyx -o welcome.html # embeds the font
82
+ ```
83
+
84
+ ---
85
+
86
+ ## A program is a file
87
+
88
+ ```
89
+ python -m phyx # interactive session
90
+ python -m phyx examples/09_sieve.phyx
91
+ python -m phyx examples/10_command.phyx red blue
92
+ python -m phyx -c "!1-2-babg."
93
+ python -m phyx words # every marker, verb, constant
94
+ python -m phyx explain if # English → Phyrexian (ba)
95
+ python -m phyx lookup add
96
+ python -m phyx fmt examples/01_welcome.phyx
97
+ python -m phyx lint examples/12_sort.phyx
98
+ python -m phyx lib # shipped herds (asərθ, ťewn, compleat)
99
+ python -m phyx test # tests written in φyrx (tests/phyx/)
100
+ python -m phyx bench
101
+ python -m phyx dis examples/03_abilities.phyx
102
+ ```
103
+
104
+ Inside a program, `'uxq` (command) is the list of arguments. A first line `#! /usr/bin/env phyx` is ignored. `naķm` (work) quotes an ability so a zero-parameter `ťe` can be stored and activated.
105
+
106
+ ```
107
+ ^ťe-greet:
108
+ !"šdeχd".
109
+ ^xe-greet-naķm-fn-ţə''.
110
+ ^lo-0-ťewn-fn-čtəčpliɣn.
111
+ ```
112
+
113
+ ---
114
+
115
+ ## Documentation
116
+
117
+ | Document | Contents |
118
+ | --- | --- |
119
+ | [docs/index.md](docs/index.md) | Map of every page |
120
+ | [docs/tour.md](docs/tour.md) | First program, no Phyrexian assumed |
121
+ | [docs/guide.md](docs/guide.md) | How to write and how to think in φyrx |
122
+ | [docs/stdlib.md](docs/stdlib.md) | Shipped herds (`abs`, `sort`, `map`, …) and `bukð` search path |
123
+ | [docs/spec.md](docs/spec.md) | Language specification (normative) |
124
+ | [docs/reference.md](docs/reference.md) | Types, verbs, sentences, grammar, errors |
125
+ | [docs/python.md](docs/python.md) | Map from Python (what is the same, what is not) |
126
+ | [docs/cookbook.md](docs/cookbook.md) | Short recipes |
127
+ | [docs/toolchain.md](docs/toolchain.md) | CLI, REPL, modules, tests, vertical script, ASCII |
128
+ | [docs/rationale.md](docs/rationale.md) | Why the language is this shape |
129
+ | [docs/remaining.md](docs/remaining.md) | What still needs to be done |
130
+ | [CHANGELOG.md](CHANGELOG.md) | What changed |
131
+ | [editors/README.md](editors/README.md) | TextMate and Vim grammars |
132
+
133
+ Worked programs live in `examples/`: welcome through a Turing machine, list sort, file notes, a command-line script, and `compleat`. The standard library is `phyx/lib/`; `examples/lib_*.phyx` are aliases.
134
+
135
+ ```
136
+ python -m phyx test
137
+ python -m unittest discover -s tests -v
138
+ ```
139
+
140
+ ---
141
+
142
+ ## Status
143
+
144
+ φyrx 1.6.1 (PhyrxScript / PhyrexianScript) is a Turing-complete language that compiles to CPython. Unbounded lists, `baxuφ`, and recursive `ťe` run a Turing machine (`examples/11_machine.phyx`). Pure abilities compile to ordinary Python `def` with nested `return fib(n-1)+fib(n-2)` and `while i < n:`. After compile, `python -m phyx bench` is typically within a small factor of CPython on recursive `fib` and a tight loop (equality and ordering keep Phyrexian kinds, so they are not raw Python `==`).
145
+
146
+ The standard library is φyrx: `phyx/lib/` is on the `bukð` search path. `python -m phyx test` runs tests written in φyrx (`ǩaπa` is the assertion; a sibling `.expected` file is exact stdout). `python -m phyx lookup` searches the lexicon without a fetch. TextMate and Vim grammars live in `editors/`.
147
+
148
+ Faults name the fix and the ability stack. `python -m phyx explain if` answers in Phyrexian. `fmt` and `lint` keep a file canonical and catch a dropped `'iţpənn`.
149
+
150
+ It has binding, closures, first-class abilities, lists and books, modules, UTF-8 notes on disk (`brøtjt` / `mɴyrx`), program arguments, a REPL, vertical rendering in the official Phyrexian font, a [language spec](docs/spec.md), a [tour](docs/tour.md) for someone who has never seen Phyrexian, and docs aimed at someone arriving from Python.
151
+
152
+ Verbs may take chapter-3 person inflection (`babeg` is `babg`); tense is the mood marker. Numerals may be Arabic hex or Basilica Mathematical Monospace.
153
+
154
+ Phyrexian script, romanisation, grammar and lexicon: [fxbuson/PhyrexianDictionary](https://fxbuson.github.io/PhyrexianDictionary/). See [docs/reference.md](docs/reference.md#provenance) for the mapping and the licence split.
phyx-1.6.1/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # φyrx
2
+
3
+ **Also known as PhyrxScript and PhyrexianScript.**
4
+
5
+ φyrx is a programming language written in Phyrexian. Its orthography, vocabulary, and grammar are not invented: they come from the community [Phyrexian Dictionary](https://fxbuson.github.io/PhyrexianDictionary/) (tutorial chapters 1–3). A program is a sequence of Phyrexian sentences. The verb comes last. Numbers are hexadecimal. Text is read in vertical columns.
6
+
7
+ The toolchain is a small Python 3.11+ interpreter with no third-party dependencies. The language and interpreter are **MIT**. The optional font and dictionary JSON are **GPL-3.0** and are fetched, not vendored. Source: [github.com/Brage1025/phyrexianscript](https://github.com/Brage1025/phyrexianscript).
8
+
9
+ ```
10
+ python -m phyx examples/01_welcome.phyx
11
+ ```
12
+
13
+ ```
14
+ šdeχd-keθəɢð
15
+ x: 5 x+10: 15
16
+ jnaķm
17
+ ```
18
+
19
+ ---
20
+
21
+ ## Names
22
+
23
+ | Name | Use |
24
+ | --- | --- |
25
+ | **φyrx** | native short name (romanised `phyx`) |
26
+ | **PhyrxScript** | English name of the language |
27
+ | **PhyrexianScript** | full English name; also this project’s folder |
28
+
29
+ All three name the same language. After `pip install -e .` the commands `phyx`, `phyrx`, `phyrxscript`, and `phyrexianscript` are the same toolchain.
30
+
31
+ ---
32
+
33
+ ## Install
34
+
35
+ ```
36
+ pip install phyx
37
+ phyx examples/01_welcome.phyx
38
+ ```
39
+
40
+ From this folder, without the index:
41
+
42
+ ```
43
+ cd PhyrexianScript
44
+ python -m phyx examples/01_welcome.phyx # no install required
45
+ pip install -e . # optional: phyx on PATH
46
+ phyx examples/01_welcome.phyx
47
+ ```
48
+
49
+ Cursor / VS Code: install the extension from `editors/` (see [editors/README.md](editors/README.md)). There is no marketplace listing yet.
50
+
51
+ Typing `ţ` is painful. `--ascii` lets a capital stand for the special letter it resembles (`TTE''` → `ţə''`):
52
+
53
+ ```
54
+ python -m phyx --ascii examples/07_ascii.phyx
55
+ python -m phyx fetch # official Phyrexian font + dictionary
56
+ python -m phyx render examples/01_welcome.phyx -o welcome.html # embeds the font
57
+ ```
58
+
59
+ ---
60
+
61
+ ## A program is a file
62
+
63
+ ```
64
+ python -m phyx # interactive session
65
+ python -m phyx examples/09_sieve.phyx
66
+ python -m phyx examples/10_command.phyx red blue
67
+ python -m phyx -c "!1-2-babg."
68
+ python -m phyx words # every marker, verb, constant
69
+ python -m phyx explain if # English → Phyrexian (ba)
70
+ python -m phyx lookup add
71
+ python -m phyx fmt examples/01_welcome.phyx
72
+ python -m phyx lint examples/12_sort.phyx
73
+ python -m phyx lib # shipped herds (asərθ, ťewn, compleat)
74
+ python -m phyx test # tests written in φyrx (tests/phyx/)
75
+ python -m phyx bench
76
+ python -m phyx dis examples/03_abilities.phyx
77
+ ```
78
+
79
+ Inside a program, `'uxq` (command) is the list of arguments. A first line `#! /usr/bin/env phyx` is ignored. `naķm` (work) quotes an ability so a zero-parameter `ťe` can be stored and activated.
80
+
81
+ ```
82
+ ^ťe-greet:
83
+ !"šdeχd".
84
+ ^xe-greet-naķm-fn-ţə''.
85
+ ^lo-0-ťewn-fn-čtəčpliɣn.
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Documentation
91
+
92
+ | Document | Contents |
93
+ | --- | --- |
94
+ | [docs/index.md](docs/index.md) | Map of every page |
95
+ | [docs/tour.md](docs/tour.md) | First program, no Phyrexian assumed |
96
+ | [docs/guide.md](docs/guide.md) | How to write and how to think in φyrx |
97
+ | [docs/stdlib.md](docs/stdlib.md) | Shipped herds (`abs`, `sort`, `map`, …) and `bukð` search path |
98
+ | [docs/spec.md](docs/spec.md) | Language specification (normative) |
99
+ | [docs/reference.md](docs/reference.md) | Types, verbs, sentences, grammar, errors |
100
+ | [docs/python.md](docs/python.md) | Map from Python (what is the same, what is not) |
101
+ | [docs/cookbook.md](docs/cookbook.md) | Short recipes |
102
+ | [docs/toolchain.md](docs/toolchain.md) | CLI, REPL, modules, tests, vertical script, ASCII |
103
+ | [docs/rationale.md](docs/rationale.md) | Why the language is this shape |
104
+ | [docs/remaining.md](docs/remaining.md) | What still needs to be done |
105
+ | [CHANGELOG.md](CHANGELOG.md) | What changed |
106
+ | [editors/README.md](editors/README.md) | TextMate and Vim grammars |
107
+
108
+ Worked programs live in `examples/`: welcome through a Turing machine, list sort, file notes, a command-line script, and `compleat`. The standard library is `phyx/lib/`; `examples/lib_*.phyx` are aliases.
109
+
110
+ ```
111
+ python -m phyx test
112
+ python -m unittest discover -s tests -v
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Status
118
+
119
+ φyrx 1.6.1 (PhyrxScript / PhyrexianScript) is a Turing-complete language that compiles to CPython. Unbounded lists, `baxuφ`, and recursive `ťe` run a Turing machine (`examples/11_machine.phyx`). Pure abilities compile to ordinary Python `def` with nested `return fib(n-1)+fib(n-2)` and `while i < n:`. After compile, `python -m phyx bench` is typically within a small factor of CPython on recursive `fib` and a tight loop (equality and ordering keep Phyrexian kinds, so they are not raw Python `==`).
120
+
121
+ The standard library is φyrx: `phyx/lib/` is on the `bukð` search path. `python -m phyx test` runs tests written in φyrx (`ǩaπa` is the assertion; a sibling `.expected` file is exact stdout). `python -m phyx lookup` searches the lexicon without a fetch. TextMate and Vim grammars live in `editors/`.
122
+
123
+ Faults name the fix and the ability stack. `python -m phyx explain if` answers in Phyrexian. `fmt` and `lint` keep a file canonical and catch a dropped `'iţpənn`.
124
+
125
+ It has binding, closures, first-class abilities, lists and books, modules, UTF-8 notes on disk (`brøtjt` / `mɴyrx`), program arguments, a REPL, vertical rendering in the official Phyrexian font, a [language spec](docs/spec.md), a [tour](docs/tour.md) for someone who has never seen Phyrexian, and docs aimed at someone arriving from Python.
126
+
127
+ Verbs may take chapter-3 person inflection (`babeg` is `babg`); tense is the mood marker. Numerals may be Arabic hex or Basilica Mathematical Monospace.
128
+
129
+ Phyrexian script, romanisation, grammar and lexicon: [fxbuson/PhyrexianDictionary](https://fxbuson.github.io/PhyrexianDictionary/). See [docs/reference.md](docs/reference.md#provenance) for the mapping and the licence split.
@@ -0,0 +1,178 @@
1
+ # φyrx cookbook
2
+
3
+ Short programs. Copy, change the objects, keep the verb last. Hexadecimal throughout. Stuck on a word? `python -m phyx explain if`. New to the language? [tour.md](tour.md).
4
+
5
+ ---
6
+
7
+ ## Person on the verb, tense on the marker
8
+
9
+ ```
10
+ !1-2-babg.
11
+ !1-2-babeg.
12
+ ```
13
+
14
+ Both add. `babeg` is they→one (chapter 3). Past would be `^'u-1-2-babg.`, not a different verb. `python -m phyx explain babeg`.
15
+
16
+ ---
17
+
18
+ ## Bind, speak, ask
19
+
20
+ ```
21
+ ^xe-5-x-ţə''.
22
+ !x.
23
+ ?"name: "-nɒqč.
24
+ !nɒqč.
25
+ ```
26
+
27
+ `ţə''` is put: **value then place**. `!` speaks; `?` asks and binds the last word.
28
+
29
+ ---
30
+
31
+ ## Count, branch, loop
32
+
33
+ ```
34
+ ^xe-0-n-ţə''.
35
+ ^baxuφ-n-5-grmɒɣg:
36
+ ^xe-n-'ii-babg-n-ţə''.
37
+ ^ba-n-ķu-geft:
38
+ !"odd",n.
39
+ ^qit:
40
+ !"even",n.
41
+ ```
42
+
43
+ `grmɒɣg` is `<`. `geft` is remainder. `qit` is instead.
44
+
45
+ ---
46
+
47
+ ## Lists and books
48
+
49
+ ```
50
+ ^xe-1-2-3-3-ťewn-xs-ţə''.
51
+ ^xe-xs-4-bɬølπ.
52
+ !xs-samk,xs-0-tapq.
53
+ ^xe-9-xs-1-tapq-ţə''.
54
+
55
+ ^xe-"a"-1-"b"-2-2-tekt-book-ţə''.
56
+ !book-"a"-tapq,book-rukxtekt.
57
+ ```
58
+
59
+ The numeral immediately before `ťewn` / `tekt` is the **count**. Empty list: `0-ťewn`.
60
+
61
+ ---
62
+
63
+ ## Abilities
64
+
65
+ ```
66
+ ^ťe-a-b-babgķus'ər:
67
+ ^lo-a-b-babg-ķus'ər-'iţpənn.
68
+ !3-4-babgķus'ər.
69
+ ```
70
+
71
+ Recursive Fibonacci (hex `0a` is ten):
72
+
73
+ ```
74
+ ^ťe-n-fib:
75
+ ^ba-n-ķu-grmɒɣg:lo-n-'iţpənn.
76
+ ^lo-n-'ii-mɒɣg-fib-n-ķu-mɒɣg-fib-babg-'iţpənn.
77
+ !0a-fib.
78
+ ```
79
+
80
+ Store a zero-parameter ability with `naķm`, activate with `čtəčpliɣn`:
81
+
82
+ ```
83
+ ^ťe-greet:
84
+ !"šdeχd".
85
+ ^xe-greet-naķm-fn-ţə''.
86
+ ^lo-0-ťewn-fn-čtəčpliɣn.
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Cast a herd, sort a list
92
+
93
+ ```
94
+ ^lo-"compleat.phyx"-bukð.
95
+ !3-1-4-1-5-5-ťewn-sort.
96
+ !1-2-3-3-ťewn-sum.
97
+ ```
98
+
99
+ `bukð` first, then call. See `examples/12_sort.phyx` and [stdlib.md](stdlib.md).
100
+
101
+ ---
102
+
103
+ ## Notes on disk
104
+
105
+ ```
106
+ ^lo-"šdeχd"-"hi.txt"-mɴyrx.
107
+ !"hi.txt"-brøtjt.
108
+ ```
109
+
110
+ `mɴyrx` (spread) writes UTF-8 next to the program (it never searches). `brøtjt` (research) reads: program directory, working directory, then `PHYX_PATH` — not `phyx/lib/`. Absolute paths are used as written. `examples/13_notes.phyx`.
111
+
112
+ ---
113
+
114
+ ## Command-line arguments
115
+
116
+ ```
117
+ #! /usr/bin/env phyx
118
+ ^aχəw'-w-dl-'uxq:
119
+ !w.
120
+ ```
121
+
122
+ ```
123
+ python -m phyx examples/10_command.phyx red blue
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Catch a mistake
129
+
130
+ ```
131
+ ^baqilx:
132
+ ^xe-1-0-χɬkevk.
133
+ ^qit:
134
+ !dekp.
135
+ ```
136
+
137
+ `dekp` is the blame: the value of `ɬšeɴazv`, or the fault message.
138
+
139
+ ---
140
+
141
+ ## A Turing machine
142
+
143
+ `examples/11_machine.phyx` adds unary `1^m 0 1^n` on a tape. Unbounded `ťewn` + `baxuφ` + `ťe` is enough.
144
+
145
+ ---
146
+
147
+ ## Assert in φyrx
148
+
149
+ `ǩaπa` is *must*. Put tests in `tests/phyx/test_*.phyx` and run `python -m phyx test`. A sibling `test_foo.expected` is exact stdout when the file speaks.
150
+
151
+ ```
152
+ ^lo-"asərθ.phyx"-bukð.
153
+ ^ǩaπa-əx0a-abs-0a-dž'ynpp.
154
+ ```
155
+
156
+ ---
157
+
158
+ ## When it breaks
159
+
160
+ ```
161
+ python -m phyx explain if # English → ba
162
+ python -m phyx lint FILE # dropped 'iţpənn, unused objects
163
+ python -m phyx --ascii FILE # Te is ťe, TTE'' is ţə''
164
+ ```
165
+
166
+ `xə` / `ðə` / `ʁšθakɴ` always evaluate every object (there is no skipped arm). `1-əxbytp-dž'ynpp` is false: number and truth are different kinds.
167
+
168
+ ---
169
+
170
+ ## See the CPython
171
+
172
+ ```
173
+ python -m phyx dis examples/03_abilities.phyx
174
+ python -m phyx bench
175
+ python -m phyx render examples/01_welcome.phyx -o welcome.html
176
+ python -m phyx explain babg
177
+ python -m phyx lint examples/03_abilities.phyx
178
+ ```