Language Reference
Comprehensive syntax references for all three HoloScript formats.
Overview
HoloScript provides three file formats, each designed for different use cases:
.hs- Basic syntax for simple scenes and prototyping.hsplus- Extended syntax with state management, templates, and events.holo- Advanced syntax for VR/AR with entity-trait architecture
Quick Format Selection
Use .hs when:
- Learning HoloScript basics
- Creating simple static scenes
- Prototyping quickly
- No interactivity needed
Use .hsplus when:
- Need templates/reusability
- State management required
- Event-driven interactions
- Building games/apps
- Modular code organization
Use .holo when:
- Advanced trait-based configuration
- Complex spatial computing features
- VR/AR/XR experiences
- Fine-grained control over spatial primitives
Format-Specific References
Basic Syntax (.hs)
- Basic Objects Reference - Complete syntax guide for
.hsformat
Extended Syntax (.hsplus)
- Templates & Decorators - Template definitions, @decorators
- State & Actions - State management, actions, computed values
- Event Handlers - All event types and handlers
- Modules & Imports - Module system and code organization
Advanced Compositions (.holo)
- Entity-Trait Pattern - Entity declarations with traits
- Object-Template Pattern - Alternative
.holosyntax
Cross-Format Comparisons
See the same functionality implemented in all three formats:
- Comparison: Simple VR Scene - VR room with grabbable balls
- Comparison: Interactive Game - Target practice game with state and events
Feature Matrix
| Feature | .hs | .hsplus | .holo (entity) | .holo (object) |
|---|---|---|---|---|
| Basic objects | ✓ | ✓ | ✓ | ✓ |
| Templates | ✗ | ✓ | ✗ | ✓ |
| Decorators (@) | ✗ | ✓ | ✗ | ✓ |
| State blocks | ✗ | ✓ | ✗ | ✓ |
| Actions | ✗ | ✓ | ✗ | ✓ |
| Event handlers | ✗ | ✓ | ✓ | ✓ |
| Trait configs | ✗ | ✗ | ✓ | ✗ |
| Modules | ✗ | ✓ | ✗ | ✗ |
| Panels/UI | ✗ | ✓ | ✓ | ✓ |
For AI Agents
When generating HoloScript code:
- Detect format - Check file extension (
.hs/.hsplus/.holo) - Use appropriate syntax - Match the format's syntax patterns
- Reference examples - Use these references as templates
- Validate - Ensure generated code matches format rules
- Prefer simplest - Use
.hsfor simple,.hsplusfor medium,.holofor advanced
Source Code
All examples are available in the HoloScript repository.