인터랙티브 튜토리얼
Vais Tutorial System
Interactive tutorial system for learning the Vais programming language, inspired by the Rust Book.
Features
- 5 Comprehensive Chapters: From basic syntax to advanced traits and generics
- Interactive REPL: Learn by doing with immediate feedback
- Progress Tracking: Automatic saving of completed lessons and progress
- Hint System: Get help when you're stuck
- Code Validation: Verify your solutions with instant feedback
- Examples and Solutions: Learn from clear examples and reference solutions
Chapters
- Basic Syntax: Variables, functions, and types
- Control Flow: Conditionals, loops, and pattern matching
- Collections: Vectors, hash maps, and sets
- Error Handling: Option and Result types
- Structs and Traits: Custom types and shared behavior
Usage
Run Interactive Tutorial
cargo run --example tutorial_interactive
Run Demo
cargo run --example tutorial_demo
Available Commands
help- Show available commandschapters/ch- List all chapterslessons/ls [chapter]- List lessons in a chapterstart [chapter] [lesson]- Start a specific lessonnext/n- Move to the next lessonhint/h- Show a hint for the current lessonsolution/sol- Show the solutioncheck <file>- Check code from a fileverify <code>- Verify inline codeprogress/p- Show learning progressreset confirm- Reset all progressquit/exit/q- Exit the tutorial
Example Session
>>> chapters
Available Chapters:
0. Chapter 1: Basic Syntax [0/3]
Learn variables, functions, and basic types in Vais
1. Chapter 2: Control Flow [0/3]
Master conditionals, loops, and pattern matching
...
>>> start 0 0
═════════════════════════════════════════════════════════════
Chapter 0 - Lesson 1: Variables and Bindings
═════════════════════════════════════════════════════════════
Learn how to declare and use variables
[lesson content...]
>>> hint
Hint: Use the 'let' keyword to declare a variable
>>> check my_solution.vais
✓ All tests passed!
🎉 Lesson completed!
Testing
Run tests with:
cargo test
Integration
Use the tutorial system in your own projects:
use vais_tutorial::Tutorial;
let mut tutorial = Tutorial::new();
tutorial.list_chapters();
if let Some(lesson) = tutorial.get_lesson(0, 0) {
println!("Lesson: {}", lesson.title);
}
Progress File
Progress is automatically saved to ~/.vais_tutorial_progress.json. You can specify a custom location:
let tutorial = Tutorial::with_progress_file("my_progress.json");