Skip to content

A modern, web-based integrated development environment for learning programming with Karel the Robot using C and WebAssembly.

License

Apache-2.0 and 2 other licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
LICENSE.llvm
Unknown
LICENSE.vasm
Notifications You must be signed in to change notification settings

giper45/KarelWebAssemblyIDE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

46 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Karel WebAssembly IDE

Karel Icon

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

๐Ÿค– About Karel

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.

๐Ÿš€ Features

  • 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

๐Ÿ› ๏ธ Technology Stack

  • 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

๐ŸŽฏ Educational Goals

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

๐Ÿ—๏ธ Project Structure

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

๐ŸŽฎ Karel Programming API

The Karel library provides these core functions:

Movement

  • karel_move() - Move forward one step
  • karel_turn_left() - Turn 90 degrees counter-clockwise

Beeper Operations

  • karel_pick_beeper() - Pick up a beeper from current location
  • karel_put_beeper() - Put down a beeper at current location

World Sensing

  • front_is_clear() - Check if can move forward
  • beepers_present() - Check if beeper exists at current location
  • facing_north(), facing_south(), facing_east(), facing_west() - Direction checks

World Setup

  • karel_add_beeper(x, y) - Place beeper at coordinates
  • karel_add_horizontal_wall(x, y, length) - Add horizontal wall(s)
  • karel_add_vertical_wall(x, y, length) - Add vertical wall(s)

๐Ÿš€ Getting Started

  1. Clone the repository

    git clone https://github.com/giper45/KarelWebAssemblyIDE
    cd wasm-karen-clang
  2. Install dependencies

    npm install
  3. Start development server

    npm run dev
  4. Open your browser Navigate to http://localhost:5173

๐Ÿ“š Exercise System

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

๐ŸŽจ Customization

  • 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

๐Ÿค Contributing

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

๐Ÿ“„ License

This project is open source and available under the MIT License.

๐Ÿ™ Acknowledgments

  • 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!.

About

A modern, web-based integrated development environment for learning programming with Karel the Robot using C and WebAssembly.

Resources

License

Apache-2.0 and 2 other licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
LICENSE.llvm
Unknown
LICENSE.vasm

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published