uuagc-diagrams- Utility for drawing attribute grammar pictures with the diagrams package

Safe HaskellNone



Example usage of this package:

import UU.UUAGC.Diagrams

dia :: AGBackend b => AGDiagram b
dia = production ["count", "level"] "Docs" ["html", "count"]
        [ child ["count", "level"] "hd" ["html", "count"]
        , child ["count", "level"] "tl" ["html", "count"]
      # agrule shaftL "lhs.count" "hd.count"
      # agrule shaftL "lhs.level" "hd.level"
      # agrule shaftR "lhs.level" "tl.level"
      # agrule shaftL "hd.html" "lhs.html"
      # agrule shaftR "tl.html" "lhs.html"
      # agrule shaftR "tl.count" "lhs.count"
      # agrule shaftT "hd.count" "tl.count"



production :: AGBackend b => [String] -> String -> [String] -> [Child b] -> AGDiagram b Source

Construct a diagram for a full production, given its inherited attributes, name, synthesized attributes and children

child :: AGBackend b => [String] -> String -> [String] -> Child b Source

Construct a child given its inherited attributes, name and sythesized attributes.

agrule :: AGBackend b => Trail R2 -> String -> String -> AGDiagram b -> AGDiagram b Source

Construct an arrow between two attributes. The first argument specifies the shape of the arrow and can be shaftL, shaftR, shaftT, shaftB of shaftD, or a special trial constructed with the diagrams library.

indrule :: AGBackend b => String -> String -> AGDiagram b -> AGDiagram b Source

Construct an induced dependency arrow between two attributes, similar to agrule but with an explicit trial.

shaftL :: Trail R2 Source

Line that first moves left and then right

shaftR :: Trail R2 Source

Line that first moves right and then left

shaftT :: Trail R2 Source

Top half of a circle

shaftB :: Trail R2 Source

Bottom half of a circle

shaftD :: Trail R2 Source

Straight line

(#) :: a -> (a -> b) -> b infixl 8

Postfix function application, for conveniently applying attributes. Unlike ($), (#) has a high precedence (8), so d # foo # bar can be combined with other things using operators like (|||) or (<>) without needing parentheses.

class (Renderable (Path R2) b, Backend b R2) => AGBackend b Source


data Child b Source

Child with backend b, this type has been left abstract on purpose.