Skip to content

Parser

Regex-based parser for gen~ code exports. Extracts I/O counts, parameter metadata, buffer references, and the gen~ function name.

parser

Parser for gen~ exported code.

Analyzes gen~ exports to detect: - Export name (from .cpp/.h filenames) - Buffer names (via regex patterns) - I/O counts (from gen_kernel_numins/numouts) - Platform-specific issues (exp2f)

ExportInfo dataclass

ExportInfo(
    name: str,
    path: Path,
    num_inputs: int = 0,
    num_outputs: int = 0,
    num_params: int = 0,
    buffers: list[str] = list(),
    has_exp2f_issue: bool = False,
    cpp_path: Optional[Path] = None,
    h_path: Optional[Path] = None,
    genlib_ops_path: Optional[Path] = None,
    input_names: list[str] = list(),
)

Information extracted from a gen~ export.

GenExportParser

GenExportParser(export_path: str | Path)

Parser for gen~ exported code directories.

Initialize parser with path to gen~ export directory.

Parameters:

Name Type Description Default
export_path str | Path

Path to directory containing exported gen~ code. Should contain a .cpp/.h file pair and gen_dsp/ subdirectory.

required

parse

parse() -> ExportInfo

Parse the gen~ export and extract information.

Returns:

Type Description
ExportInfo

ExportInfo with detected information.

Raises:

Type Description
ParseError

If export cannot be parsed.

validate_buffer_names

validate_buffer_names(buffer_names: list[str]) -> list[str]

Validate that buffer names are valid C identifiers.

Parameters:

Name Type Description Default
buffer_names list[str]

List of buffer names to validate.

required

Returns:

Type Description
list[str]

List of invalid buffer names (empty if all valid).