How hsantosdias/hpp-lang works
H++ is an educational robotics language whose main workflow is compiling bilingual source into executable statements, then running those statements cycle by cycle against host-provided hardware. The repository also provides universal motion semantics and separate soccer, line-following, and maze extension contracts. The README documents the broader runtime and adapter boundary; some subsystem wiring is therefore shown only where supported by the sampled source or explicit architecture description.
Main entry points: interpreter.ts Interpreter · index.ts Public API · capabilities.ts Capability Model · parser.ts Parser
Components 19
Language Core
- Public API
packages/hpp-lang/src/index.ts - Lexer
packages/hpp-lang/src/lexer.ts - Parser
packages/hpp-lang/src/parser.ts - AST
packages/hpp-lang/src/ast.ts - Interpreter
packages/hpp-lang/src/interpreter.ts - Cycle Runtime
packages/hpp-lang/src/runtime.ts - Runtime Errors
packages/hpp-lang/src/errors.ts
Robotics Runtime
- Motion State
packages/hpp-lang/src/robotics/motion.ts - Motion Contracts
packages/hpp-lang/src/robotics/contracts.ts - Capability Model
packages/hpp-lang/src/capabilities.ts - Sensor Snapshot
packages/hpp-lang/src/robotics/sensors.ts
Domain Extensions
- Soccer Extension
packages/hpp-lang/src/extensions/soccer/index.ts - Line Extension
packages/hpp-lang/src/extensions/line/index.ts - Maze Extension
packages/hpp-lang/src/extensions/maze/index.ts
Hardware Boundary
- Hardware Contract
packages/hpp-lang/src/hardware.ts - Host Adapter
Other components
- Program Author
- H++ Source
- Robot or Simulator
Connections 20
- Program Author → H++ Source: writes
- H++ Source → Public API: compiles
- Public API → Lexer: tokenizes
- Public API → Parser: parses
- Lexer → Parser: passes tokens
- Parser → AST: produces
- Public API → Interpreter: runs program
- AST → Interpreter: executes
- Cycle Runtime → Interpreter: cycles
- Interpreter → Motion State: updates movement
- Interpreter → Capability Model: checks requirements
- Interpreter → Runtime Errors: raises
- Motion Contracts → Motion State: defines commands
- Soccer Extension → Capability Model: declares capabilities
- Line Extension → Capability Model: declares capabilities
- Maze Extension → Capability Model: declares capabilities
- Interpreter → Hardware Contract: reads sensors; dispatches actions
- Hardware Contract → Host Adapter: implemented by
- Host Adapter → Robot or Simulator: controls
- Host Adapter → Sensor Snapshot: provides readings