Skip to content

Commit c353c20

Browse files
Claude/wokelang ebnf grammar qoe vv (#5)
* Implement WokeLang interpreter in Rust Complete implementation of WokeLang with: Lexer (src/lexer/): - Token definitions for all keywords, operators, literals - Uses logos for fast tokenization - Handles comments, strings with escapes, numbers Parser (src/parser/): - Recursive descent parser - Full expression parsing with correct precedence - All statement types: remember, when/otherwise, repeat, attempt safely - Pattern matching with decide based on - Emote tags, consent blocks, gratitude declarations AST (src/ast/): - Complete type definitions for all language constructs - Spanned nodes for error reporting Interpreter (src/interpreter/): - Tree-walking interpreter - Scoped environments for variables - Built-in functions: print, len, toString, toInt - Consent system with interactive prompts - Pattern matching evaluation - All operators (arithmetic, comparison, logical) CLI (src/main.rs): - woke <file.woke> - run program - woke --tokenize <file> - show tokens - woke --parse <file> - show AST Examples: - examples/hello.woke - feature showcase - examples/demo.woke - runnable demo * Add REPL, WASM compilation, and Zig FFI REPL (src/repl.rs): - Interactive command-line interface with rustyline - Commands: :help, :quit, :clear, :reset, :load, :ast - Expression evaluation with automatic result printing - Start with `woke` or `woke --repl` WASM Compilation (src/codegen/): - Compile WokeLang to WebAssembly binary format - Uses wasm-encoder for proper WASM generation - Supports functions, expressions, loops, conditionals - Pattern matching compilation - CLI: `woke -c input.woke` outputs input.wasm Zig FFI (src/ffi/, zig/, include/): - C-compatible API for embedding WokeLang - Interpreter lifecycle: woke_interpreter_new/free - Code execution: woke_exec, woke_eval - Value operations: type checking, conversion, creation - Static library (libwokelang.a) and shared library (.so) - C header (include/wokelang.h) - Zig bindings (zig/wokelang.zig) with idiomatic wrapper - Example Zig program and build.zig Other: - examples/math.woke - math functions for WASM demo - Cargo.toml updated for cdylib/staticlib targets * Add comprehensive documentation and wiki Includes: - Project roadmap (ROADMAP.md) with version timeline through v1.0 - Wiki home page with table of contents - Getting Started guides: Installation, Hello World, Basic Syntax, REPL - Language Guide: Functions, Control Flow, Error Handling, Variables/Types - Core Concepts: Consent System, Gratitude, Emote Tags - Reference: CLI, Built-in Functions, Keywords, Operators, Language Spec - Internals: Architecture, Lexer, Parser, Interpreter, WASM, FFI - Tutorial: Building a CLI app --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 92f4b95 commit c353c20

25 files changed

Lines changed: 9890 additions & 0 deletions

docs/ROADMAP.md

Lines changed: 291 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
# WokeLang Roadmap
2+
3+
> A human-centered, consent-driven programming language
4+
5+
## Vision
6+
7+
WokeLang aims to be a programming language that prioritizes:
8+
- **Human readability** over machine optimization
9+
- **Explicit consent** for sensitive operations
10+
- **Gratitude and attribution** as first-class concepts
11+
- **Emotional context** through emote annotations
12+
- **Safety by default** with gentle error handling
13+
14+
---
15+
16+
## Phase 1: Foundation (Current) ✅
17+
18+
### Core Language
19+
- [x] EBNF grammar specification
20+
- [x] Lexer with logos
21+
- [x] Recursive descent parser
22+
- [x] Complete AST types
23+
- [x] Tree-walking interpreter
24+
25+
### Basic Features
26+
- [x] Functions with `to`/`give back`
27+
- [x] Variables with `remember`
28+
- [x] Conditionals with `when`/`otherwise`
29+
- [x] Loops with `repeat...times`
30+
- [x] Basic types: Int, Float, String, Bool, Array
31+
32+
### Tooling
33+
- [x] CLI (`woke` command)
34+
- [x] Interactive REPL
35+
- [x] WASM compilation
36+
- [x] C/Zig FFI
37+
38+
---
39+
40+
## Phase 2: Language Completeness (Q1 2025)
41+
42+
### Type System
43+
- [ ] Static type inference
44+
- [ ] Generic types (`to map[T, U](list: [T], f: T -> U) -> [U]`)
45+
- [ ] Union types (`String | Int`)
46+
- [ ] Structural typing for records
47+
- [ ] Unit types with compile-time checking
48+
49+
### Pattern Matching
50+
- [ ] Destructuring in `decide based on`
51+
- [ ] Guard clauses
52+
- [ ] Exhaustiveness checking
53+
- [ ] Nested patterns
54+
55+
### Module System
56+
- [ ] Package management (`woke.toml`)
57+
- [ ] Import/export with `use`/`share`
58+
- [ ] Namespaces
59+
- [ ] Circular dependency detection
60+
61+
### Error Handling
62+
- [ ] Result types (`Okay[T] | Oops[E]`)
63+
- [ ] Error propagation operator (`?`)
64+
- [ ] Stack traces with source locations
65+
- [ ] Custom error types
66+
67+
---
68+
69+
## Phase 3: Concurrency & Safety (Q2 2025)
70+
71+
### Worker System
72+
- [ ] True async workers
73+
- [ ] Message passing between workers
74+
- [ ] Worker pools
75+
- [ ] Cancellation tokens
76+
77+
### Side Quests
78+
- [ ] Background task scheduling
79+
- [ ] Progress reporting
80+
- [ ] Resource cleanup
81+
82+
### Superpowers
83+
- [ ] Capability-based security
84+
- [ ] Permission inheritance
85+
- [ ] Audit logging
86+
- [ ] Sandboxing
87+
88+
### Consent System
89+
- [ ] Persistent consent storage
90+
- [ ] Scoped permissions
91+
- [ ] Consent revocation
92+
- [ ] Consent UI integration
93+
94+
---
95+
96+
## Phase 4: Standard Library (Q3 2025)
97+
98+
### Core Modules
99+
- [ ] `std.io` - File I/O with consent
100+
- [ ] `std.net` - Networking with consent
101+
- [ ] `std.json` - JSON parsing/generation
102+
- [ ] `std.time` - Date/time handling
103+
- [ ] `std.math` - Mathematical functions
104+
- [ ] `std.text` - String manipulation
105+
- [ ] `std.collections` - Data structures
106+
107+
### Consent-Aware Modules
108+
- [ ] `std.fs` - Filesystem with permission checks
109+
- [ ] `std.http` - HTTP client with URL consent
110+
- [ ] `std.crypto` - Cryptography primitives
111+
- [ ] `std.env` - Environment variables
112+
113+
### Unit System
114+
- [ ] `std.units.si` - SI units
115+
- [ ] `std.units.imperial` - Imperial units
116+
- [ ] `std.units.currency` - Currency types
117+
- [ ] Automatic unit conversion
118+
- [ ] Dimensional analysis
119+
120+
---
121+
122+
## Phase 5: Compiler & Performance (Q4 2025)
123+
124+
### WASM Target
125+
- [ ] Full WASM feature support
126+
- [ ] WASI integration
127+
- [ ] Memory management
128+
- [ ] String handling in WASM
129+
- [ ] Array operations
130+
- [ ] Exception handling
131+
132+
### Native Compilation
133+
- [ ] LLVM backend
134+
- [ ] Native binaries
135+
- [ ] Cross-compilation
136+
- [ ] Link-time optimization
137+
138+
### Optimizations
139+
- [ ] Constant folding
140+
- [ ] Dead code elimination
141+
- [ ] Inlining
142+
- [ ] Tail call optimization
143+
- [ ] Loop unrolling
144+
145+
---
146+
147+
## Phase 6: Tooling & Ecosystem (2026)
148+
149+
### IDE Support
150+
- [ ] VS Code extension
151+
- Syntax highlighting
152+
- Error diagnostics
153+
- Auto-completion
154+
- Go to definition
155+
- Rename refactoring
156+
- [ ] Language Server Protocol (LSP)
157+
- [ ] Tree-sitter grammar
158+
- [ ] Vim/Neovim plugin
159+
- [ ] JetBrains plugin
160+
161+
### Package Manager
162+
- [ ] `woke pkg` command
163+
- [ ] Central package registry
164+
- [ ] Version resolution
165+
- [ ] Lock files
166+
- [ ] Security auditing
167+
168+
### Testing
169+
- [ ] Built-in test framework
170+
- [ ] Property-based testing
171+
- [ ] Mocking support
172+
- [ ] Coverage reporting
173+
- [ ] Benchmark suite
174+
175+
### Documentation
176+
- [ ] `woke doc` generator
177+
- [ ] Inline documentation
178+
- [ ] Example extraction
179+
- [ ] API reference generation
180+
181+
---
182+
183+
## Phase 7: Frameworks (2026+)
184+
185+
### Web Framework (WokeWeb)
186+
- [ ] HTTP server
187+
- [ ] Routing with consent
188+
- [ ] Middleware system
189+
- [ ] Template engine
190+
- [ ] WebSocket support
191+
- [ ] Static file serving
192+
193+
### CLI Framework (WokeCLI)
194+
- [ ] Argument parsing
195+
- [ ] Interactive prompts
196+
- [ ] Progress bars
197+
- [ ] Color output
198+
- [ ] Configuration files
199+
200+
### GUI Framework (WokeUI)
201+
- [ ] Cross-platform windowing
202+
- [ ] Declarative UI
203+
- [ ] Event handling
204+
- [ ] Theming
205+
- [ ] Accessibility
206+
207+
### Data Framework (WokeData)
208+
- [ ] Database abstraction
209+
- [ ] Query builder
210+
- [ ] Migrations
211+
- [ ] Connection pooling
212+
- [ ] Consent-aware queries
213+
214+
---
215+
216+
## Technical Milestones
217+
218+
### Lexer Enhancements
219+
| Feature | Status | Version |
220+
|---------|--------|---------|
221+
| Unicode identifiers | Planned | 0.3.0 |
222+
| Heredoc strings | Planned | 0.3.0 |
223+
| Raw strings | Planned | 0.3.0 |
224+
| String interpolation | Planned | 0.4.0 |
225+
| Custom operators | Planned | 0.5.0 |
226+
227+
### Parser Enhancements
228+
| Feature | Status | Version |
229+
|---------|--------|---------|
230+
| Error recovery | Planned | 0.3.0 |
231+
| Incremental parsing | Planned | 0.5.0 |
232+
| Macro expansion | Planned | 0.6.0 |
233+
| Custom syntax | Planned | 1.0.0 |
234+
235+
### Compiler Targets
236+
| Target | Status | Version |
237+
|--------|--------|---------|
238+
| Tree-walking interpreter | ✅ Done | 0.1.0 |
239+
| WASM (basic) | ✅ Done | 0.1.0 |
240+
| WASM (full) | Planned | 0.4.0 |
241+
| LLVM IR | Planned | 0.6.0 |
242+
| Native (x86_64) | Planned | 0.7.0 |
243+
| Native (ARM64) | Planned | 0.8.0 |
244+
245+
### REPL Features
246+
| Feature | Status | Version |
247+
|---------|--------|---------|
248+
| Basic evaluation | ✅ Done | 0.1.0 |
249+
| History | ✅ Done | 0.1.0 |
250+
| Multi-line input | Planned | 0.2.0 |
251+
| Tab completion | Planned | 0.3.0 |
252+
| Syntax highlighting | Planned | 0.4.0 |
253+
| Debugger integration | Planned | 0.6.0 |
254+
255+
---
256+
257+
## Version Timeline
258+
259+
```
260+
2024 Q4 v0.1.0 Foundation release
261+
2025 Q1 v0.2.0 Type system, modules
262+
2025 Q2 v0.3.0 Concurrency, safety
263+
2025 Q3 v0.4.0 Standard library
264+
2025 Q4 v0.5.0 Optimizing compiler
265+
2026 Q1 v0.6.0 IDE support, LSP
266+
2026 Q2 v0.7.0 Package manager
267+
2026 Q3 v0.8.0 Web framework
268+
2026 Q4 v1.0.0 Stable release
269+
```
270+
271+
---
272+
273+
## Contributing
274+
275+
See [CONTRIBUTING.md](../CONTRIBUTING.md) for how to get involved.
276+
277+
### Priority Areas
278+
1. Standard library implementations
279+
2. Documentation and examples
280+
3. IDE tooling
281+
4. Performance optimization
282+
5. Security auditing
283+
284+
---
285+
286+
## Links
287+
288+
- [Language Specification](spec/language.md)
289+
- [Wiki Home](wiki/Home.md)
290+
- [API Reference](api/README.md)
291+
- [Tutorials](tutorials/README.md)

0 commit comments

Comments
 (0)