digraph g { graph [fontname = "Sedgwick Ave"]; node [fontname = "Sedgwick Ave"]; edge [fontname = "Handlee"]; rankdir=LR; // ([-+]?\d+(\.\d*)?)([eE]([-+]?\d+))? // This RE represents these pieces start sign_pos int dot frac E esign_pos exp end start [shape="doublecircle"] end [shape="doublecircle"] // the pieces are connected as follows start -> sign_pos [label="+"] start -> sign_neg [label="-"] start -> int [label="0-9"] start -> dot [label="dot"] start -> end [label="eos"] sign_pos -> int [label= "0-9"] sign_pos -> dot [label = "dot"] sign_neg -> int [label= "0-9"] sign_neg -> dot [label = "dot"] int -> int [label="0-9"] int -> dot [label = "dot"] int -> end [label="eos"] int -> E [label="e/E"] dot -> frac [label="0-9"] dot -> E [label="e/E"] dot -> end [label="eos"] frac -> frac [label="0-9"] frac -> E [label="e/E"] frac -> end [label="eos"] E -> esign_pos [label="+"] E -> esign_neg [label="-"] E -> exp [label="0-9"] esign_pos -> exp [label="0-9"] esign_neg -> exp [label="0-9"] exp -> exp [label="0-9"] exp -> end [label="eos"] }