rip-lang 1.0.0
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/.cursor/rules/rip-agent-onboarding.md +681 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +98 -0
- package/.github/ISSUE_TEMPLATE/coffeescript_compatibility.yml +86 -0
- package/.github/ISSUE_TEMPLATE/config.yml +9 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +82 -0
- package/.github/ISSUE_TEMPLATE/question.yml +55 -0
- package/.github/pull_request_template.md +84 -0
- package/AGENT.md +623 -0
- package/CONTRIBUTING.md +331 -0
- package/LICENSE +21 -0
- package/README.md +1245 -0
- package/SETUP.md +144 -0
- package/bar.coffee +394 -0
- package/bin/rip +162 -0
- package/bunfig.toml +11 -0
- package/docs/BROWSER.md +983 -0
- package/docs/CODEGEN.md +1023 -0
- package/docs/COFFEESCRIPT-COMPARISON.md +740 -0
- package/docs/COMPREHENSIONS.md +572 -0
- package/docs/REGEX-PLUS.md +441 -0
- package/docs/SOLAR.md +846 -0
- package/docs/SPECIAL-OPERATORS.md +769 -0
- package/docs/STRING.md +363 -0
- package/docs/WHY-NOT-COFFEESCRIPT.md +184 -0
- package/docs/WHY-YES-RIP.md +690 -0
- package/docs/WORKFLOW.md +306 -0
- package/docs/dist/rip.browser.js +6798 -0
- package/docs/dist/rip.browser.min.js +242 -0
- package/docs/dist/rip.browser.min.js.br +0 -0
- package/docs/example.html +177 -0
- package/docs/examples/README.md +154 -0
- package/docs/examples/arrows.rip +84 -0
- package/docs/examples/async-await.rip +59 -0
- package/docs/examples/existential.rip +86 -0
- package/docs/examples/fibonacci.rip +12 -0
- package/docs/examples/module.rip +38 -0
- package/docs/examples/object-syntax.rip +74 -0
- package/docs/examples/prototype.rip +30 -0
- package/docs/examples/ranges.rip +45 -0
- package/docs/examples/switch.rip +50 -0
- package/docs/examples/ternary.rip +36 -0
- package/docs/examples/use-loader.js +9 -0
- package/docs/examples/utils.rip +20 -0
- package/docs/index.html +65 -0
- package/docs/repl.html +914 -0
- package/docs/rip-1280w.png +0 -0
- package/docs/rip.svg +4 -0
- package/package.json +52 -0
- package/rip-loader.ts +27 -0
- package/scripts/build-browser.js +76 -0
- package/scripts/serve.js +71 -0
- package/src/browser.js +97 -0
- package/src/codegen.js +4808 -0
- package/src/compiler.js +270 -0
- package/src/grammar/grammar.rip +801 -0
- package/src/grammar/solar.rip +1056 -0
- package/src/lexer.js +3145 -0
- package/src/parser.js +352 -0
- package/src/repl.js +423 -0
- package/test/rip/assignment.rip +115 -0
- package/test/rip/async.rip +361 -0
- package/test/rip/basic.rip +171 -0
- package/test/rip/classes.rip +167 -0
- package/test/rip/compatibility.rip +338 -0
- package/test/rip/comprehensions.rip +104 -0
- package/test/rip/control.rip +177 -0
- package/test/rip/data.rip +215 -0
- package/test/rip/errors.rip +129 -0
- package/test/rip/functions.rip +443 -0
- package/test/rip/guards.rip +247 -0
- package/test/rip/literals.rip +131 -0
- package/test/rip/loops.rip +117 -0
- package/test/rip/modules.rip +87 -0
- package/test/rip/operators.rip +158 -0
- package/test/rip/optional.rip +184 -0
- package/test/rip/properties.rip +94 -0
- package/test/rip/regex.rip +301 -0
- package/test/rip/stabilization.rip +825 -0
- package/test/rip/strings.rip +483 -0
- package/test/runner.js +329 -0
package/docs/WORKFLOW.md
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
# GitHub Workflow Quick Reference
|
|
2
|
+
|
|
3
|
+
**For AI Agents & Developers**
|
|
4
|
+
|
|
5
|
+
This is the standard workflow used in this project. See `../CONTRIBUTING.md` for detailed walkthrough with real examples.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The 10-Step Workflow
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# 1. Find/identify bug or feature need
|
|
13
|
+
echo 'failing code' | ./bin/rip -s # Debug with -s, -t, -c flags
|
|
14
|
+
|
|
15
|
+
# 2. Create GitHub issue
|
|
16
|
+
gh issue create --title "..." --label "bug" --body "..."
|
|
17
|
+
|
|
18
|
+
# 3. Create feature branch
|
|
19
|
+
git checkout -b fix/issue-name
|
|
20
|
+
|
|
21
|
+
# 4. Write failing tests FIRST
|
|
22
|
+
# Edit test/rip/RELEVANT_FILE.rip
|
|
23
|
+
bun test/runner.js test/rip/RELEVANT_FILE.rip # Verify they fail
|
|
24
|
+
|
|
25
|
+
# 5. Implement the fix
|
|
26
|
+
# - Grammar change? Edit src/grammar/grammar.rip then: bun run parser
|
|
27
|
+
# - Codegen change? Edit src/codegen.js
|
|
28
|
+
# - Solar change? Edit src/grammar/solar.rip then: bun run parser
|
|
29
|
+
|
|
30
|
+
# 6. Verify tests pass
|
|
31
|
+
bun run test # All tests must pass
|
|
32
|
+
|
|
33
|
+
# 7. Build browser bundle (if code changes)
|
|
34
|
+
bun run browser # Updates web REPL
|
|
35
|
+
|
|
36
|
+
# 8. Update documentation
|
|
37
|
+
# - README.md (if user-facing change)
|
|
38
|
+
# - docs/CODEGEN.md (if new node types)
|
|
39
|
+
# - Test count updates
|
|
40
|
+
|
|
41
|
+
# 9. Commit with issue reference
|
|
42
|
+
git add <files>
|
|
43
|
+
git commit -m "Fix: Description
|
|
44
|
+
|
|
45
|
+
Fixes #N ← This auto-closes the issue when PR merges!
|
|
46
|
+
|
|
47
|
+
- Bullet points of changes
|
|
48
|
+
- Test results
|
|
49
|
+
|
|
50
|
+
All tests passing: X/Y (100%)"
|
|
51
|
+
|
|
52
|
+
# 10. Push, create PR, merge
|
|
53
|
+
git push origin fix/issue-name
|
|
54
|
+
gh pr create --title "..." --base main --body "Fixes #N ..."
|
|
55
|
+
gh pr merge <number> --squash --delete-branch
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Critical Details
|
|
61
|
+
|
|
62
|
+
### Issue References
|
|
63
|
+
|
|
64
|
+
**Always include in commit message:**
|
|
65
|
+
```
|
|
66
|
+
Fixes #N
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This **auto-closes the issue** when the PR is merged! 🪄
|
|
70
|
+
|
|
71
|
+
### Test Count Updates
|
|
72
|
+
|
|
73
|
+
When tests change, update in **README.md**:
|
|
74
|
+
- Badge: `tests-X%2FY-brightgreen.svg`
|
|
75
|
+
- Multiple locations (search for old count)
|
|
76
|
+
|
|
77
|
+
### Files That Are Generated (Don't Edit Directly)
|
|
78
|
+
|
|
79
|
+
- ❌ `src/parser.js` - Regenerate with `bun run parser`
|
|
80
|
+
- ⚠️ `src/lexer.js` - Only edit Rewriter section
|
|
81
|
+
- ❌ `src/grammar/solar.rip` - Given (don't modify)
|
|
82
|
+
|
|
83
|
+
**If you need to change parser behavior:**
|
|
84
|
+
- Edit `src/grammar/solar.rip` for runtime behavior (parseError, etc.)
|
|
85
|
+
- Edit `src/grammar/grammar.rip` for grammar rules
|
|
86
|
+
- Then: `bun run parser`
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## When to Use Workflow vs Direct Commit
|
|
91
|
+
|
|
92
|
+
### Use Full Workflow When:
|
|
93
|
+
- 🐛 **Bug fixes** - Track issue → resolution
|
|
94
|
+
- ✨ **New features** - Document design decisions
|
|
95
|
+
- 🔧 **Breaking changes** - Need review/discussion
|
|
96
|
+
- 📚 **Complex changes** - Multiple files/systems
|
|
97
|
+
|
|
98
|
+
### Direct Commit to Main When:
|
|
99
|
+
- 📝 **Documentation only** - No code changes
|
|
100
|
+
- 🧪 **Test additions** - Documenting existing behavior
|
|
101
|
+
- 🎨 **Formatting/style** - Trivial changes
|
|
102
|
+
- 🔖 **Version bumps** - Routine maintenance
|
|
103
|
+
|
|
104
|
+
**When in doubt, use the workflow!** It creates a paper trail.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Quick Commands
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Check auth
|
|
112
|
+
gh auth status
|
|
113
|
+
|
|
114
|
+
# List issues
|
|
115
|
+
gh issue list
|
|
116
|
+
|
|
117
|
+
# View issue
|
|
118
|
+
gh issue view <number>
|
|
119
|
+
|
|
120
|
+
# List PRs
|
|
121
|
+
gh pr list
|
|
122
|
+
|
|
123
|
+
# View PR
|
|
124
|
+
gh pr view <number>
|
|
125
|
+
|
|
126
|
+
# Check branch
|
|
127
|
+
git branch --show-current
|
|
128
|
+
|
|
129
|
+
# Check what's changed
|
|
130
|
+
git status
|
|
131
|
+
git diff
|
|
132
|
+
|
|
133
|
+
# Run specific tests
|
|
134
|
+
bun test/runner.js test/rip/FILE.rip
|
|
135
|
+
|
|
136
|
+
# Debug flags
|
|
137
|
+
./bin/rip -t code.rip # Tokens
|
|
138
|
+
./bin/rip -s code.rip # S-expressions
|
|
139
|
+
./bin/rip -c code.rip # JavaScript
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Example Session
|
|
145
|
+
|
|
146
|
+
**Real example from Issue #1 → PR #2:**
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Found: Postfix comprehensions with 'by' step fail to parse
|
|
150
|
+
echo '(x for x in [0...10] by 2)' | ./bin/rip -s # Parse error!
|
|
151
|
+
|
|
152
|
+
# Created issue
|
|
153
|
+
gh issue create --title "Postfix comprehensions with 'by' step fail to parse" ...
|
|
154
|
+
# → Issue #1
|
|
155
|
+
|
|
156
|
+
# Created branch
|
|
157
|
+
git checkout -b fix/postfix-comprehension-by-step
|
|
158
|
+
|
|
159
|
+
# Added 3 failing tests
|
|
160
|
+
# Edited test/rip/comprehensions.rip
|
|
161
|
+
|
|
162
|
+
# Fixed grammar + codegen
|
|
163
|
+
# Edited src/grammar/grammar.rip (added 3 rules)
|
|
164
|
+
bun run parser
|
|
165
|
+
# Edited src/codegen.js (handle step parameter)
|
|
166
|
+
|
|
167
|
+
# Verified fix
|
|
168
|
+
bun run test # 846/846 passing (+3)
|
|
169
|
+
|
|
170
|
+
# Updated README
|
|
171
|
+
# Changed 843 → 846
|
|
172
|
+
|
|
173
|
+
# Committed
|
|
174
|
+
git add README.md src/codegen.js src/grammar/grammar.rip src/parser.js test/rip/comprehensions.rip
|
|
175
|
+
git commit -m "Fix: Add support for postfix comprehensions with 'by' step
|
|
176
|
+
|
|
177
|
+
Fixes #1
|
|
178
|
+
...
|
|
179
|
+
All tests passing: 846/846 (100%)"
|
|
180
|
+
|
|
181
|
+
# Created PR
|
|
182
|
+
git push origin fix/postfix-comprehension-by-step
|
|
183
|
+
gh pr create --title "..." --body "Fixes #1 ..."
|
|
184
|
+
# → PR #2
|
|
185
|
+
|
|
186
|
+
# Merged
|
|
187
|
+
gh pr merge 2 --squash --delete-branch
|
|
188
|
+
# → Issue #1 automatically closed! ✅
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Total time:** ~15 minutes for complete workflow
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Common Pitfalls
|
|
196
|
+
|
|
197
|
+
### ❌ Forget to reference issue
|
|
198
|
+
```
|
|
199
|
+
git commit -m "Fix bug" # ← Issue won't auto-close!
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### ✅ Always reference
|
|
203
|
+
```
|
|
204
|
+
git commit -m "Fix: Description
|
|
205
|
+
|
|
206
|
+
Fixes #N ← This is the magic!
|
|
207
|
+
..."
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### ❌ Edit generated files
|
|
211
|
+
```
|
|
212
|
+
vim src/parser.js # ← Changes lost on next bun run parser!
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### ✅ Edit source files
|
|
216
|
+
```
|
|
217
|
+
vim src/grammar/grammar.rip
|
|
218
|
+
bun run parser # Regenerates parser.js
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### ❌ Skip tests
|
|
222
|
+
```
|
|
223
|
+
# Make fix, commit immediately # ← Might break things!
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### ✅ Always test
|
|
227
|
+
```
|
|
228
|
+
bun run test # MUST pass before committing
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Workflow Variants
|
|
234
|
+
|
|
235
|
+
### Variant A: Combined PR (Multiple Issues)
|
|
236
|
+
|
|
237
|
+
When fixes are related:
|
|
238
|
+
```
|
|
239
|
+
Fixes #7, Fixes #9
|
|
240
|
+
|
|
241
|
+
Two enhancements in one PR...
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Both issues auto-close when PR merges.
|
|
245
|
+
|
|
246
|
+
### Variant B: Stacked PRs
|
|
247
|
+
|
|
248
|
+
For dependent changes:
|
|
249
|
+
```bash
|
|
250
|
+
# PR #1: Foundation
|
|
251
|
+
git checkout -b feat/foundation
|
|
252
|
+
# ... work ...
|
|
253
|
+
gh pr create
|
|
254
|
+
|
|
255
|
+
# PR #2: Building on PR #1
|
|
256
|
+
git checkout -b feat/extension
|
|
257
|
+
# ... work ...
|
|
258
|
+
gh pr create --base feat/foundation # ← Base on other branch!
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Pro Tips
|
|
264
|
+
|
|
265
|
+
1. **Small, focused PRs** - Easier to review and merge
|
|
266
|
+
2. **Test-driven** - Write failing tests first
|
|
267
|
+
3. **Commit messages** - Clear, descriptive, reference issues
|
|
268
|
+
4. **Browser bundle** - Always rebuild before committing code changes
|
|
269
|
+
5. **Clean git history** - Use `--squash` merge to keep main clean
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## For AI Agents
|
|
274
|
+
|
|
275
|
+
**When resuming work on an issue:**
|
|
276
|
+
|
|
277
|
+
1. **Read the issue** - `gh issue view <number>`
|
|
278
|
+
2. **Check if branch exists** - `git branch -a | grep issue-name`
|
|
279
|
+
3. **Read ISSUE-N.md** if it exists (handoff docs)
|
|
280
|
+
4. **Review related docs** - ../AGENT.md, COMPREHENSIONS.md, etc.
|
|
281
|
+
5. **Check test status** - `bun run test`
|
|
282
|
+
6. **Follow the 10 steps above**
|
|
283
|
+
|
|
284
|
+
**When stuck:**
|
|
285
|
+
- Check `../CONTRIBUTING.md` for full examples
|
|
286
|
+
- Review closed PRs for patterns
|
|
287
|
+
- Use debug flags: `-t`, `-s`, `-c`
|
|
288
|
+
- Read tests for expected behavior
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Success Metrics
|
|
293
|
+
|
|
294
|
+
**Today's session (2025-10-31):**
|
|
295
|
+
- ✅ 5 complete workflows executed
|
|
296
|
+
- ✅ 2 direct commits (documentation)
|
|
297
|
+
- ✅ 11 tests added (843 → 854)
|
|
298
|
+
- ✅ 100% test pass rate maintained
|
|
299
|
+
- ✅ All issues auto-closed via `Fixes #N`
|
|
300
|
+
- ✅ bar.coffee now compiles (was broken)
|
|
301
|
+
|
|
302
|
+
**This workflow works!** 🎉
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
See `../CONTRIBUTING.md` for detailed walkthrough with real examples from Issue #1/PR #2.
|