Skip to content

DSL quick-start docstring in dsl/__init__.py does not parse (uses non-existent 'latent'/'output' keywords) #40

Description

@aaronstevenwhite

Summary

The quivers.dsl package docstring (the "Quick start" in src/quivers/dsl/__init__.py) shows a program that does not parse under the released grammar. It uses latent f : X -> Y and output f, but neither latent, output, nor alias are keywords in the shipped tree-sitter grammar.

Repro (quivers 0.13.0)

from quivers.dsl import loads
loads("""
object X : FinSet 3
object Y : FinSet 4
latent f : X -> Y
output f
""")
quivers.dsl.parser.ParseError: syntax error at line 4, col 0: 'latent f : X -> Y'

Cause

  • src/quivers/dsl/__init__.py lines ~15-22 (loads('''... latent f : X -> Y ... output f ''')).
  • grep -oE '"(latent|output|alias)"' src/quivers/dsl/_grammar_data/grammar.json returns nothing on main (HEAD 4fefe49) — these tokens are not in the grammar.

The real surface is program NAME : A -> B with sample / let / observe / return steps and a top-level export NAME.

Expected

The docstring example should parse. Suggest replacing it with a minimal program that compiles, e.g.:

object Resp : FinSet 8
program m : Resp -> Resp
    sample b <- Normal(0.0, 5.0)
    observe y : Resp <- Normal(b, 1.0)
    return y
export m

Impact

First thing a user copies from the module docstring throws ParseError. Reproduces on main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions