While the ASAM OpenSCENARIO 2.1 Domain-Specific Language (DSL) enables declarative, intent-driven authoring for Scenario-Based Testing (SBT), its integration into open-source simulators like CARLA remains limited by legacy parsers. We propose a multi-pass modern compiler architecture that translates the OpenSCENARIO 2.1 DSL directly into executable CARLA behaviors. The pipeline features an ANTLR4 frontend for Abstract Syntax Tree (AST) generation, a semantic middle-end, and a runtime backend that synthesizes deterministic py_trees behavior trees. Mapping the standardized domain ontology directly to CARLA's procedural API via a custom method registry eliminates the need for external logic solvers. A demonstrative multi-actor cut-in and evasive maneuver, selected from a wider suite of validated scenarios, confirms the compiler's ability to process concurrent actions, dynamic mathematical expressions, and asynchronous signaling. This framework establishes a functional baseline for reproducible, large-scale SBT, paving the way for future C++ optimizations to mitigate current Python-based computational overhead.
翻译:虽然ASAM OpenSCENARIO 2.1领域特定语言(DSL)能够支持场景测试(SBT)的声明式意图驱动编写,但其与CARLA等开源模拟器的集成仍受限于传统解析器。本文提出一种多阶段现代编译器架构,可将OpenSCENARIO 2.1 DSL直接转换为可执行的CARLA行为。该流水线包含用于抽象语法树(AST)生成的ANTLR4前端、语义中间端,以及可合成确定性py_trees行为树的运行时后端。通过定制方法注册表将标准化领域本体直接映射到CARLA的过程式API,消除了对外部逻辑求解器的依赖。从已验证的宽泛场景集中选取的多智能体切入与规避操作演示案例,证实了编译器处理并发动作、动态数学表达式及异步信号的能力。该框架为可复现的大规模场景测试建立了功能基线,并为后续通过C++优化降低当前Python计算开销奠定了基础。