Skip to content
/ Mate Public

Object Graph Language, Object Graph Grammar-Based Fuzzer

Notifications You must be signed in to change notification settings

FedeLoch/Mate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

135 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Mate - Object Graph Language

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:

Architecture Overview

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.

Mate Architecture

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)

Quick Start

Metacello new
    baseline: 'Mate';
    repository: 'github://FedeLoch/Mate:main';
    onConflictUseIncoming;
    load.

Examples

Person Object Graph Grammar:

Person -> { age: Age }
Age -> { value: SmallInteger }

Generating Person instances:

grammar := MatePersonGrammar new.
person := grammar gen: Person.

person age.  "=> 42 (random SmallInteger)"

Player Object Graph Grammar:

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)"

Bloc Element Object Graph Grammar

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.

Object Graph Derivation Visualization

grammar := MateBlocGrammar new.
derivationTree := grammar gen: BlElement from: MateContext new.
derivationTree render

Player Derivation Tree

Fuzzing Backpropagation

Propagate 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.

About

Object Graph Language, Object Graph Grammar-Based Fuzzer

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published