rip-lang 1.3.13 → 1.4.2
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.
- package/CHANGELOG.md +74 -0
- package/README.md +10 -10
- package/docs/WHY-S-EXPRESSIONS.md +834 -0
- package/docs/dist/rip.browser.js +1925 -1806
- package/docs/dist/rip.browser.min.js +236 -226
- package/docs/dist/rip.browser.min.js.br +0 -0
- package/package.json +1 -1
- package/src/codegen.js +2696 -2531
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,80 @@ All notable changes to Rip will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.4.2] - 2025-11-07
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Critical: Fix 'in' operator with string literals** - Restores self-hosting!
|
|
12
|
+
- JavaScript's `in` operator checks numeric indices on strings, NOT characters
|
|
13
|
+
- `'\n' in "text"` incorrectly returns `false` (should check if newline exists)
|
|
14
|
+
- Fixed `generateIn()` to detect string literal checks and use `.includes()`
|
|
15
|
+
- Pattern: `'x' in variable` → runtime type check with `.includes()` for strings/arrays
|
|
16
|
+
- **This broke parser regeneration since Phase 1!** (`bun run parser` now works ✅)
|
|
17
|
+
- Added 7 tests for string literal `in` operator behavior
|
|
18
|
+
- Critical for bootstrap: solar.rip uses `'\n' in action` pattern
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- **Massive code cleanup** - Removed 2,042 lines of dead/duplicate code (28%)!
|
|
22
|
+
- Removed ALL 37 Phase 2 duplicate switch cases (1,614 lines) - never cleaned after extraction
|
|
23
|
+
- Removed old* cases (47 lines), error-throwing cases (26 lines), forwarding cases (185 lines)
|
|
24
|
+
- Removed duplicate property cases (149 lines), function cases (185 lines)
|
|
25
|
+
- Eliminated pointless switch wrapper with only default case (4 lines)
|
|
26
|
+
- Extracted duplicate `findPostfixConditional` helper (DRY principle)
|
|
27
|
+
- Added missing assignment operators to dispatch table
|
|
28
|
+
- Centralized number literal regex patterns
|
|
29
|
+
- Result: 7,263 → 5,239 LOC (27.9% reduction!)
|
|
30
|
+
|
|
31
|
+
### Documentation
|
|
32
|
+
- Consolidated AI agent docs into single AGENT.md (removed duplicate rip-agent-onboarding.md)
|
|
33
|
+
- Updated all LOC references (5,239 LOC, ~45% smaller than CoffeeScript)
|
|
34
|
+
- Cleaned up 8 obsolete planning docs
|
|
35
|
+
- Created simple .cursor/rules/rip-quick-start.md pointer
|
|
36
|
+
|
|
37
|
+
All 938 tests passing (100%) ✅
|
|
38
|
+
|
|
39
|
+
## [1.4.1] - 2025-11-07
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
- **Dispatch table Phase 2 complete** (#54) - Extracted all remaining 39 cases (100% complete!)
|
|
43
|
+
- Exception handling: `try`, `throw` (2 cases)
|
|
44
|
+
- Switch statements: `switch`, `when` (2 cases)
|
|
45
|
+
- Comprehensions: `comprehension`, `object-comprehension` (2 cases)
|
|
46
|
+
- Classes: `class`, `super`, `?call`, `?super` (4 cases)
|
|
47
|
+
- Modules: `import`, `export`, `export-default`, `export-all`, `export-from` (5 cases)
|
|
48
|
+
- Special forms: `do-iife`, `regex`, `tagged-template`, `str` (4 cases)
|
|
49
|
+
- **All 110 node types now in dispatch table** - Perfect O(1) lookup ✅
|
|
50
|
+
- Codegen organization complete - Easy to navigate and maintain
|
|
51
|
+
- File size: 6,203 → 7,263 LOC (+1,060 lines from extraction)
|
|
52
|
+
- All 931 tests passing (100%) ✅
|
|
53
|
+
|
|
54
|
+
## [1.4.0] - 2025-11-07
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
- **Major refactoring: Dispatch table architecture** (#52 Phase 1) - Extracted 71/110 cases (65%)
|
|
58
|
+
- Added O(1) dispatch table (was O(n) switch with 110 cases)
|
|
59
|
+
- Extracted 71 generator methods organized by category
|
|
60
|
+
- Shared methods for similar operations (DRY principle)
|
|
61
|
+
- Binary operators: 20+ cases → 1 shared method
|
|
62
|
+
- Assignment operators: 17 cases → 1 shared method
|
|
63
|
+
- All operators, property access, functions, loops, exception handling extracted
|
|
64
|
+
- ~1,500 lines reorganized into categorized methods
|
|
65
|
+
- Clear organization: operators, property access, functions, control flow, etc.
|
|
66
|
+
- Remaining 39 cases documented for Phase 2
|
|
67
|
+
- Test count: 926 → 931 (+5 tests from Issue #49)
|
|
68
|
+
|
|
69
|
+
## [1.3.14] - 2025-11-07
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
- **S-expression comprehension generation** (#49) - Removed string manipulation anti-pattern
|
|
73
|
+
- Replaced `unwrapComprehensionIIFE()` with s-expression-based approach
|
|
74
|
+
- Added `generateComprehensionWithTarget()` for direct array building
|
|
75
|
+
- No more generating IIFE then unwrapping with regex ✅
|
|
76
|
+
- Follows same philosophy as Issue #46 improvements
|
|
77
|
+
- **42 lines removed** (string manipulation eliminated)
|
|
78
|
+
- Safer, faster, cleaner code generation
|
|
79
|
+
- Test count: 926 → 931 (+5 tests)
|
|
80
|
+
- Added CODEGEN-ANALYSIS.md with optimization roadmap
|
|
81
|
+
|
|
8
82
|
## [1.3.13] - 2025-11-07
|
|
9
83
|
|
|
10
84
|
### Fixed
|
package/README.md
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-1.
|
|
12
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-1.4.0-blue.svg" alt="Version"></a>
|
|
13
13
|
<a href="#es2022-target"><img src="https://img.shields.io/badge/target-ES2022-blue.svg" alt="Target"></a>
|
|
14
|
-
<a href="#current-status"><img src="https://img.shields.io/badge/tests-
|
|
14
|
+
<a href="#current-status"><img src="https://img.shields.io/badge/tests-931%2F931-brightgreen.svg" alt="Tests"></a>
|
|
15
15
|
<a href="#current-status"><img src="https://img.shields.io/badge/coverage-100%25-brightgreen.svg" alt="Coverage"></a>
|
|
16
16
|
<a href="#zero-dependencies"><img src="https://img.shields.io/badge/dependencies-ZERO-brightgreen.svg" alt="Dependencies"></a>
|
|
17
17
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
**Write less. Do more. Zero dependencies.**
|
|
25
25
|
|
|
26
|
-
Rip brings CoffeeScript's elegance to modern JavaScript—but **
|
|
26
|
+
Rip brings CoffeeScript's elegance to modern JavaScript—but **45% smaller**, completely standalone, and self-hosting. No build tools, no external dependencies, not even a parser generator. Just clone and go.
|
|
27
27
|
|
|
28
28
|
#### 💎 Elegant syntax with modern features
|
|
29
29
|
|
|
@@ -183,15 +183,15 @@ case '+': {
|
|
|
183
183
|
}
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
**Result:
|
|
186
|
+
**Result: 45% smaller implementation**
|
|
187
187
|
|
|
188
188
|
| Component | CoffeeScript | Rip | Notes |
|
|
189
189
|
|-----------|--------------|-----|-------|
|
|
190
190
|
| Lexer+Rewriter | 3,558 LOC | **3,145 LOC** | Expanded syntax |
|
|
191
191
|
| Parser Generator | 2,285 LOC (Jison) | **928 LOC** (Solar) | Built-in, ~156× faster! |
|
|
192
|
-
| Compiler | 10,346 LOC (AST Nodes) | **
|
|
192
|
+
| Compiler | 10,346 LOC (AST Nodes) | **5,221 LOC** (S-expressions) | Clean dispatch table |
|
|
193
193
|
| Tools | 1,571 LOC (Repl, Cake) | **520 LOC** (Repl, Browser) | 3 Repl's + Browser |
|
|
194
|
-
| **Total** | **17,760 LOC** | **9,
|
|
194
|
+
| **Total** | **17,760 LOC** | **9,814 LOC** | **~45% smaller** |
|
|
195
195
|
|
|
196
196
|
**Plus:**
|
|
197
197
|
- ✅ **ZERO dependencies** - Everything included
|
|
@@ -886,8 +886,8 @@ Both syntaxes handle `null` and `undefined` - pick the style that fits your proj
|
|
|
886
886
|
│ Source │───>│ Lexer │───>│ Parser │───>│ Codegen │
|
|
887
887
|
│ Code │ │ (Coffee) │ │ (Solar) │ │ (Rip) │
|
|
888
888
|
└────────┘ └────────────┘ └──────────┘ └─────────┘
|
|
889
|
-
3,145 LOC 928 LOC
|
|
890
|
-
15 yrs tested Generated! S-expr
|
|
889
|
+
3,145 LOC 928 LOC 5,221 LOC
|
|
890
|
+
15 yrs tested Generated! S-expr w/Dispatch!
|
|
891
891
|
```
|
|
892
892
|
|
|
893
893
|
### Components
|
|
@@ -1200,7 +1200,7 @@ We considered allowing `x => expr` (ES6 style) but decided consistency and simpl
|
|
|
1200
1200
|
| Feature | CoffeeScript | Rip |
|
|
1201
1201
|
|---------|-------------|------|
|
|
1202
1202
|
| Syntax | ✅ Elegant | ✅ Elegant (inspired by CS) |
|
|
1203
|
-
| Implementation | 17,760 LOC | **9,
|
|
1203
|
+
| Implementation | 17,760 LOC | **9,814 LOC (~45% smaller)** |
|
|
1204
1204
|
| Dependencies | ❌ Multiple | ✅ **ZERO** |
|
|
1205
1205
|
| Parser Generator | ❌ External (Jison) | ✅ **Built-in (solar.rip)** |
|
|
1206
1206
|
| Self-Hosting | ❌ No | ✅ **Yes** |
|
|
@@ -1345,7 +1345,7 @@ Now supports both ES6 and CoffeeScript syntax:
|
|
|
1345
1345
|
- ✅ v0.5.0: **COMPLETE** - Dual syntax support! Postfix spread/rest (`x...`) + legacy existential (`x ? y`)!
|
|
1346
1346
|
- ✅ v0.5.1: **COMPLETE** - Smart comprehensions! Context-aware optimization, self-hosting, 843/843 tests!
|
|
1347
1347
|
- ✅ v0.9.0: **COMPLETE** - Production release! Zero dependencies, complete documentation, 43KB browser bundle!
|
|
1348
|
-
- ✅ v1.0.0: **
|
|
1348
|
+
- ✅ v1.0.0: **RELEASED** - Initial release! ~45% smaller than CoffeeScript! 🎉
|
|
1349
1349
|
|
|
1350
1350
|
See [CHANGELOG.md](CHANGELOG.md) for detailed progress.
|
|
1351
1351
|
|