Title: Precedence%20Graph%20Grammar%20for%20Hierarchical%20Program%20Diagram
1Precedence Graph Grammar for Hierarchical
Program Diagram
- ?Takaaki Goto (Toyo University)
- Kenji Ruise (Kirigaoka School for the
Physically Challenged, University of Tsukuba
) - Kensei Tsuchida (Toyo University)
- Takeo Yaku (Nihon University)
2Contents
- Introduction
- Hichart/DXL
- Preliminaries
- Graph Grammar for Hichart/DXL
- Parsing of precedence graph grammar for
Hichart/DXL - Hichart Editor
- Conclusion
31. Introduction
- 1.1 Background
- 1.2 Motivation
- 1.3 Purpose
- 1.4 Results
41.1 Background
- Various researches have been done on graph
grammars and their application - We have been developing a software development
environment based on graph grammars - to formalize of diagrams structure and layout
information - to formalize of diagram processing method
51.1 Background (cont.)
- The program diagram called Hichart (HIerachical
flowCHART description language) in this
environment is treated - We have already developed bidirectional
translators that translate - Pascal, C, or DXL to Hichart
- Hichart to Pascal, C, or DXL
61.2 Motivation
- A parser plays a key role in our processing
system and needs to be efficient as large-scale
program diagrams are parsed
71.3 Purpose
- To adopt a precedence relation of graph grammar
for Hichart/DXL to parse Hichart diagram
efficiently
81.4 Results
- Adapted a precedence relation of graph grammar
for Hichart/DXL - productions 70
- semantic rules 888
- precedence relations 256
- Implemented graphical editor with parser in JAVA
92. Hichart/DXL
102. Hichart/DXL (cont.)
- Characteristics of Hichart
- Diagram is a tree-flowchart with the same flow
control lines as a Neumann program flowchart - The hierarchy of the data structure and the
control flow are displayed on a plane
simultaneously
112. Hichart/DXL (cont.)
- DXL
- (1) Diagram eXchange Language for tree-structure
charts, DXL, was specified in the 1997 ISO - (2) Purpose of DXL is to facilitate the
interchange of different tree-structure charts
between CASE tools
122. Hichart/DXL (cont.)
- Data exchange between various tree-structure
diagrams through DXL
(Hitachi)
133. Preliminaries
- 3.1 edNCE Graph Grammar
- 3.2 Precedence Graph Grammar
143.1 edNCE Graph Grammar
Rozenberg, 1997
153.1 edNCE Graph Grammar (cont.)
- Example of production derivation
(a) Host
X
(b) Production
163.2 Precedence Graph Grammar
- A graph grammar that is
- confluent
- symmetric
- uniquely invertible
- has no reflexive nonterminals
- no precedence conflicts
- is called precedence graph grammar Kaul, 1986.
173.2 Precedence Graph Grammar (cont.)
- derivation specifications
- , where
- is an isomorphic graph of the left hand side
of a production - is an isomorphic graph of the right hand side
of a production - is an isomorphism
183.2 Precedence Graph Grammar (cont.)
- derivation sequences
- precedes if
- The reflexive and transitive closure of this
relation - is denoted
- are incomparable if neither
nor
193.2 Precedence Graph Grammar (cont.)
- An ordering of the nodes in Gn is
are the precedence relation between nodes
- The precedence relations between labels
is the set of all
204. Graph Grammar for Hichart/DXL
- 4.1 Attribute Graph Grammar for Hichart/DXL
- 4.2 Derivation of GGHD
- 4.3 Precedence Relation for GGHD
214.1 Attribute Graph Grammar for Hichart/DXL
- GGHD (Graph Grammar for Hichart/DXL)
GG Type Productions Semantic rules
GGHD Context-free 70 888
224.1 Attribute Graph Grammar for Hichart/DXL
(cont.)
Fig. Example of production and semantic rules of
GGHD
234.2 Derivation of GGHD
- We substitute (D,C) for a node X in H as
follows. - (1) Remove a mother node X , and edges that
connect with X from host graph H, - (2) Embed the daughter graph D into H- , and
- (3) Establish edges between the nodes of D and
the nodes that were connected to the mother node
in the H of H- using the connection instructions
of C.
244.2 Derivation of GGHD (cont.)
Remove mother node and edges that connect with
profile_module_list
254.2 Derivation of GGHD (cont.)
Embed the daughter graph
264.2 Derivation of GGHD (cont.)
Establish edges using the connection instructions
274.3 Precedence Relation for GGHD
- We adopted a precedence relation of graph grammar
for Hichart/DXL using Kauls definitions
284.3 Precedence Relation for GGHD (cont.)
294.3 Precedence Relation for GGHD (cont.)
304.3 Precedence Relation for GGHD (cont.)
s1(P1, module_packet, D1, b)
sD(2)s1
sD(3)s1
314.3 Precedence Relation for GGHD (cont.)
324.3 Precedence Relation for GGHD (cont.)
s2(P3, profile_module_list, D2, b)
sD(4)s2
sD(5)s2
334.3 Precedence Relation for GGHD (cont.)
344.3 Precedence Relation for GGHD (cont.)
s3(P4, profile, D3, b)
sD(6)s3
sD(7)s3
354.3 Precedence Relation for GGHD (cont.)
364.3 Precedence Relation for GGHD (cont.)
s4(P5, module_list, D4, b)
sD(8)s4
374.3 Precedence Relation for GGHD (cont.)
derivation sequence
The precedence relation between 6 and 7
6 ? 7 ? sD(6) ?D sD(7)
sD(6)s3, sD(7)s3, s3 D s3, 6 7
lab(6, 7) ("profile", , ?, "explanation") ?R
384.3 Precedence Relation for GGHD (cont.)
- We defined all the precedence relations between
labels for grammar GGHD - We call this grammar the Precedence Graph Grammar
for Hichart/DXL (PGGHD) - Property 1
- PGGHD is a precedence graph grammar
395. Parsing of Precedence Graph Grammar for
Hichart/DXL
- 5.1 Algorithm for parsing
- 5.2 Example of Parsing
405.1 Algorithm for parsing
- uses a stack for storing traversed nodes
- Starts parsing from the root node of an input
graph - parsing
- shift as long as possible
- If there is no ascending node, the parser
searches a production where the right-hand-side
is isomorphic to the precedence handle. - reduce the precedence handle to lhs of the
production
415.2 Example of Parsing
An input graph
G
lt
lt
explanation
profile
?
lt
lt
BoxEmpty1
K
An ordered list of G
425.2 Example of Parsing (cont.)
G
lt
lt
explanation
profile
?
lt
lt
BoxEmpty1
K
435.2 Example of Parsing (cont.)
G
lt
lt
explanation
profile
?
lt
lt
BoxEmpty1
K
445.2 Example of Parsing (cont.)
G
lt
lt
explanation
profile
?
lt
lt
BoxEmpty1
K
455.2 Example of Parsing (cont.)
G
lt
lt
explanation
profile
?
lt
lt
BoxEmpty1
K
465.2 Example of Parsing (cont.)
G
lt
lt
explanation
profile
?
lt
lt
BoxEmpty1
K
475.2 Example of Parsing (cont.)
G
lt
lt
explanation
profile
?
lt
lt
BoxEmpty1
K
485.2 Example of Parsing (cont.)
G
lt
lt
explanation
profile
?
lt
lt
BoxEmpty1
K
495.2 Example of Parsing (cont.)
G
lt
explanation
profile
?
lt
lt
BoxEmpty1
K
505.2 Example of Parsing (cont.)
G
lt
explanation
profile
?
lt
lt
BoxEmpty1
K
515.2 Example of Parsing (cont.)
G
lt
explanation
profile
?
lt
lt
BoxEmpty1
K
525.2 Example of Parsing (cont.)
G
lt
profile
lt
lt
lt
BoxEmpty1
K
535.2 Example of Parsing (cont.)
G
lt
profile
lt
lt
lt
BoxEmpty1
K
545.2 Example of Parsing (cont.)
G
lt
profile
lt
lt
lt
BoxEmpty1
K
555.2 Example of Parsing (cont.)
G
lt
profile
lt
lt
lt
BoxEmpty1
K
565.2 Example of Parsing (cont.)
G
lt
profile
lt
lt
lt
BoxEmpty1
K
575.2 Example of Parsing (cont.)
G
lt
profile
lt
lt
lt
BoxEmpty1
K
585.2 Example of Parsing (cont.)
G
lt
profile
lt
lt
lt
BoxEmpty1
K
595.2 Example of Parsing (cont.)
G
lt
profile
lt
lt
lt
BoxEmpty1
K
605.2 Example of Parsing (cont.)
G
find_production P14
lt
profile
lt
lt
lt
BoxEmpty1
K
615.2 Example of Parsing (cont.)
G
lt
profile
lt
lt
statement_ list
K
625.2 Example of Parsing (cont.)
G
lt
profile
lt
lt
statement_ list
K
635.2 Example of Parsing (cont.)
G
find_production P11
lt
profile
lt
lt
statement_ list
K
645.2 Example of Parsing (cont.)
G
lt
profile
lt
lt
module_ algorithm
K
655.2 Example of Parsing (cont.)
G
lt
profile
lt
lt
module_ algorithm
K
665.2 Example of Parsing (cont.)
G
find_production P08
lt
profile
lt
lt
module_ algorithm
K
675.2 Example of Parsing (cont.)
G
lt
profile
lt
explanation_modue_ algorithm
K
685.2 Example of Parsing (cont.)
G
lt
profile
lt
explanation_modue_ algorithm
K
695.2 Example of Parsing (cont.)
G
find_production P07
lt
profile
lt
explanation_modue_ algorithm
K
705.2 Example of Parsing (cont.)
G
lt
profile
lt
module
K
715.2 Example of Parsing (cont.)
G
lt
profile
lt
module
K
725.2 Example of Parsing (cont.)
G
lt
profile
lt
find_production P05
module
K
735.2 Example of Parsing (cont.)
G
lt
profile
module_ list
K
745.2 Example of Parsing (cont.)
G
lt
profile
module_ list
K
755.2 Example of Parsing (cont.)
G
lt
profile
find_production P03
module_ list
K
765.2 Example of Parsing (cont.)
G
profile_module_ list
K
775.2 Example of Parsing (cont.)
G
profile_module_ list
K
785.2 Example of Parsing (cont.)
G
find_productionP01
profile_module_ list
K
795.2 Example of Parsing (cont.)
G
K
805.2 Example of Parsing (cont.)
G
K
finish parsing
816. Hichart Editor
- ?Outline?
- Hichart Editor
- Supports non-syntax-directed editing
- has parser
- Java(10,000steps)
- ?features?
- To check the correctness of diagrams
- To draw Hichart diagrams aesthetically
- To generate an SVG file
826. Hichart Editor (cont.)
- Input Hichart diagrams
- Output Hichart code with derivation tree
- SVG files with aesthetically drawing
83DEMO
- Parsing on Hichart Editor
- Generating SVG file on Hichart Editor
847. Conclusion
- Summary
- Adapted a precedence relation of graph grammar
for Hichart/DXL - productions 70
- semantic rules 888
- precedence relations 256
- Implemented graphical editor with parser in JAVA
857. Conclusion (cont.)
- Our graph grammar based method would be able to
apply to other visual programming systems that
treat tree-like graphs
867. Conclusion (cont.)
- Future work
- To apply our method of graph grammar to
Object-Oriented Language