Mate is an object graph language implementation that allows you to define grammars representing software system structures and generate valid object instances from those grammars. To know more about Mate:
- Mate Language
- Mate Grammar Examples
- How Mate Works
- Derivation Model
- Object Graph Fuzzing
- Object Graph Parsing
- Object Graph Type Validation
- Dynamic Grammar Generation by Test Suites
Mate is built on a systematic, grammar-driven framework that decouples structural definitions from object instances or Mate definitions, enabling the generation of complex, state-consistent object graphs. It employs a feedback-oriented derivation process, in which the object grammar productions are iteratively refined using any metric.
With Mate, you can:
- Declare your own Object Graph Grammars
- Generate valid object instances from a grammar and historical reward ( Monte Carlo Tree Search )
- Mate Object Graphs derivations visualization
- Propagate rewards through the derivation tree to improve future generations
- Parse and validate object graphs against your Mate grammar
- Generate Mate Object graph Grammar definitions from test object suites (
⚠️ Not implemented yet)
Metacello new
baseline: 'Mate';
repository: 'github://FedeLoch/Mate:main';
onConflictUseIncoming;
load.Person -> { age: Age }
Age -> { value: SmallInteger }Generating Person instances:
grammar := MatePersonGrammar new.
person := grammar gen: Person.
person age. "=> 42 (random SmallInteger)"Player -> {
name: ByteString,
characterClass: Warrior | Rogue | Mage,
level: { type: SmallInteger, between: 0 and: 99 },
missingExperienceForNextLevel: { type: SmallInteger, greaterThan: 0 }
}Generating player instances:
grammar := MatePlayerGrammar new.
player := grammar gen: Player.
player name. "=> 'xyz123'"
player characterClass. "=> a Warrior"
player level. "=> 47 (always 0-99)"BlElement -> {
children: BlChildrenArray,
parent: { refType: BlElement },
visuals: (BlCustomVisuals | BlDefaultVisuals),
constraints: BlLayoutCommonConstraints,
selfReferences: { children.array[ .parent ] }
}
BlChildrenArray -> {
array: { type: [ BlElement ], sizeBetween: 0 and: 10 }
}
BlCustomVisuals -> {
background: (BlPaintBackground | BlTransparentBackground),
geometry: (BlRectangleGeometry | BlEllipseGeometry | BlTriangleGeometry),
clipChildren: Boolean,
}
BlLayoutCommonConstraints -> {
position: Point,
vertical: BlLayoutCommonConstraintsAxis,
horizontal: BlLayoutCommonConstraintsAxis
}
BlLayoutCommonConstraintsAxis -> {
resizer: BlLayoutExactResizer
}
BlLayoutExactResizer -> {
size: { type: SmallFloat64, between: 100 and: 1000 }
}
BlPaintBackground -> {
paint: BlColorPaint
}
BlColorPaint -> {
color: Color
}
BlTriangleGeometry -> {
orientation: { oneOf: { #top . #right . #left . #bottom } }
}Generating Bloc Element instances:
grammar := MateBlocGrammar new.
element := grammar gen: BlElement.grammar := MateBlocGrammar new.
derivationTree := grammar gen: BlElement from: MateContext new.
derivationTree renderPropagate rewards through the derivation tree to improve future generations:
grammar := MatePlayerGrammar new.
derivationTree := grammar gen: Player from: MateContext new.
player := derivationTree instance.
"Propagating feedback for future generations"
grammar backpropagate: derivationTree improvement: 42.

