Skip to content

Commit 47cd96c

Browse files
docs: Clean redundancy in docs and typos.
1 parent f3957f3 commit 47cd96c

9 files changed

Lines changed: 20 additions & 54 deletions

File tree

docs/pages/getting-started/introduction.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ Edge Python is a sandboxed Python subset compiled to a ~170 KB WebAssembly modul
1616

1717
## Try it
1818

19-
### Use in the Browser:
19+
### Browser:
2020

2121
Run Edge Python live in your browser at [demo.edgepython.com](https://demo.edgepython.com/).
2222

23-
### Download the Command Line Interface:
23+
### Command Line Interface:
2424

25-
Insted you can download in your computer ([reference docs](https://github.com/dylan-sutton-chavez/edge-python/tree/main/cli)):
25+
Or download it to your machine ([reference docs](https://github.com/dylan-sutton-chavez/edge-python/tree/main/cli)):
2626

2727
```bash
2828
curl -fsSL https://dylan-sutton-chavez.github.io/edge-python/install.sh | sh
2929

30-
edge -h # Explain all the commands
30+
edge -h # List all commands
3131
```

docs/pages/getting-started/quickstart.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,7 @@ Edge Python ships as a 170 KB WebAssembly module. Fastest way to try it, the pla
1111

1212
## Embed it
1313

14-
Two artifacts:
15-
16-
1. `compiler_lib.wasm` (170 KB, lexer, parser, stack VM).
17-
2. A loader. Browser: the [`runtime/`](https://github.com/dylan-sutton-chavez/edge-python/tree/main/runtime) package; WASI: your runtime's import API.
18-
19-
Build yourself:
20-
21-
```bash
22-
git clone https://github.com/dylan-sutton-chavez/edge-python
23-
cd edge-python/compiler
24-
cargo wasm # -> target/wasm32-unknown-unknown/release/compiler_lib.wasm
25-
```
26-
27-
Rust consumers can let cargo fetch the release artifact via `DEP_COMPILER_LIB_WASM` (see the repo README). No native CLI, `compiler_lib.wasm` is the artifact and the host owns I/O, network, time, module fetching. Full ABI: [What it is, Where it runs](/getting-started/what-it-is#where-it-runs).
14+
The playground is the fastest path; to put Edge Python in your own page, drop in the `<edge-python>` element below. Building the `.wasm` from source or embedding in Rust/WASI is covered in [Where it runs](/getting-started/what-it-is#where-it-runs).
2815

2916
### Drop-in HTML element
3017

docs/pages/getting-started/what-it-is.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Reads like Python (parses Python syntax). Runs differently, what it executes is
1717
* **Exceptions**: `try` / `except` / `else` / `finally`, named handlers, `raise X from Y` (chain info discarded but `X` is what propagates), and subclass-aware matching (`except Exception` catches `RuntimeError`).
1818
* **Context managers**: `with` and `async with` invoke `__enter__` / `__exit__` on the context-manager value; a truthy return from `__exit__` suppresses the raised exception.
1919
* **Protocol dunders**: operator overloading, indexing, iteration, hashing, and `repr` / `str` / `format` dispatch through user-defined dunders, see [Dunders](/language/dunders) for the full matrix.
20-
* **Numbers**: integers up to `±2^127` (auto-promoted past 47 bits; beyond the cap raises `OverflowError`) and full IEEE-754 floats. No `complex`, `Decimal`, `Fraction`, or arbitrary precision beyond 128 bits.
20+
* **Numbers**: bounded integers (fast inline path, auto-promoting to wide; see [Integer width](/reference/limits-and-errors#integer-width)) and full IEEE-754 floats. No `complex`, `Decimal`, or `Fraction`.
2121
* **Sequences**: lists, tuples, dicts (insertion-ordered), sets, frozensets, ranges, strings (UTF-8, codepoint-indexed), and bytes.
2222
* **f-strings**: full grammar, embedded expressions, `{expr=}` self-doc, `!r` / `!s` / `!a` conversions, and format specs covering `s d b o x X f F e E g G n % c` plus fill / align / sign / `#` / `0` / width / `,` / precision.
2323
* **Walrus operator**: `:=` in expressions (Name target only).
@@ -41,9 +41,9 @@ These parse for syntactic compatibility but raise at runtime, or simply don't ex
4141

4242
Multi-paradigm sandboxed compiler:
4343

44-
- **Smaller binary**, compiler + VM in 170 KB WebAssembly release.
44+
- **Small binary**, compiler + VM in one WebAssembly release.
4545
- **Faster interpreter**, no method-resolution overhead; hot opcodes promote to type-specialised fast paths via IC.
46-
- **Aggressive memoisation**, pure functions auto-cached; most functional code is pure by construction.
46+
- **Aggressive memoisation**, pure functions auto-cached after two hits ([Functions](/language/functions#generators)); most functional code is pure by construction.
4747
- **Easier sandboxing**, no protocol dispatch, no stdlib; attack surface is the fixed built-in set.
4848

4949
## Sandbox guarantees

docs/pages/implementation/design.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Classes support single-level inheritance, `super()`, full dunder dispatch, `@pro
1717
- **Single-pass SSA codegen**: Variables versioned per assignment (`x_1`, `x_2`). Control-flow joins emit `Phi` opcodes resolved at runtime.
1818
- **Token-threaded dispatch**: `Vec<Instruction>` where each is `(opcode: OpCode, operand: u16)`. Hot loop is a flat `match`; Rust lowers it to a jump table. Not direct threading (computed-goto isn't available in safe Rust).
1919
- **Per-instruction inline caching**: Each binary op records operand type tags. After `QUICK_THRESH = 4` stable hits the IC stores a typed `FastOp` (`AddInt`, `AddFloat`, `AddStr`, `LtFloat`, `EqStr`, `ModInt`, ...) as a speculative fast path with type-guard deopt.
20-
- **Template memoisation**: Pure user functions cache `(args) -> result` after `TPL_THRESH = 2` hits, capped at 256 entries per function. Gated on no-kw calls, an outer scope free of impure ops (`StoreItem`, `StoreAttr`, `Raise`, `Yield`, `Global`, `Nonlocal`, `Import`, ...), and byte-stable arguments (mutable containers disqualify). Hashing is an FNV-like fold over raw `Val.0` bits with a value-eq verify.
20+
- **Template memoisation**: pure user functions cache `(args) -> result` after `TPL_THRESH = 2` hits, capped at 256 entries each. Gated on no-kw calls, byte-stable args (mutable containers disqualify), and an impurity-free body (purity detection in [Syntax](/implementation/syntax#lambda-and-function-bodies)). Hashing is an FNV-like fold over raw `Val.0` bits with a value-eq verify.
2121
- **NaN-boxed values**: `Val` is a 64-bit union: 47-bit signed ints (inline), IEEE-754 floats (NaNs canonicalised), bools, None, an undef sentinel, and 28-bit heap indices.
2222
- **Mark-and-sweep GC**: Triggered when `live >= gc_threshold` or `alloc_count >= max(live/4, 4096)`. After each sweep `gc_threshold = max(live * 2, 512)`. Roots: stack, with-stack, yields, event queue, slots and live-slot snapshots, slot templates, globals, every iterator frame's `iter_stack`, opcode-cache constants, active const pools, function templates.
2323

@@ -77,7 +77,7 @@ Heap is a `Vec<HeapSlot>` arena with a free list (capped 524,288, sorted to pref
7777

7878
## Coroutine and context-manager dispatch
7979

80-
`async def` and `yield`-bearing `def` both produce `HeapObj::Coroutine`. `run()` drives the scheduler; `sleep`, `gather`, `with_timeout`, `cancel`, `receive` are top-level builtins. No `asyncio` module.
80+
`async def` and `yield`-bearing `def` both produce `HeapObj::Coroutine`. `run()` drives the scheduler; the other primitives are top-level builtins ([Async](/language/async)).
8181

8282
A plain `def` inside a coroutine calling a yielding builtin gets its state (`ip`, slots, stack/iter deltas) snapshotted as a `SyncFrame` pushed on the enclosing Coroutine's `sync_frames` (innermost-last). `resume_coroutine` walks this stack inside-out before re-entering the outer body, so each helper's return value lands at the original `Call` site, otherwise the outer's `resume_ip` would skip past the unfinished helper.
8383

docs/pages/implementation/syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Free variables (non-parameters with no local binding) are looked up in the outer
206206

207207
Parameter slots: `Normal`, `Star` (`*args`), `DoubleStar` (`**kwargs`). Lone `*` separator marks following params as keyword-only. Defaults live in `HeapObj::Func.defaults` and apply to the last-N positional slots. Annotations (`x: T`, `-> T`) parse and drain to `chunk.annotations` (tooling-only).
208208

209-
`compile_body` checks impurity opcodes (`StoreItem`, `StoreAttr`, `CallPrint`, `CallInput`, `Global`, `Nonlocal`, `Import`, `Raise`, `Yield`, `LoadAttr`) to set `body.is_pure`. Template memoisation caches pure `(args) -> result` after `TPL_THRESH = 2` hits (capped at 256 entries).
209+
`compile_body` checks impurity opcodes (`StoreItem`, `StoreAttr`, `CallPrint`, `CallInput`, `Global`, `Nonlocal`, `Import`, `Raise`, `Yield`, `LoadAttr`) to set `body.is_pure` — the flag that gates template memoisation ([Design](/implementation/design#concepts)).
210210

211211
## Type annotations
212212

docs/pages/language/data-types.md

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,7 @@ For runtime membership in a type, use [`isinstance`](/reference/builtins#isinsta
3333

3434
## Integer
3535

36-
Two-tier. **Inline (fast)**: 47-bit signed in a NaN-boxed `Val`, one ALU op per arithmetic, zero alloc. **LongInt (slow)**: i128 in a heap slot, auto when literal/result exceeds 47-bit. Boundary invisible, same `int` type, same operators. Hard cap ±2¹²⁷; wider -> `OverflowError`. No CPython unbounded ints; no complex (`1j`, `2+3j`).
37-
38-
```python
39-
# Inline range
40-
print(2 ** 46)
41-
print(2 ** 46 - 1)
42-
43-
# Auto-promoted to LongInt
44-
print(2 ** 100)
45-
46-
# Past the 128-bit cap
47-
try:
48-
print(2 ** 127)
49-
except OverflowError:
50-
print("overflow")
51-
```
52-
53-
```text Output
54-
70368744177664
55-
70368744177663
56-
1267650600228229401496703205376
57-
overflow
58-
```
36+
One `int` type, transparently two-tier: a fast inline path that auto-promotes to wide integers, capped at ±2¹²⁷ (full mechanics in [Integer width](/reference/limits-and-errors#integer-width)). No CPython unbounded ints; no complex (`1j`, `2+3j`).
5937

6038
```python
6139
# Modular exponentiation

docs/pages/language/dunders.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,14 @@ class K:
178178
def __eq__(self, o):
179179
return self.n == o.n
180180

181-
print(hash(K(5)))
182-
print({K(1): 'one'}[K(1)] if K(1).__hash__() == K(1).__hash__() else 'unhashable')
181+
k = K(5)
182+
print(hash(k))
183+
print({k: 'found'}[k]) # same instance reference looks up reliably
183184
```
184185

185186
```text Output
186187
5
187-
one
188+
found
188189
```
189190

190191
Built-in dict/set still compare instance keys by identity (`Val` bits); user `__hash__` is returned by `hash()` but doesn't change containment in built-in containers. Use the same instance reference to look up reliably.

docs/pages/language/syntax.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,22 +125,22 @@ hello world
125125

126126
### Escape sequences
127127

128-
Supported: `\n`, `\t`, `\r`, `\\`, `\'`, `\"`, `\0`, `\xHH`, `\uHHHH`, `\UHHHHHHHH`, `\NNN` (1\u20133 octal digits). Named-char escapes (`\N{GREEK SMALL LETTER ALPHA}`) not supported \u2014 use `\u`.
128+
Supported: `\n`, `\t`, `\r`, `\\`, `\'`, `\"`, `\0`, `\xHH`, `\uHHHH`, `\UHHHHHHHH`, `\NNN` (1–3 octal digits). Named-char escapes (`\N{GREEK SMALL LETTER ALPHA}`) not supported use `\u`.
129129

130130
```python
131131
print('\n line break')
132132
print('\t tab')
133133
print('\x41 hex')
134134
print('\u00e9 unicode')
135-
print('\101') # octal escape \u2014 'A'
135+
print('\101') # octal escape 'A'
136136
```
137137

138138
```text Output
139139
140140
line break
141141
tab
142142
A hex
143-
\u00e9 unicode
143+
é unicode
144144
A
145145
```
146146

docs/pages/reference/builtins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ print(c.x)
862862

863863
## Async
864864

865-
Top-level builtins, no `asyncio` module.
865+
Concurrency primitives; full model in [Async](/language/async).
866866

867867
### run
868868

0 commit comments

Comments
 (0)