Skip to content

enhancement: add Pattern.compile() and Pattern.compile_system() to OGS #90

@rororowyourboat

Description

@rororowyourboat

Problem

All 4 non-OGS DSLs provide Model.compile() → GDSSpec and Model.compile_system() → SystemIR convenience methods. OGS Pattern has neither — users must call standalone functions:

# Other DSLs (consistent)
spec = model.compile()
system = model.compile_system()

# OGS (different)
from ogs import compile_to_ir, compile_pattern_to_spec
ir = compile_to_ir(pattern)
spec = compile_pattern_to_spec(pattern)
system = ir.to_system_ir()

OGS also has a different error hierarchy (DSLTypeError/DSLCompositionError vs ValidationError/CompilationError).

Proposal

Add convenience methods to Pattern:

  • Pattern.compile() → GDSSpec (delegates to compile_pattern_to_spec)
  • Pattern.compile_system() → SystemIR (delegates to compile_to_ir + to_system_ir)

This preserves the existing standalone functions while giving users a consistent entry point.

Context

The architectural difference (Pattern-centric vs Model-centric) is intentional. This is about API ergonomics, not changing the underlying design.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions