Scenic Internals

This section of the documentation describes the implementation of Scenic. It is not intended for ordinary users of Scenic, and will probably only be useful for people who need to make some change to the language (e.g. adding a new type of distribution).

The documentation is organized by the submodules of the main scenic module:

scenic.core

Scenic’s core types and associated support code.

scenic.simulators

World models and associated code for particular simulators.

scenic.syntax

The Scenic compiler and associated support code.

The scenic module itself provides two functions as the top-level interface to Scenic:

scenarioFromFile(path, cacheImports=False)[source]

Compile a Scenic file into a Scenario.

Parameters
  • path (str) – path to a Scenic file

  • cacheImports (bool) – Whether to cache any imported Scenic modules. The default behavior is to not do this, so that subsequent attempts to import such modules will cause them to be recompiled. If it is safe to cache Scenic modules across multiple compilations, set this argument to True. Then importing a Scenic module will have the same behavior as importing a Python module.

Returns

A Scenario object representing the Scenic scenario.

scenarioFromString(string, filename='<string>', cacheImports=False)[source]

Compile a string of Scenic code into a Scenario.

The optional filename is used for error messages.