ST.Sigils (st_parser v0.5.0)

View Source

Simple compile-time sigils for Session Types.

Provides the ~q sigil for defining session types with compile-time parsing and validation.

Summary

Functions

Sigil for compile-time session type parsing.

Functions

sigil_q(arg, modifiers)

(macro)

Sigil for compile-time session type parsing.

Parses the session type expression at compile time and expands to the corresponding ST struct. This provides compile-time validation and zero runtime overhead.

Examples

import ST.Sigils

# Simple end session
session = ~q/end/

# Input session type
session = ~q/&Server:{ Ack(nil).end }/

# Output session type
session = ~q/+Client:{ Request(string).end }/

# Complex protocol
session = ~q/
  &Server:{
    Request(string).+Client:{
      Response((string, number[])).end,
      Error(string).end
    }
  }
/