870 likes | 1.08k Views
Precedence 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). Contents. Introduction Hichart/DXL
E N D
Precedence 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)
Contents • Introduction • Hichart/DXL • Preliminaries • Graph Grammar for Hichart/DXL • Parsing of precedence graph grammar for Hichart/DXL • Hichart Editor • Conclusion
1. Introduction 1.1 Background 1.2 Motivation 1.3 Purpose 1.4 Results
1.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 diagram’s structure and layout information • to formalize of diagram processing method
1.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 • Hichartto Pascal, C, or DXL
1.2 Motivation • A parser plays a key role in our processing system and needs to be efficient as large-scale program diagrams are parsed
1.3 Purpose • To adopt a precedence relation of graph grammar for Hichart/DXL to parse Hichart diagram efficiently
1.4 Results • Adapted a precedence relation of graph grammar for Hichart/DXL • productions70 • semantic rules888 • precedence relations256 • Implemented graphical editor with parser in JAVA
2. Hichart/DXL (cont.) • Characteristics of Hichart • Diagram is a tree-flowchartwiththe 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
2. 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
2. Hichart/DXL (cont.) • Data exchange between various tree-structure diagrams through DXL (Hitachi)
3. Preliminaries 3.1 edNCE Graph Grammar 3.2 Precedence Graph Grammar
3.1 edNCE Graph Grammar [Rozenberg, 1997]
(c) Result 3.1 edNCE Graph Grammar (cont.) • Example of production & derivation (a) Host X:= (b) Production
3.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].
3.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
3.2 Precedence Graph Grammar (cont.) • derivation sequences • precedes if • The reflexive and transitive closure of this relation is denoted • are incomparable if neither nor
3.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
4. Graph Grammar for Hichart/DXL 4.1 Attribute Graph Grammar for Hichart/DXL 4.2 Derivation of GGHD 4.3 Precedence Relation for GGHD
4.1 Attribute Graph Grammar for Hichart/DXL • GGHD (Graph Grammar for Hichart/DXL)
4.1 Attribute Graph Grammar for Hichart/DXL (cont.) Fig. Example of production and semantic rules of GGHD
4.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’.
4.2 Derivation of GGHD(cont.) Remove mother node and edges that connect with [profile_module_list]
4.2 Derivation of GGHD(cont.) Embed the daughter graph
4.2 Derivation of GGHD(cont.) Establish edges using the connection instructions
4.3 Precedence Relation for GGHD • We adopted a precedence relation of graph grammar for Hichart/DXL using Kaul’s definitions
4.3 Precedence Relation for GGHD (cont.) s1=(P1, [module_packet], D1, b) sD(2)=s1 sD(3)=s1
4.3 Precedence Relation for GGHD (cont.) s2=(P3, [profile_module_list], D2, b) sD(4)=s2 sD(5)=s2
4.3 Precedence Relation for GGHD (cont.) s3=(P4, [profile], D3, b) sD(6)=s3 sD(7)=s3
4.3 Precedence Relation for GGHD (cont.) s4=(P5, [module_list], D4, b) sD(8)=s4
4.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 =
4.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
5. Parsing of Precedence Graph Grammar for Hichart/DXL 5.1 Algorithm for parsing 5.2 Example of Parsing
5.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
“m_packet” “module_ algorithm” “identifier_ is” 0 M_Packet 5.2 Example of Parsing An input graph G < < “explanation” “profile” ※ < < “BoxEmpty1” K An ordered list of G
“m_packet” “module_ algorithm” “identifier_ is” 0 “m_packet” 5.2 Example of Parsing (cont.) G < < “explanation” “profile” ※ < < “BoxEmpty1” K
“m_packet” “module_ algorithm” “identifier_ is” 0 “m_packet” TOP(G,K) 5.2 Example of Parsing (cont.) G < < “explanation” “profile” ※ < < “BoxEmpty1” K
“m_packet” “module_ algorithm” “identifier_ is” 0 1 “m_packet” “profile” 5.2 Example of Parsing (cont.) G < < “explanation” “profile” ※ < < “BoxEmpty1” K
“m_packet” “module_ algorithm” “identifier_ is” 1 0 “profile” “m_packet” TOP(G,K) 5.2 Example of Parsing (cont.) G < < “explanation” “profile” ※ < < “BoxEmpty1” K
“module_ algorithm” “m_packet” “identifier_ is” 0 1 2 “explanation” “profile” “m_packet” 5.2 Example of Parsing (cont.) G < < “explanation” “profile” ※ < < “BoxEmpty1” K
“m_packet” “module_ algorithm” “identifier_ is” 2 0 1 “profile” “explanation” “m_packet” TOP(G,K) 5.2 Example of Parsing (cont.) G < < “explanation” “profile” ※ < < “BoxEmpty1” K
“m_packet” “module_ algorithm” find_production P10 “identifier_ is” 1 2 0 “explanation” “profile” “m_packet” TOP(G,K) 5.2 Example of Parsing (cont.) G < < “explanation” “profile” ※ < < “BoxEmpty1” K
“module_ algorithm” “m_packet” “identifier_ is” 0 1 2 [explanation] “profile” “m_packet” 5.2 Example of Parsing (cont.) G < = [explanation] “profile” ※ < < “BoxEmpty1” K
“m_packet” “module_ algorithm” “identifier_ is” 2 0 1 “profile” [explanation] “m_packet” TOP(G,K) 5.2 Example of Parsing (cont.) G < = [explanation] “profile” ※ < < “BoxEmpty1” K