27 lines
754 B
Swift
27 lines
754 B
Swift
// DSLProgram.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// A parsed DSL program: a sequence of statements, each either an anonymous
|
|
// output expression or a named-slot assignment.
|
|
|
|
/// A parsed DSL program.
|
|
public struct DSLProgram: Equatable, Sendable {
|
|
|
|
/// One top-level statement.
|
|
public enum Statement: Equatable, Sendable {
|
|
/// `name = expr` — bind the graph to a named slot.
|
|
case assignment(name: String, value: DSLExpr, DSLSpan)
|
|
/// A bare expression — an anonymous output.
|
|
case expression(DSLExpr)
|
|
}
|
|
|
|
public let statements: [Statement]
|
|
|
|
public init(statements: [Statement]) {
|
|
self.statements = statements
|
|
}
|
|
}
|