Production

public struct Production : Codable
extension Production: Hashable
extension Production: CustomStringConvertible
extension Production: CustomDebugStringConvertible

A production describing what symbols can be generated starting from a given non-terminal pattern

  • Starting pattern

    Declaration

    Swift

    public let pattern: NonTerminal
  • Symbols produced from the starting pattern

    Declaration

    Swift

    public let production: [Symbol]
  • Chain of non-terminals which have been eliminated during normalization

    Declaration

    Swift

    public let nonTerminalChain: [NonTerminal]?
  • Declaration

    Swift

    public let hashValue: Int
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • Creates a new production

    Declaration

    Swift

    public init(pattern: NonTerminal, production: ProductionString)

    Parameters

    pattern

    Starting pattern

    production

    Generated sequence of symbols

  • Creates a new production

    Declaration

    Swift

    public init(pattern: NonTerminal, production: [Symbol], chain: [NonTerminal]? = nil)

    Parameters

    pattern

    Starting pattern

    production

    Generated sequence of symbols

    chain

    Non-terminals which have been filtered out during normalization

  • A production is final if it only generates terminal symbols

    Declaration

    Swift

    public var isFinal: Bool { get }
  • A production is in Chomsky normal form if it generates exactly 2 non-terminals exclusive or one or zero terminal symbols

    Declaration

    Swift

    public var isInChomskyNormalForm: Bool { get }
  • Sequence of terminals generated by this production

    Declaration

    Swift

    public var generatedTerminals: [Terminal] { get }
  • Declaration

    Swift

    public static func == (lhs: Production, rhs: Production) -> Bool
  • Declaration

    Swift

    public var description: String { get }
  • Declaration

    Swift

    public var debugDescription: String { get }