[llvm] [Dexter] Add basic structured script parsing (PR #193710)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Thu May 7 07:31:36 PDT 2026


================
@@ -0,0 +1,238 @@
+# DExTer : Debugging Experience Tester
+# ~~~~~~   ~         ~~         ~   ~~
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+"""This file defines the DexterScript class. Using Nodes as building blocks, the DexterScript defines a complete Dexter
+test, a structured definition of locations, values, and actions used to drive a debugging session and evaluate the
+results.
+"""
+
+from pathlib import PurePath
+import os
+from typing import Any, Callable, Optional, Set, Union
+import yaml
+
+from dex.test_script.Nodes import (
+    Expect,
+    Where,
+    setup_yaml_parser,
+)
+
+from dex.utils.Exceptions import Error
+from dex.utils.Timer import Timer
+
+
+class DexterScriptError(Error):
+    pass
+
+
+class Scope:
+    """Helper class used to simplify queries about the context of a Node in the Dexter Script. The context for a given
+    Node consists of some base context information in the root of the script, and then all Where nodes in the parent
+    chain of the current Node. Therefore each Script has a root Scope object, and each Node's context is given by a
+    Scope chain built from the root Scope and every Where between the root and the given Node.
+    """
+
+    def __init__(
+        self,
+        file: Union[str, None] = None,
----------------
jmorse wrote:

My python-typing is rusty, but isn't str-or-None effectively an "Optional"?

https://github.com/llvm/llvm-project/pull/193710


More information about the llvm-commits mailing list