Crate sketchddd_parser

Crate sketchddd_parser 

Source
Expand description

§SketchDDD Parser

Parser for the SketchDDD domain-specific language.

§Example

context Commerce {
  objects { Customer, Order, LineItem, Product, Money }

  morphisms {
    placedBy: Order -> Customer
    items: Order -> List<LineItem>
    product: LineItem -> Product
    price: LineItem -> Money
  }

  aggregate Order {
    root: Order
    contains: [LineItem]
    invariant: totalPrice = sum(items.price)
  }

  value Money {
    amount: Decimal
    currency: Currency
  }

  enum OrderStatus = Pending | Confirmed | Shipped | Cancelled
}

Structs§

AggregateDecl
An aggregate declaration.
ContextDecl
A context declaration.
ContextMapDecl
A context map declaration.
EnumDecl
An enum declaration.
FieldDecl
A field declaration.
InvariantDecl
An invariant declaration.
MappingDecl
A mapping declaration in a context map.
MorphismDecl
A morphism declaration.
ObjectDecl
An object declaration.
ParseError
Error that occurs during parsing.
Span
Source location for error reporting.
ValueObjectDecl
A value object declaration.

Enums§

TypeExpr
A type expression.

Functions§

parse
Parse a SketchDDD source file.
parse_context
Parse a single context definition.