# scenic-foundation/scenic architecture

> Architecture diagram of the GitHub repository scenic-foundation/scenic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/scenic-foundation/scenic
- Repository: https://github.com/scenic-foundation/scenic

## Overview

Scenic compiles probabilistic scenario descriptions and generates scenes for cyber-physical systems; users can then run scenarios through simulator interfaces. The graph preserves the compiler, scene-modeling, constraints, dynamics, driving-road, and simulation stages, plus core evaluation layers. The README establishes the product workflow, while source-index references support the cited internal links. Several listed capabilities—especially syntax translation internals and simulator integrations—were not sampled, so their connections are omitted rather than inferred.

Main entry points: [`src/scenic/core/dynamics/scenarios.py`](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/dynamics/scenarios.py) (Dynamic scenarios), [`src/scenic/__init__.py`](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/__init__.py) (Scenic API), [`src/scenic/core/simulators.py`](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/simulators.py) (Simulation runtime), [`src/scenic/domains/driving/roads.py`](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/domains/driving/roads.py) (Driving roads)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_language["Language and Compilation"]
  node_api["Scenic API<br/>[__init__.py]"]
  node_translator["Scenario translator<br/>[translator.py]"]
  node_veneer["Language veneer<br/>[veneer.py]"]
end

subgraph group_model["Scene Modeling"]
  node_distribution["Distributions<br/>[distributions.py]"]
  node_lazy["Lazy evaluation<br/>[lazy_eval.py]"]
  node_types["Type support<br/>[type_support.py]"]
  node_vectors["Vectors<br/>[vectors.py]"]
  node_geometry["Geometry<br/>[geometry.py]"]
  node_regions["Regions<br/>[regions.py]"]
  node_objects["Scene objects<br/>[object_types.py]"]
  node_shapes["Shapes<br/>[shapes.py]"]
end

subgraph group_dynamics["Constraints and Dynamics"]
  node_requirements["Requirements<br/>[requirements.py]"]
  node_dynamic_scenarios["Dynamic scenarios<br/>[scenarios.py]"]
  node_actions["Actions<br/>[actions.py]"]
  node_invocables["Behaviors and invocables<br/>[invocables.py]"]
end

subgraph group_simulation["Simulation and Domains"]
  node_serialization["Serialization<br/>[serialization.py]"]
  node_simulator_core["Simulation runtime<br/>[simulators.py]"]
  node_driving_roads["Driving roads<br/>[roads.py]"]
  node_opendrive["OpenDRIVE parser<br/>[xodr_parser.py]"]
  node_carla["CARLA adapter<br/>[simulator.py]"]
  node_metadrive["MetaDrive adapter<br/>[simulator.py]"]
  node_newtonian["Newtonian adapter<br/>[simulator.py]"]
end

node_user(("Scenario author"))

node_user -->|"uses"| node_api
node_api -->|"exposes"| node_translator
node_dynamic_scenarios -->|"uses"| node_requirements
node_dynamic_scenarios -->|"uses"| node_actions
node_dynamic_scenarios -->|"uses"| node_invocables
node_driving_roads -->|"parses with"| node_opendrive
node_metadrive -->|"implements"| node_simulator_core
node_newtonian -->|"implements"| node_simulator_core

