Confluent Orthogonal Drawing for Syntax Diagrams S-expression ( - - PowerPoint PPT Presentation

confluent orthogonal drawing for syntax diagrams
SMART_READER_LITE
LIVE PREVIEW

Confluent Orthogonal Drawing for Syntax Diagrams S-expression ( - - PowerPoint PPT Presentation

Confluent Orthogonal Drawing for Syntax Diagrams S-expression ( S-expression S-expression ) . AZ AZ 09 Michael J. Bannister David A. Brown David Eppstein Context-Free Grammars LISP 1.5 S-expression: (


slide-1
SLIDE 1

. S-expression S-expression ( ) S-expression A–Z 0–9 A–Z

Confluent Orthogonal Drawing for Syntax Diagrams

Michael J. Bannister David A. Brown David Eppstein

slide-2
SLIDE 2

Context-Free Grammars

S-expression → atomic symbol | (S-expression.S-expression) | (S-expression list) S-expression list → ǫ | S-expressionS-expression list atomic-symbol → LETTERatom part atom part → ǫ | LETTERatom part | numberatom part LETTER → A | B | C | · · · | Z number → 0 | 1 | 2 | · · · | 9 (defun factorial (x) (if (zerop x) 1 (* x (factorial (- x 1)))))

Grammar for LISP 1.5: LISP 1.5 S-expression:

slide-3
SLIDE 3

Syntax Diagrams

Syntax Diagram from the CANDE Information Manual

slide-4
SLIDE 4

Syntax Diagrams

Syntax Diagram from the Pascal User Manual and Report

slide-5
SLIDE 5

Syntax Diagrams

JSON Data Interchange Standard

slide-6
SLIDE 6

Extended Backus–Naur Form

  • More expressive than BNF
  • Notation for lists:

natural number = digit { digit }

  • Notation for optionals:

integer = [ ”-” ] natural number

  • More expressive than BNF
  • Notation for lists:

natural number = digit { digit }

  • Notation for optionals:

integer = [ ”-” ] natural number

  • Direct translation to syntax diagrams

digit − −

slide-7
SLIDE 7

Extended Backus–Naur Form

  • More expressive than BNF
  • Notation for lists:

natural number = digit { digit }

  • Notation for optionals:

integer = [ ”-” ] natural number

  • More expressive than BNF
  • Notation for lists:

natural number = digit { digit }

  • Notation for optionals:

integer = [ ”-” ] natural number

  • Direct translation to syntax diagrams

digit − −

slide-8
SLIDE 8

Extended Backus–Naur Form

  • More expressive than BNF
  • Notation for lists:

natural number = digit { digit }

  • Notation for optionals:

integer = [ ”-” ] natural number

  • More expressive than BNF
  • Notation for lists:

natural number = digit { digit }

  • Notation for optionals:

integer = [ ”-” ] natural number

  • Direct translation to syntax diagrams

digit − −

slide-9
SLIDE 9

Hand Optimizations

JSON Data Interchange Standard

slide-10
SLIDE 10

Software Pipeline

NFA Conversion Global Optimization Local Optimization Layered Drawing Confluent Conversion Syntax Diagram BNF Grammar

slide-11
SLIDE 11

NFA Representation

S-expression → atomic symbol | (S-expression.S-expression) | (S-expression list) S-expression list → ǫ | S-expressionS-expression list atomic-symbol → LETTERatom part atom part → ǫ | LETTERatom part | numberatom part LETTER → A | B | C | · · · | Z number → 0 | 1 | 2 | · · · | 9

Grammar for LISP 1.5:

slide-12
SLIDE 12

NFA Representation

S-expression → atomic symbol | (S-expression.S-expression) | (S-expression list)

slide-13
SLIDE 13

NFA Representation

S-expression list → ǫ | S-expressionS-expression list

slide-14
SLIDE 14

NFA Representation

slide-15
SLIDE 15

NFA Representation

S-expression → atomic symbol | (S-expression.S-expression) | (S-expression list) S-expression list → ǫ | S-expressionS-expression list atomic-symbol → LETTERatom part atom part → ǫ | LETTERatom part | numberatom part LETTER → A | B | C | · · · | Z number → 0 | 1 | 2 | · · · | 9

slide-16
SLIDE 16

Global Optimization Can modify the entire NFA representation NFA state minimization

  • Combine graphs to reduce states
slide-17
SLIDE 17

Global Optimization Nesting!

slide-18
SLIDE 18

Local Optimizations

  • Hard to approximate
  • Existing heuristic applicable,

but complicated and slow

  • Use fast heuristics, motivated

by hand optimizations NFA state minimization: Crossing minimization:

  • Add states to reduce crossings

Changes one st-digraph at a time

slide-19
SLIDE 19

Local Optimizations Loop back!

slide-20
SLIDE 20

Local Optimizations Parallel state elimination!

slide-21
SLIDE 21

Local Optimizations Confluent pinch!

slide-22
SLIDE 22

Optimization

Global Optimization Local Optimization

slide-23
SLIDE 23

Sugiyama Layering

slide-24
SLIDE 24

Sugiyama Layering

slide-25
SLIDE 25

Sugiyama Layering

slide-26
SLIDE 26

Confluent Conversion

slide-27
SLIDE 27

Experimental Results Subset of JSON grammar

slide-28
SLIDE 28

Experimental Results Pascal Type Declarations

slide-29
SLIDE 29

Conclusion

Software pipeline producing syntax diagrams, uses standard GD techniques for final drawing. which optimizes the input grammar and Further directions:

  • Compare our simple heuristics against

existing NFA min heuristics

  • Reduce bends and crossings in layering
  • Perform user studies
slide-30
SLIDE 30

Conclusion

Software pipeline producing syntax diagrams, uses standard GD techniques for final drawing. which optimizes the input grammar and Further directions:

  • Compare our simple heuristics against

existing NFA min heuristics

  • Reduce bends and crossings in layering
  • Perform user studies

Thank you!