Usage
Runporf without any arguments:
Examples
Features
The REPL provides:Interactive evaluation
Interactive evaluation
Type JavaScript expressions and see results immediately
Multi-line input
Multi-line input
Write functions and complex expressions across multiple lines
Variable persistence
Variable persistence
Variables remain available throughout the session
Built-in commands
Built-in commands
Special REPL commands for convenience
REPL Commands
Show available REPL commands and help information
Clear the REPL context (reset all variables and functions)
Exit the REPL (same as Ctrl+D or Ctrl+C twice)
Cancel current multi-line input
Keyboard Shortcuts
- Once: Cancel current line
- Twice: Exit REPL
Exit REPL (on empty line)
Navigate command history
Auto-completion (if supported)
Example Session
Use Cases
Quick Testing
Test JavaScript expressions and functions quickly
Learning
Explore JavaScript features and Porffor’s capabilities
Debugging
Test isolated pieces of code to debug issues
Prototyping
Experiment with algorithms before writing full scripts
Multi-line Input
The REPL automatically detects incomplete expressions:Output Display
Implementation
Porffor’s REPL uses Node.js’s built-innode:repl module, providing:
- Standard REPL functionality
- Command history
- Tab completion (limited)
- Multi-line editing
- Syntax highlighting (terminal dependent)
Limitations
- Limited async support (Promise/await bugs)
- No variables between scopes (except args and globals)
- No
eval()orFunction()(AOT compilation) - Limited standard library support
Troubleshooting
Unexpected behavior
Exit not working
Multi-line input stuck
Comparison with Node.js REPL
| Feature | Porffor REPL | Node.js REPL |
|---|---|---|
| Basic evaluation | ✓ | ✓ |
| Multi-line | ✓ | ✓ |
| History | ✓ | ✓ |
| Tab completion | Limited | ✓ |
| Async/await | Limited | ✓ |
| Full stdlib | ✗ | ✓ |
| AOT compiled | ✓ | ✗ |
| Fast startup | ✓ | ✓ |
Advanced Usage
Tips
Paste code
Paste code
Paste multi-line code directly into REPL
Use history
Use history
Arrow keys navigate previous commands
- Up: Previous command
- Down: Next command
Quick exit
Quick exit
Fastest way to exit: Ctrl+D on empty line
Clear on error
Clear on error
If context gets messy, use
.clearVersion Info
Check Porffor version in REPL:Next Steps
Run Scripts
Execute JavaScript files
Profile Code
Analyze performance
Debug
Interactive debugging
Compile
Build Wasm binaries