A modern, web-based integrated development environment for learning programming with Karel the Robot using C and WebAssembly.
Demo here: https://karel.comics.unina.it
Karel is a programming environment designed to teach fundamental programming concepts in a simple, visual way. Students write C code to control a robot (Karel) that moves around a grid world, picks up and puts down "beepers," and navigates around walls.
- Modern Web IDE: Full-featured code editor with syntax highlighting and multiple keybinding modes (Vim, Emacs, Sublime)
- Real-time Compilation: C code is compiled to WebAssembly and executed directly in the browser
- Visual Feedback: Interactive canvas showing Karel's world with grid, walls, beepers, and robot position
- Exercise System: Structured learning path with categorized programming challenges
- Responsive Design: Works seamlessly on desktop and mobile devices
- No Installation Required: Everything runs in the browser - no setup needed
- Frontend: React 18 + Vite
- Styling: Tailwind CSS
- Code Editor: ACE Editor with C syntax highlighting
- Compilation: Clang/LLVM compiled to WebAssembly
- Canvas Graphics: HTML5 Canvas for Karel's world visualization
- Build Tool: Vite for fast development and optimized builds
This IDE is designed to teach:
- Basic programming concepts (loops, conditionals, functions)
- Problem decomposition and algorithmic thinking
- C syntax and semantics
- Debugging and testing strategies
- Structured programming practices
src/
โโโ components/ # React components
โ โโโ Toolbar.jsx # Main navigation bar
โ โโโ Title.jsx # Exercise title and metadata display
โ โโโ TabComponent.jsx # Terminal and Canvas tabs
โ โโโ Sidebar.jsx # Exercise navigation
โโโ assets/
โ โโโ exercise/ # Exercise definitions and worlds
public/
โโโ karel/
โโโ clang # WebAssembly-compiled C compiler
โโโ lld # WebAssembly linker
โโโ memfs # In-memory file system
The Karel library provides these core functions:
karel_move()- Move forward one stepkarel_turn_left()- Turn 90 degrees counter-clockwise
karel_pick_beeper()- Pick up a beeper from current locationkarel_put_beeper()- Put down a beeper at current location
front_is_clear()- Check if can move forwardbeepers_present()- Check if beeper exists at current locationfacing_north(),facing_south(),facing_east(),facing_west()- Direction checks
karel_add_beeper(x, y)- Place beeper at coordinateskarel_add_horizontal_wall(x, y, length)- Add horizontal wall(s)karel_add_vertical_wall(x, y, length)- Add vertical wall(s)
-
Clone the repository
git clone https://github.com/giper45/KarelWebAssemblyIDE cd wasm-karen-clang -
Install dependencies
npm install
-
Start development server
npm run dev
-
Open your browser Navigate to
http://localhost:5173
Exercises are organized in the src/assets/exercise/ directory:
exercise/
โโโ 1/ # Exercise ID
โโโ world.c # World setup and robot behavior
โโโ exercise.c # Student starting code
โโโ README.md # Exercise description
โโโ SOLUTION.md # Solution explanation
โโโ metadata.json # Exercise metadata
- Themes: Switch between Light, Dark, and Classic editor themes
- Keybindings: Choose from Vim, Emacs, or Sublime Text key mappings
- Layout: Responsive design adapts to different screen sizes
Contributions are welcome! Please feel free to submit pull requests or open issues for:
- New exercises and challenges
- UI/UX improvements
- Performance optimizations
- Bug fixes
- Documentation improvements
This project is open source and available under the MIT License.
- Built on the WebAssembly compiler infrastructure by @binji
- Inspired by Stanford's Karel programming environment
- Uses modern web technologies to make programming education accessible
- Copilot Pro from my educational account makes this project really easier to be implemented. Thank you very much for GitHub Education plan!.
