mavrix 0.3.0__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 (63) hide show
  1. mavrix-0.3.0/CHANGELOG.md +25 -0
  2. mavrix-0.3.0/CODE_OF_CONDUCT.md +12 -0
  3. mavrix-0.3.0/CONTRIBUTING.md +29 -0
  4. mavrix-0.3.0/LICENSE +21 -0
  5. mavrix-0.3.0/MANIFEST.in +7 -0
  6. mavrix-0.3.0/PKG-INFO +310 -0
  7. mavrix-0.3.0/README.md +278 -0
  8. mavrix-0.3.0/SECURITY.md +5 -0
  9. mavrix-0.3.0/assets/logo-small.png +0 -0
  10. mavrix-0.3.0/assets/logo.png +0 -0
  11. mavrix-0.3.0/docs/ARCHITECTURE.md +64 -0
  12. mavrix-0.3.0/docs/EDITORS.md +52 -0
  13. mavrix-0.3.0/docs/RELEASING.md +51 -0
  14. mavrix-0.3.0/docs/SYNTAX.md +137 -0
  15. mavrix-0.3.0/editors/vscode/README.md +12 -0
  16. mavrix-0.3.0/editors/vscode/extension.js +22 -0
  17. mavrix-0.3.0/editors/vscode/language-configuration.json +12 -0
  18. mavrix-0.3.0/editors/vscode/package.json +38 -0
  19. mavrix-0.3.0/editors/vscode/syntaxes/mavrix.tmLanguage.json +35 -0
  20. mavrix-0.3.0/examples/README.md +12 -0
  21. mavrix-0.3.0/examples/calculator.mvx +17 -0
  22. mavrix-0.3.0/examples/classes.mvx +20 -0
  23. mavrix-0.3.0/examples/comprehensions.mvx +11 -0
  24. mavrix-0.3.0/examples/fizzbuzz.mvx +12 -0
  25. mavrix-0.3.0/examples/functions.mvx +15 -0
  26. mavrix-0.3.0/examples/guess_the_number.mvx +18 -0
  27. mavrix-0.3.0/examples/hello.mvx +4 -0
  28. mavrix-0.3.0/examples/inheritance.mvx +20 -0
  29. mavrix-0.3.0/examples/modules/helpers.mvx +6 -0
  30. mavrix-0.3.0/examples/modules/main.mvx +6 -0
  31. mavrix-0.3.0/examples/recursion.mvx +18 -0
  32. mavrix-0.3.0/examples/safe_division.mvx +10 -0
  33. mavrix-0.3.0/examples/shopping_list.mvx +14 -0
  34. mavrix-0.3.0/examples/word_counter.mvx +15 -0
  35. mavrix-0.3.0/pyproject.toml +50 -0
  36. mavrix-0.3.0/setup.cfg +4 -0
  37. mavrix-0.3.0/src/mavrix/__init__.py +8 -0
  38. mavrix-0.3.0/src/mavrix/__main__.py +3 -0
  39. mavrix-0.3.0/src/mavrix/checker.py +83 -0
  40. mavrix-0.3.0/src/mavrix/cli.py +184 -0
  41. mavrix-0.3.0/src/mavrix/compiler.py +44 -0
  42. mavrix-0.3.0/src/mavrix/diagnostics.py +89 -0
  43. mavrix-0.3.0/src/mavrix/fmt.py +249 -0
  44. mavrix-0.3.0/src/mavrix/importer.py +52 -0
  45. mavrix-0.3.0/src/mavrix/lexer.py +177 -0
  46. mavrix-0.3.0/src/mavrix/lsp.py +316 -0
  47. mavrix-0.3.0/src/mavrix/parser.py +1235 -0
  48. mavrix-0.3.0/src/mavrix/repl.py +87 -0
  49. mavrix-0.3.0/src/mavrix/runner.py +107 -0
  50. mavrix-0.3.0/src/mavrix.egg-info/PKG-INFO +310 -0
  51. mavrix-0.3.0/src/mavrix.egg-info/SOURCES.txt +61 -0
  52. mavrix-0.3.0/src/mavrix.egg-info/dependency_links.txt +1 -0
  53. mavrix-0.3.0/src/mavrix.egg-info/entry_points.txt +2 -0
  54. mavrix-0.3.0/src/mavrix.egg-info/top_level.txt +1 -0
  55. mavrix-0.3.0/tests/helpers.py +33 -0
  56. mavrix-0.3.0/tests/test_cli.py +74 -0
  57. mavrix-0.3.0/tests/test_codegen.py +133 -0
  58. mavrix-0.3.0/tests/test_errors.py +124 -0
  59. mavrix-0.3.0/tests/test_fmt.py +118 -0
  60. mavrix-0.3.0/tests/test_is.py +17 -0
  61. mavrix-0.3.0/tests/test_lexer.py +51 -0
  62. mavrix-0.3.0/tests/test_lsp.py +113 -0
  63. mavrix-0.3.0/tests/test_programs.py +76 -0
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here.
4
+ Format based on [Keep a Changelog](https://keepachangelog.com/), versioning follows [SemVer](https://semver.org/).
5
+
6
+ ## [0.3.0] - 2026-11-29
7
+ First public release.
8
+
9
+ ### Added
10
+ - Compiler front-end: lexer → recursive-descent parser → Python AST → checker → backend (`ast.unparse`).
11
+ - Statements: `say`, `ask`, `set`, `change/increase/decrease/multiply/divide`, `if/otherwise`, `while`, `repeat`,
12
+ `count` (with `step`), `for each`, `define/give back`, `class`, `try/on error/always`, `with`, `use`, `fail`,
13
+ `ensure`, `delete`, `global`, `nonlocal`, default/star parameters.
14
+ - Multi-line text (`"""..."""`), f-strings, comprehensions, slices, tuples/unpacking, sets, chained comparisons.
15
+ - Expression words: `contains`, `does not contain`, `length of`, `mod`, `is at least/at most/greater than/...`.
16
+ - `is` / `is not` compare values (identity only with `nothing`).
17
+ - Optional block labels (`end if`, `end repeat`, …), checked for mismatches.
18
+ - Compile-time checks: unknown names, misplaced statements, Python-only words, built-in shadowing warnings.
19
+ - Error messages with a source excerpt, caret, hints and "did you mean?"; runtime errors point at the `.mvx` line.
20
+ - Importing other `.mvx` files with `use`.
21
+ - CLI: `run` (`--debug`), `build`, `check`, `repl`, `fmt`, `lsp`, `tokens`, `ast`, `version`.
22
+ - Formatter `mavrix fmt` (`--check`, `--diff`, `--stdout`, folders); keeps comments and the syntax tree.
23
+ - Dependency-free language server: errors, formatting, completion, hover help, document outline.
24
+ - VS Code extension (highlighting and language server); setup guides for other editors in `docs/EDITORS.md`.
25
+ - Documentation, examples, tests, CI and a Trusted-Publishing workflow for PyPI.
@@ -0,0 +1,12 @@
1
+ # Code of Conduct
2
+
3
+ We want Mavrix to be a welcoming place for learners, teachers and contributors of every background and experience level.
4
+
5
+ **Be kind.** Be patient with beginners, assume good intent, and give feedback that helps.
6
+ **Be respectful.** No harassment, discrimination, insults or personal attacks.
7
+ **Be constructive.** Disagree with ideas, not with people.
8
+
9
+ Unacceptable behaviour may be reported to the maintainers through a private GitHub security advisory or the contact listed on the maintainer's profile.
10
+ Maintainers may remove comments, issues or contributions that break these rules and may ban repeat offenders.
11
+
12
+ This Code of Conduct is adapted from the spirit of the [Contributor Covenant](https://www.contributor-covenant.org/).
@@ -0,0 +1,29 @@
1
+ # Contributing to Mavrix
2
+
3
+ Thank you for helping make programming friendlier! 💛
4
+
5
+ ## Ground rules
6
+ 1. **Readability first.** A new feature must be understandable by a beginner without explanation.
7
+ 2. **One obvious Python result.** Each Mavrix statement should map to one clear Python construct.
8
+ 3. **Helpful errors.** Bad input should produce a message that says what is wrong *and* how to fix it.
9
+
10
+ ## Setup
11
+ ```bash
12
+ git clone https://github.com/CanavarIT/mavrix.git
13
+ cd mavrix
14
+ pip install -e .
15
+ python -m unittest discover -s tests -v
16
+ ```
17
+
18
+ ## Adding syntax
19
+ 1. In `src/mavrix/parser.py`, add the word to `STATEMENT_WORDS` and write an `st_<word>` method
20
+ (operators and phrases live in `BIN_LEVELS`, `PHRASES` and `unary()`).
21
+ 2. Add tests in `tests/` (both the happy path and an error case).
22
+ 3. Document it in `docs/SYNTAX.md` and add a line to `CHANGELOG.md`.
23
+
24
+ ## Pull requests
25
+ - Keep PRs focused and small.
26
+ - Make sure all tests pass.
27
+ - Describe *why* the change helps learners.
28
+
29
+ By contributing you agree your work is released under the [MIT License](LICENSE).
mavrix-0.3.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CanavarIT
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.
@@ -0,0 +1,7 @@
1
+ include LICENSE README.md CHANGELOG.md CONTRIBUTING.md CODE_OF_CONDUCT.md SECURITY.md
2
+ recursive-include docs *.md
3
+ recursive-include examples *.mvx *.md
4
+ recursive-include tests *.py
5
+ recursive-include assets *.png
6
+ recursive-include editors *.json *.js *.md
7
+ global-exclude __pycache__ *.py[cod] .DS_Store
mavrix-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,310 @@
1
+ Metadata-Version: 2.4
2
+ Name: mavrix
3
+ Version: 0.3.0
4
+ Summary: A small, readable language that transpiles to Python - made for learning and teaching.
5
+ Author: CanavarIT
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/CanavarIT/mavrix
8
+ Project-URL: Documentation, https://github.com/CanavarIT/mavrix/blob/main/docs/SYNTAX.md
9
+ Project-URL: Source, https://github.com/CanavarIT/mavrix
10
+ Project-URL: Issues, https://github.com/CanavarIT/mavrix/issues
11
+ Project-URL: Changelog, https://github.com/CanavarIT/mavrix/blob/main/CHANGELOG.md
12
+ Keywords: transpiler,compiler,education,teaching,beginners,language,python,language-server,lsp,formatter
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Education
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Topic :: Education
26
+ Classifier: Topic :: Software Development :: Code Generators
27
+ Classifier: Topic :: Software Development :: Compilers
28
+ Requires-Python: >=3.9
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Dynamic: license-file
32
+
33
+ <div align="center">
34
+
35
+ <img src="https://raw.githubusercontent.com/CanavarIT/mavrix/main/assets/logo.png" alt="Mavrix logo" width="220" />
36
+
37
+ # Mavrix
38
+
39
+ **Readable code that becomes Python.**
40
+ A small, beginner-friendly language with a real compiler front-end — built for learning and teaching programming.
41
+
42
+ [![CI](https://img.shields.io/github/actions/workflow/status/CanavarIT/mavrix/ci.yml?branch=main&style=for-the-badge&logo=githubactions&logoColor=white&label=tests)](https://github.com/CanavarIT/mavrix/actions)
43
+ [![License: MIT](https://img.shields.io/badge/license-MIT-d40000?style=for-the-badge)](https://github.com/CanavarIT/mavrix/tree/main/LICENSE)
44
+ [![Python](https://img.shields.io/badge/python-3.9%2B-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org/)
45
+ [![PyPI](https://img.shields.io/pypi/v/mavrix?style=for-the-badge&logo=pypi&logoColor=white&color=d40000)](https://pypi.org/project/mavrix/)
46
+ [![Downloads](https://img.shields.io/pypi/dm/mavrix?style=for-the-badge&color=000000)](https://pypi.org/project/mavrix/)
47
+ [![Dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen?style=for-the-badge)](https://github.com/CanavarIT/mavrix/blob/main/pyproject.toml)
48
+
49
+ [![Stars](https://img.shields.io/github/stars/CanavarIT/mavrix?style=social)](https://github.com/CanavarIT/mavrix/stargazers)
50
+ [![Forks](https://img.shields.io/github/forks/CanavarIT/mavrix?style=social)](https://github.com/CanavarIT/mavrix/network/members)
51
+ [![Issues](https://img.shields.io/github/issues/CanavarIT/mavrix?style=flat-square&color=d40000)](https://github.com/CanavarIT/mavrix/issues)
52
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat-square)](https://github.com/CanavarIT/mavrix/blob/main/CONTRIBUTING.md)
53
+ [![Made for Education](https://img.shields.io/badge/made%20for-education-blue?style=flat-square&logo=bookstack&logoColor=white)](#-why-mavrix)
54
+
55
+ [Quick start](#-quick-start) ·
56
+ [Syntax](#-the-language-in-60-seconds) ·
57
+ [Examples](https://github.com/CanavarIT/mavrix/tree/main/examples/) ·
58
+ [Reference](https://github.com/CanavarIT/mavrix/blob/main/docs/SYNTAX.md) ·
59
+ [Architecture](https://github.com/CanavarIT/mavrix/blob/main/docs/ARCHITECTURE.md) ·
60
+ [Editors](https://github.com/CanavarIT/mavrix/blob/main/docs/EDITORS.md) ·
61
+ [Contributing](https://github.com/CanavarIT/mavrix/blob/main/CONTRIBUTING.md)
62
+
63
+ </div>
64
+
65
+ ![Mavrix demo](https://raw.githubusercontent.com/CanavarIT/mavrix/main/assets/demo.gif)
66
+
67
+ ---
68
+
69
+ ## ✨ Why Mavrix?
70
+
71
+ Beginners trip over punctuation long before they understand ideas. Mavrix removes the noise:
72
+ no colons, no indentation traps, no brackets around `print`. You write sentences-like code,
73
+ Mavrix turns it into **clean, standard Python** — so students learn real concepts *and* can
74
+ peek at the Python it produces whenever they are ready.
75
+
76
+ | Mavrix | Python it becomes |
77
+ |---|---|
78
+ | `say "Hello"` | `print("Hello")` |
79
+ | `ask number age "Age? "` | `age = int(input("Age? "))` |
80
+ | `repeat 3 times` … `end` | `for _ in range(3):` |
81
+ | `count i from 1 to 10` … `end` | `for i in range(1, 10 + 1):` |
82
+ | `if x is at least 5 then` … `end` | `if x >= 5:` |
83
+ | `define add(a, b)` … `give back a + b` … `end` | `def add(a, b): return a + b` |
84
+
85
+ **Highlights**
86
+
87
+ - 🧒 **Easy to read, easy to teach** – blocks open with a word and close with `end`; no colons, no indentation traps.
88
+ - 🧠 **A real compiler pipeline** – lexer → recursive-descent parser → Python AST → checker → backend ([how it works](https://github.com/CanavarIT/mavrix/blob/main/docs/ARCHITECTURE.md)).
89
+ - 💬 **Excellent error messages** – source excerpt with a caret, hints, “did you mean…?”, several errors at once.
90
+ - 📍 **Runtime errors point at *your* `.mvx` line**, not at generated code.
91
+ - 🐍 **100 % Python underneath** – `use` any Python library; `mavrix build` gives plain Python with no runtime dependency.
92
+ - 🧩 **Modules** – `use helpers` imports `helpers.mvx`.
93
+ - 🔍 **Learning tools** – `mavrix repl`, `mavrix build --print`, `mavrix tokens`, `mavrix ast`.
94
+ - 🛠️ **Editor support** – live errors, formatting, completion and hover via a built-in language server ([setup](https://github.com/CanavarIT/mavrix/blob/main/docs/EDITORS.md)), plus `mavrix fmt`.
95
+ - 📦 **Zero dependencies**, Python 3.9+, tested on 3.9 – 3.13 in CI.
96
+
97
+ ## 🚀 Quick start
98
+
99
+ ```bash
100
+ pip install mavrix
101
+ ```
102
+
103
+ Prefer an isolated command-line tool? `pipx install mavrix` works too. Check it:
104
+
105
+ ```bash
106
+ mavrix version
107
+ ```
108
+
109
+ <details>
110
+ <summary>Install from source (for contributors)</summary>
111
+
112
+ ```bash
113
+ git clone https://github.com/CanavarIT/mavrix.git
114
+ cd mavrix
115
+ pip install -e .
116
+ ```
117
+
118
+ </details>
119
+
120
+ Create `hello.mvx`:
121
+
122
+ ```text
123
+ ask name "What is your name? "
124
+ say "Hello,", name + "!"
125
+ ```
126
+
127
+ Run it:
128
+
129
+ ```bash
130
+ mavrix run hello.mvx
131
+ ```
132
+
133
+ See the Python it generates:
134
+
135
+ ```bash
136
+ mavrix build hello.mvx --print
137
+ ```
138
+
139
+ ### Commands
140
+
141
+ | Command | What it does |
142
+ |---|---|
143
+ | `mavrix run file.mvx` | Run a program (`--debug` also shows the Python traceback) |
144
+ | `mavrix repl` (or just `mavrix`) | Interactive prompt with multi-line blocks |
145
+ | `mavrix build file.mvx [-o out.py] [--print]` | Translate to a Python file (or print it) |
146
+ | `mavrix check file.mvx …` | Find mistakes without running |
147
+ | `mavrix fmt file.mvx …` | Format code in the standard style (`--check`, `--diff`) |
148
+ | `mavrix lsp` | Language server for editors ([setup](https://github.com/CanavarIT/mavrix/blob/main/docs/EDITORS.md)) |
149
+ | `mavrix tokens file.mvx` · `mavrix ast file.mvx` | Show the tokens / syntax tree |
150
+ | `mavrix version` | Show the version |
151
+
152
+ No install? Run from the source folder: `PYTHONPATH=src python -m mavrix run examples/hello.mvx`
153
+
154
+ ## 📖 The language in 60 seconds
155
+
156
+ ```text
157
+ # This is a comment
158
+
159
+ # --- variables ---
160
+ set name = "Ada"
161
+ set score = 10
162
+ change score by 5 # score += 5 (also: increase, decrease, multiply, divide)
163
+ set a, b = 1, 2
164
+
165
+ # --- input & output ---
166
+ say "Hi", name, f"- score is {score}"
167
+ ask city "Where do you live? "
168
+ ask number age "How old are you? " # also: ask decimal price "..."
169
+
170
+ # --- decisions ---
171
+ if age is less than 13 then
172
+ say "Kid"
173
+ otherwise if age is at least 65 then
174
+ say "Senior"
175
+ otherwise
176
+ say "Adult"
177
+ end
178
+
179
+ if basket contains "milk" and not (age is at most 3) then
180
+ say "Shopping time"
181
+ end
182
+
183
+ # --- loops ---
184
+ repeat 3 times
185
+ say "Hip hip hooray!"
186
+ end
187
+
188
+ count i from 1 to 5 # 1 2 3 4 5 (last number included!)
189
+ say i
190
+ end
191
+
192
+ for each fruit in ["apple", "pear"]
193
+ say fruit
194
+ end
195
+
196
+ while score is greater than 0
197
+ decrease score by 5
198
+ end
199
+
200
+ # --- lists, dictionaries, comprehensions ---
201
+ set squares = [n * n for each n in range(1, 6) if n mod 2 == 1]
202
+ set ages = {"Ada": 36, "Linus": 28}
203
+ say length of squares, ages["Ada"]
204
+
205
+ # --- functions & classes ---
206
+ define square(x)
207
+ give back x * x
208
+ end
209
+
210
+ class Dog(Animal)
211
+ define speak(self)
212
+ give back self.name + " says Woof!"
213
+ end
214
+ end
215
+
216
+ # --- errors ---
217
+ try
218
+ say 10 / 0
219
+ on error ZeroDivisionError as problem
220
+ say "Oops:", problem
221
+ always
222
+ say "Finished"
223
+ end
224
+
225
+ # --- modules ---
226
+ use math
227
+ use helpers # loads helpers.mvx next to this file
228
+ ```
229
+
230
+ Values: `true`, `false`, `nothing`, numbers, `"text"`, `"""multi-line text"""`, `[lists]`, `{dictionaries}`.
231
+ Everything else inside an expression is normal Python (`len(x)`, `x.append(1)`, `a + b`, `and`, `or`, `not` …).
232
+
233
+ ➡️ Complete reference: **[docs/SYNTAX.md](https://github.com/CanavarIT/mavrix/blob/main/docs/SYNTAX.md)**
234
+
235
+ ## 🧪 Examples
236
+
237
+ | File | Shows |
238
+ |---|---|
239
+ | [`hello.mvx`](https://github.com/CanavarIT/mavrix/blob/main/examples/hello.mvx) | Input and output |
240
+ | [`fizzbuzz.mvx`](https://github.com/CanavarIT/mavrix/blob/main/examples/fizzbuzz.mvx) | Loops and decisions |
241
+ | [`shopping_list.mvx`](https://github.com/CanavarIT/mavrix/blob/main/examples/shopping_list.mvx) | Lists and totals |
242
+ | [`functions.mvx`](https://github.com/CanavarIT/mavrix/blob/main/examples/functions.mvx) | Functions |
243
+ | [`recursion.mvx`](https://github.com/CanavarIT/mavrix/blob/main/examples/recursion.mvx) | Functions calling themselves |
244
+ | [`comprehensions.mvx`](https://github.com/CanavarIT/mavrix/blob/main/examples/comprehensions.mvx) | Building lists and dictionaries |
245
+ | [`word_counter.mvx`](https://github.com/CanavarIT/mavrix/blob/main/examples/word_counter.mvx) | Dictionaries and `contains` |
246
+ | [`classes.mvx`](https://github.com/CanavarIT/mavrix/blob/main/examples/classes.mvx) · [`inheritance.mvx`](https://github.com/CanavarIT/mavrix/blob/main/examples/inheritance.mvx) | Classes |
247
+ | [`safe_division.mvx`](https://github.com/CanavarIT/mavrix/blob/main/examples/safe_division.mvx) · [`calculator.mvx`](https://github.com/CanavarIT/mavrix/blob/main/examples/calculator.mvx) | Error handling |
248
+ | [`guess_the_number.mvx`](https://github.com/CanavarIT/mavrix/blob/main/examples/guess_the_number.mvx) | A tiny game |
249
+ | [`modules/`](https://github.com/CanavarIT/mavrix/tree/main/examples/modules) | Using your own `.mvx` modules |
250
+
251
+ ## 💬 Friendly errors
252
+
253
+ Mistakes are reported with the exact spot, a hint, and a suggested fix:
254
+
255
+ ```text
256
+ error: Expected 'then' or the end of the line, but found 'thn'
257
+ --> demo.mvx:2:23
258
+ |
259
+ 2 | if age is at least 18 thn
260
+ | ^^^
261
+ = hint: Did you mean 'then'?
262
+ ```
263
+
264
+ Runtime problems point at your line too:
265
+
266
+ ```text
267
+ error: ZeroDivisionError: division by zero
268
+ --> demo.mvx:3:15
269
+ |
270
+ 3 | give back a / 0
271
+ | ^^^^^
272
+ = hint: You can't divide by zero. Check the number you are dividing by.
273
+ ```
274
+
275
+ ## ⚙️ How it works
276
+
277
+ ```text
278
+ .mvx ──► Lexer ──► Parser ──► Checker ──► Backend ──► run / save .py
279
+ tokens Python AST names & ast.unparse (runtime errors map
280
+ + positions (+ .mvx context / compile() back to .mvx lines)
281
+ positions)
282
+ ```
283
+
284
+ The parser builds the Python `ast` directly, so formatting is always correct and every node remembers where
285
+ it came from in your `.mvx` file. Read [docs/ARCHITECTURE.md](https://github.com/CanavarIT/mavrix/blob/main/docs/ARCHITECTURE.md) — each stage is one short file.
286
+
287
+ ## 🗺️ Roadmap
288
+
289
+ - [x] Real lexer + parser + AST backend
290
+ - [x] Friendly diagnostics, REPL, `.mvx` modules
291
+ - [x] VS Code highlighting, `mavrix fmt`, language server
292
+ - [ ] `lambda`-style inline functions, `yield`, decorators
293
+ - [ ] `mavrix new` project scaffolding
294
+
295
+ ## 🤝 Contributing
296
+
297
+ Ideas, bug reports and classroom feedback are very welcome! Read
298
+ [CONTRIBUTING.md](https://github.com/CanavarIT/mavrix/blob/main/CONTRIBUTING.md) and our [Code of Conduct](https://github.com/CanavarIT/mavrix/blob/main/CODE_OF_CONDUCT.md).
299
+
300
+ ```bash
301
+ python -m unittest discover -s tests -v
302
+ ```
303
+
304
+ ## 📄 License
305
+
306
+ Released under the [MIT License](https://github.com/CanavarIT/mavrix/tree/main/LICENSE).
307
+
308
+ <div align="center">
309
+ <sub>Made with ❤️ for people who are writing their very first program.</sub>
310
+ </div>