click node_api "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/__init__.py"
click node_translator "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/syntax/translator.py"
click node_veneer "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/syntax/veneer.py"
click node_distribution "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/distributions.py"
click node_lazy "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/lazy_eval.py"
click node_types "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/type_support.py"
click node_vectors "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/vectors.py"
click node_geometry "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/geometry.py"
click node_regions "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/regions.py"
click node_objects "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/object_types.py"
click node_shapes "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/shapes.py"
click node_requirements "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/requirements.py"
click node_dynamic_scenarios "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/dynamics/scenarios.py"
click node_actions "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/dynamics/actions.py"
click node_invocables "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/dynamics/invocables.py"
click node_serialization "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/serialization.py"
click node_simulator_core "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/simulators.py"
click node_driving_roads "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/domains/driving/roads.py"
click node_opendrive "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/formats/opendrive/xodr_parser.py"
click node_carla "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/simulators/carla/simulator.py"
click node_metadrive "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/simulators/metadrive/simulator.py"
click node_newtonian "https://github.com/scenic-foundation/scenic/blob/main/src/scenic/simulators/newtonian/simulator.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_translator,node_veneer toneBlue
class node_distribution,node_lazy,node_types,node_vectors,node_geometry,node_regions,node_objects,node_shapes toneAmber
class node_requirements,node_dynamic_scenarios,node_actions,node_invocables toneMint
class node_serialization,node_simulator_core,node_driving_roads,node_opendrive,node_carla,node_metadrive,node_newtonian toneRose
class node_user toneIndigo
```

## Components

### Language and Compilation

- [Scenic API](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/__init__.py): `src/scenic/__init__.py`
- [Scenario translator](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/syntax/translator.py): `src/scenic/syntax/translator.py`
- [Language veneer](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/syntax/veneer.py): `src/scenic/syntax/veneer.py`

### Scene Modeling

- [Distributions](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/distributions.py): `src/scenic/core/distributions.py`
- [Lazy evaluation](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/lazy_eval.py): `src/scenic/core/lazy_eval.py`
- [Type support](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/type_support.py): `src/scenic/core/type_support.py`
- [Vectors](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/vectors.py): `src/scenic/core/vectors.py`
- [Geometry](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/geometry.py): `src/scenic/core/geometry.py`
- [Regions](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/regions.py): `src/scenic/core/regions.py`
- [Scene objects](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/object_types.py): `src/scenic/core/object_types.py`
- [Shapes](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/shapes.py): `src/scenic/core/shapes.py`

### Constraints and Dynamics

- [Requirements](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/requirements.py): `src/scenic/core/requirements.py`
- [Dynamic scenarios](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/dynamics/scenarios.py): `src/scenic/core/dynamics/scenarios.py`
- [Actions](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/dynamics/actions.py): `src/scenic/core/dynamics/actions.py`
- [Behaviors and invocables](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/dynamics/invocables.py): `src/scenic/core/dynamics/invocables.py`

### Simulation and Domains

- [Serialization](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/serialization.py): `src/scenic/core/serialization.py`
- [Simulation runtime](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/core/simulators.py): `src/scenic/core/simulators.py`
- [Driving roads](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/domains/driving/roads.py): `src/scenic/domains/driving/roads.py`
- [OpenDRIVE parser](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/formats/opendrive/xodr_parser.py): `src/scenic/formats/opendrive/xodr_parser.py`
- [CARLA adapter](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/simulators/carla/simulator.py): `src/scenic/simulators/carla/simulator.py`
- [MetaDrive adapter](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/simulators/metadrive/simulator.py): `src/scenic/simulators/metadrive/simulator.py`
- [Newtonian adapter](https://github.com/scenic-foundation/scenic/blob/main/src/scenic/simulators/newtonian/simulator.py): `src/scenic/simulators/newtonian/simulator.py`

### Other components

- **Scenario author**

## Connections

- Scenario author → Scenic API: uses
- Scenic API → Scenario translator: exposes (evidence: `src/scenic/__init__.py`)
- Dynamic scenarios → Requirements: uses (evidence: `src/scenic/core/dynamics/scenarios.py`)
- Dynamic scenarios → Actions: uses (evidence: `src/scenic/core/dynamics/scenarios.py`)
- Dynamic scenarios → Behaviors and invocables: uses (evidence: `src/scenic/core/dynamics/scenarios.py`)
- Driving roads → OpenDRIVE parser: parses with (evidence: `src/scenic/domains/driving/roads.py`)
- MetaDrive adapter → Simulation runtime: implements (evidence: `src/scenic/simulators/metadrive/simulator.py`)
- Newtonian adapter → Simulation runtime: implements (evidence: `src/scenic/simulators/newtonian/simulator.py`)
