Commit c6afdef
committed
Add UNLICENSE; improve REPL, module import/export, I/O and freezing
Add UNLICENSE (public-domain dedication).
Wire REPL to behave like script top-level: use <string> as source filename, create a top-level frame, and route input/output via configurable input_provider/output_sink. Ensure prompts start on a fresh line when prior output exists and reset call stack after errored evaluations so the REPL remains usable.
Add module caching for IMPORT: cache module Environment and created Function objects so subsequent imports reuse the same namespace instance and avoid re-executing module code. Publish module top-level bindings as dotted names (module.name) into the caller environment.
Add EXPORT(symbol, module) to copy a caller binding into an imported module's dotted namespace.
Improve INPUT to accept an optional prompt, forward prompts to the output sink, and record prompts in the I/O log for deterministic replay.
Add shushing controls: SHUSH/UNSHUSH to temporarily suppress forwarding of console output (while still recording I/O events); make RUN temporarily disable shushing so run-invoked output is always forwarded.
Make PRINT, child process output, and other forwarders respect the shushed flag so forwarded console output is suppressed when shushed.
Add identifier freeze controls: FREEZE, THAW, PERMAFREEZE with runtime enforcement (prevent reassignment/deletion of frozen bindings), plus query helpers FROZEN and PERMAFROZEN.
Add EXPORT, FROZEN, PERMAFROZEN builtins and hook their behaviors into the interpreter environment.
Improve READFILE to read raw bytes and decode robustly (UTF-8 with/without BOM, UTF-16, fallback with replacement) to avoid decoding crashes on BOM or different encodings.
Update lexer to accept both single and double quotes for string literals (must open and close with same delimiter).
Add small warning in collection.asmln and expand test.asmln to print progress and success messages for library tests.
Update spec.txt to document new behaviors: string quoting, INPUT(prompt), SHUSH/UNSHUSH, freezing semantics, EXPORT, and IMPORT caching semantics.1 parent a80b9f7 commit c6afdef
File tree
8 files changed
+468
-57
lines changed- lib
8 files changed
+468
-57
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | | - | |
| 31 | + | |
| 32 | + | |
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
28 | 36 | | |
29 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
30 | 42 | | |
31 | 43 | | |
32 | 44 | | |
| |||
45 | 57 | | |
46 | 58 | | |
47 | 59 | | |
48 | | - | |
| 60 | + | |
49 | 61 | | |
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
53 | 65 | | |
| 66 | + | |
54 | 67 | | |
55 | 68 | | |
56 | 69 | | |
57 | 70 | | |
58 | 71 | | |
59 | 72 | | |
60 | 73 | | |
61 | | - | |
| 74 | + | |
62 | 75 | | |
63 | 76 | | |
64 | 77 | | |
| |||
69 | 82 | | |
70 | 83 | | |
71 | 84 | | |
| 85 | + | |
72 | 86 | | |
73 | 87 | | |
74 | 88 | | |
75 | 89 | | |
76 | 90 | | |
77 | | - | |
78 | | - | |
79 | 91 | | |
80 | 92 | | |
81 | 93 | | |
| |||
0 commit comments