context-free-art-0.2.0.3: Generate art from context-free grammars

Copyright(c) Owen Shepherd 2019
LicenseBSD-3-Clause
Maintainer414owen@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Art.ContextFree

Description

Create art via context free grammar production rules.

Synopsis

Documentation

data Modifier Source #

Change the style applied to all downstream terminal symbols.

data Symbol Source #

A terminal or non-terminal symbol.

Constructors

NonTerminal (NonEmpty Production)

A non-terminal symbol.

Mod [Modifier] Symbol

Apply modifications to sub-productions.

Circle Float

Produce a circle with a radius.

Poly [Vec]

Produce a polygon by relative points. Starts and ends at (0, 0).

type Vec = (Float, Float) Source #

A vector in 2d euclidian space.

type Production = (Float, Symbol) Source #

A production rule, including a starting probability of generation, a list of styles to be applied to sub-grammars, and a non-empty list of symbols to produce.

interpret :: Symbol -> IO Svg Source #

Create a drawing from a grammar. In order to get a string representation, you'll need to use one of blaze-svg's render functions, for example renderSvg.