Presentation is loading. Please wait.

Presentation is loading. Please wait.

Precedence Graph Grammar for Hierarchical Program Diagram

Similar presentations


Presentation on theme: "Precedence Graph Grammar for Hierarchical Program Diagram"— Presentation transcript:

1 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) (Thank you, Mr. Chairman) I am going to talk about “Precedence Graph Grammar for Hierarchical Program Diagram”.

2 Contents Introduction Hichart/DXL Preliminaries
Graph Grammar for Hichart/DXL Parsing of precedence graph grammar for Hichart/DXL Hichart Editor Conclusion This presentation is divided into seven parts: an introduction, Hichart/DXL, some information on the preliminaries, a graph grammar for Hichart/DXL, Parsing of precedence graph grammar for Hichart/DXL, a Hichart editor I’m going to talk about, and, finally, a Conclusion.

3 1. Introduction 1.1 Background 1.2 Motivation 1.3 Purpose 1.4 Results
First, I’ll be speaking about introduction.

4 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 Various researches have been done on graph grammars and their application. We have been developing a software development environment based on graph grammar to formalize of diagram’s structure and layout information to formalize of diagram processing method.

5 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  Hichart to Pascal, C, or DXL Our target in this research is a program diagram. 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 sources to Hichart and that translate Hichart to Pascal, C, or DXL.

6 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 But a parser plays a key role in our processing system and needs to be efficient as large-scale program diagrams are parsed.

7 1.3 Purpose To adopt a precedence relation of graph grammar for Hichart/DXL to parse Hichart diagram efficiently The purpose of this work is to adopt a precedence relation of graph grammar for Hichart/DXL to parse Hichart diagram efficiently .

8 1.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 So far, we have been adopted a precedence relation of graph grammar for Hichart/DXL. And we implemented graphical editor with parser in JAVA.

9 2. Hichart/DXL In this environment, Hichart, is used.
Here’s an example of a “Hanoi Tower” program written in Hichart.

10 2. 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 Hichart has the following characteristics: (1) Each diagram is a tree-flowchart with the same flow-control lines as a Neumann program flowchart. (2) In each diagram, the hierarchy of the data structure and the control flow are displayed on a plane simultaneously.

11 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 Next, I’ll talk about DXL. A diagram exchange language for tree-structure charts, or DXL, was specified in the 1997 ISO. The purpose of DXL is to facilitate the interchange of different tree-structure charts between CASE tools.

12 2. Hichart/DXL (cont.) Data exchange between various tree-structure diagrams through DXL (Hitachi) Data exchange between various tree-structure diagrams through DXL is like this.

13 3. Preliminaries 3.1 edNCE Graph Grammar 3.2 Precedence Graph Grammar
Here, we’ll look at some of the preliminary. These included edNCE graph grammar, and precedence graph grammar.

14 3.1 edNCE Graph Grammar [Rozenberg, 1997]
Firsrt, we’ll look at an edNCE graph grammar. The grammar is defined here.

15 3.1 edNCE Graph Grammar (cont.)
Example of production & derivation (c) Result (a) Host Here is an example of production and derivation. This host graph, (a), is rewritten to graph (c) by applying this production, (b). X:= (b) Production

16 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]. Next, we’ll look at an precedence graph grammar. A graph grammar that is ・confluent ・symmetric ・uniquely invertible ・has no reflexive nonterminals ・no precedence conflicts is called precedence graph grammar.

17 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 A derivation specifications is defined as follows. A derivation specification shows an detail information for application of production.

18 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 derivation sequences is defined as follows.

19 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 And These are precedence relation between nodes and labels. We define a precedence relation using above definitions.

20 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 Now, I’ll talk about graph grammar for Hichart/DXL.

21 4.1 Attribute Graph Grammar for Hichart/DXL
GGHD (Graph Grammar for Hichart/DXL) GG Type Productions Semantic rules GGHD Context-free 70 888 Here is an attribute graph grammar for Hichart/DXL. This grammar is called GGHD (Graph Grammar for Hichart/DXL). GGHD includes 70 productions and 888 attribute rules.

22 4.1 Attribute Graph Grammar for Hichart/DXL (cont.)
Here is an example of the productions and semantic rules of GGHD . Node labels bracket and double quotation mark denote a nonterminal and terminal node, respectively. This is an example of production and semantic rules. Fig. Example of production and semantic rules of GGHD

23 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’. Here, we’ll look at the derivation of GGHD. A derivation of GGHD is as follows. We explain these in an example.

24 4.2 Derivation of GGHD (cont.)
Remove mother node and edges that connect with [profile_module_list] Here is an example of derivation of GGHD. First, remove a mother node [ profile_module_list ] , and edges that connect with [profile_module_list]

25 4.2 Derivation of GGHD (cont.)
Next, embed the daughter graph in production. Embed the daughter graph

26 4.2 Derivation of GGHD (cont.)
Establish edges using the connection instructions And establish edges using the connection instructions of productions. The above is the way of derivation.

27 4.3 Precedence Relation for GGHD
We adopted a precedence relation of graph grammar for Hichart/DXL using Kaul’s definitions Next, we’ll talk about a precedence relation for GGHD. We therefore adopted a precedence relation of graph grammar for Hichart/DXL using Kaul’s definitions. We talk the way to introduce a precedence relation in example.

28 4.3 Precedence Relation for GGHD (cont.)
First I will explain a derivation specification.

29 4.3 Precedence Relation for GGHD (cont.)
In this case, apply production one to node one with [module_packet] label.

30 4.3 Precedence Relation for GGHD (cont.)
Then a derivation specification for this application is as follows: where s1 is a derivation specification that shows an detail information of derivation such as production information. And SD (2) means where node two was generated. In this case, the node two and three were generated in s1. s1=(P1, [module_packet], D1, b) sD(2)=s1 sD(3)=s1

31 4.3 Precedence Relation for GGHD (cont.)
And repeat computing in same way.

32 4.3 Precedence Relation for GGHD (cont.)
s2=(P3, [profile_module_list], D2, b) sD(4)=s2 sD(5)=s2

33 4.3 Precedence Relation for GGHD (cont.)

34 4.3 Precedence Relation for GGHD (cont.)
s3=(P4, [profile], D3, b) sD(6)=s3 sD(7)=s3

35 4.3 Precedence Relation for GGHD (cont.)

36 4.3 Precedence Relation for GGHD (cont.)
s4=(P5, [module_list], D4, b) sD(8)=s4

37 4.3 Precedence Relation for GGHD (cont.)
derivation sequence: [The precedence relation between 6 and 7 ] In the case of G4, a precedence relation of six and seven is as follows. Then the node six and seven were generated in same derivation specification s3. So the precedence relation between six and seven is equal. The precedence relation between labels is here. 6  7 ⇔ sD(6) D sD(7) sD(6)=s3, sD(7)=s3, s3 =D s3, 6 = 7 lab(6, 7) = ("profile", #, , "explanation") ∈R =

38 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 We defined all the precedence relations between labels for grammar GGHD We call this grammar the Precedence Graph Grammar for Hichart/DXL (PGGHD). We show a property. PGGHD is a precedence graph grammar.

39 5. Parsing of Precedence Graph Grammar for Hichart/DXL
5.1 Algorithm for parsing 5.2 Example of Parsing Now, we’ll talk about Parsing of Precedence Graph Grammar for Hichart/DXL. They are: algorithm for parsing, and Example of parsing.

40 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 Next we’ll talk about algorithm for parsing. The parser uses a stack for storing traversed nodes, and starts parsing from the root node of an input graph. The parser repeats from one to three. 1. shift as long as possible 2. If there is no ascending node, a precedence handle is computed. The parser then searches a production where the right-hand-side is isomorphic to the precedence handle. 3. reduce the precedence handle to lhs of the production

41 5.2 Example of Parsing G < < ※ < < K An input graph
“m_packet” “explanation” “profile” < < “identifier_ is” “module_ algorithm” “BoxEmpty1” M_Packet Here’s an example of parsing. G is an input graph. And K is an ordered list of G. K denotes a stack that stores information for shifted nodes. K An ordered list of G

42 5.2 Example of Parsing (cont.)
< < “m_packet” “explanation” “profile” < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” First, the parser sets the root node of an input graph as a current node, and stores root node information in stack K. The parser starts parsing from this condition. K

43 5.2 Example of Parsing (cont.)
< < “m_packet” “explanation” “profile” < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” The parser then computes TOP(G,K), which is a list of nodes that has an equal precedence relation between node labels from the top of stack K. In this case, the result for TOP(G,K) has only one node with the label “m_packet”. Next go along ascending precedence as long as possible. The node with “profile” label has ascending precedence than “m_packet”, so the parser do a shift. K TOP(G,K)

44 5.2 Example of Parsing (cont.)
< < “m_packet” “explanation” “profile” < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” “profile” 1 The parser do shift to “profile” node. And stack K stores “profile”. K

45 5.2 Example of Parsing (cont.)
< < “m_packet” “explanation” “profile” < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” “profile” 1 And the parser computes the TOP(G,K). K TOP(G,K)

46 5.2 Example of Parsing (cont.)
< < “m_packet” “explanation” “profile” < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” “profile” 1 “explanation” 2 And shift. K

47 5.2 Example of Parsing (cont.)
< < “m_packet” “explanation” “profile” < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” “profile” 1 “explanation” 2 And there is no ascending node, so a precedence handle is computed. The parser then searches a production where the right-hand-side is isomorphic to the precedence handle. K TOP(G,K)

48 5.2 Example of Parsing (cont.)
find_production P10 < < “m_packet” “explanation” “profile” < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” “profile” 1 “explanation” 2 In this case, the parser can find production ten. K TOP(G,K)

49 5.2 Example of Parsing (cont.)
< = “m_packet” [explanation] “profile” < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” “profile” 1 [explanation] 2 The parser next reduces the precedence handle to the lhs of the production. K

50 5.2 Example of Parsing (cont.)
< = “m_packet” [explanation] “profile” < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” “profile” 1 [explanation] 2 Repeat above operation until the graph changes into initial graph. K TOP(G,K)

51 5.2 Example of Parsing (cont.)
find_production P04 < = “m_packet” [explanation] “profile” < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” “profile” 1 [explanation] 2 K TOP(G,K)

52 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” [profile] 1 K

53 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” [profile] 1 K TOP(G,K)

54 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” [profile] 1 “identifier_ is” 2 K

55 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” [profile] 1 “identifier_ is” 2 K TOP(G,K)

56 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” [profile] 1 “identifier_ is” 2 “module_ algorithm” 3 K

57 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” [profile] 1 “identifier_ is” 2 “module_ algorithm” 3 K TOP(G,K)

58 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” [profile] 1 “identifier_ is” 2 “module_ algorithm” 3 “BoxEmpty1” 4 K

59 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” [profile] 1 “identifier_ is” 2 “module_ algorithm” 3 “BoxEmpty1” 4 K TOP(G,K)

60 5.2 Example of Parsing (cont.)
find_production P14 < “m_packet” [profile] < < < “identifier_ is” “module_ algorithm” “BoxEmpty1” “m_packet” [profile] 1 “identifier_ is” 2 “module_ algorithm” 3 “BoxEmpty1” 4 K TOP(G,K)

61 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < < = “identifier_ is” “module_ algorithm” [statement_ list] “m_packet” [profile] 1 “identifier_ is” 2 “module_ algorithm” 3 [statement_ list] 4 K

62 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < < = “identifier_ is” “module_ algorithm” [statement_ list] “m_packet” [profile] 1 “identifier_ is” 2 “module_ algorithm” 3 [statement_ list] 4 K TOP(G,K)

63 5.2 Example of Parsing (cont.)
find_production P11 < “m_packet” [profile] < < = “identifier_ is” “module_ algorithm” [statement_ list] “m_packet” [profile] 1 “identifier_ is” 2 “module_ algorithm” 3 [statement_ list] 4 K TOP(G,K)

64 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < < “identifier_ is” [module_ algorithm] “m_packet” [profile] 1 “identifier_ is” 2 [module_ algorithm] 3 K

65 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < < “identifier_ is” [module_ algorithm] “m_packet” [profile] 1 “identifier_ is” 2 [module_ algorithm] 3 K TOP(G,K)

66 5.2 Example of Parsing (cont.)
find_production P08 < “m_packet” [profile] < < “identifier_ is” [module_ algorithm] “m_packet” [profile] 1 “identifier_ is” 2 [module_ algorithm] 3 K TOP(G,K)

67 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < = “identifier_ is” [explanation_modue_ algorithm] “m_packet” [profile] 1 “identifier_ is” 2 [explanation_modue_ algorithm] 3 K

68 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < = “identifier_ is” [explanation_modue_ algorithm] “m_packet” [profile] 1 “identifier_ is” 2 [explanation_modue_ algorithm] 3 K TOP(G,K)

69 5.2 Example of Parsing (cont.)
find_production P07 < “m_packet” [profile] < = “identifier_ is” [explanation_modue_ algorithm] “m_packet” [profile] 1 “identifier_ is” 2 [explanation_modue_ algorithm] 3 K TOP(G,K)

70 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < [module] “m_packet” [profile] 1 [module] 2 K

71 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < [module] “m_packet” [profile] 1 [module] 2 K TOP(G,K)

72 5.2 Example of Parsing (cont.)
< “m_packet” [profile] < find_production P05 [module] “m_packet” [profile] 1 [module] 2 K TOP(G,K)

73 5.2 Example of Parsing (cont.)
< “m_packet” [profile] = [module_ list] “m_packet” [profile] 1 [module_ list] 2 K

74 5.2 Example of Parsing (cont.)
< “m_packet” [profile] = [module_ list] “m_packet” [profile] 1 [module_ list] 2 K TOP(G,K)

75 5.2 Example of Parsing (cont.)
< “m_packet” [profile] find_production P03 = [module_ list] “m_packet” [profile] 1 [module_ list] 2 K TOP(G,K)

76 5.2 Example of Parsing (cont.)
= “m_packet” profile_module_ list “m_packet” profile_module_ list 1 K

77 5.2 Example of Parsing (cont.)
= “m_packet” profile_module_ list “m_packet” profile_module_ list 1 K TOP(G,K)

78 5.2 Example of Parsing (cont.)
= find_production P01 “m_packet” profile_module_ list “m_packet” profile_module_ list 1 K TOP(G,K)

79 5.2 Example of Parsing (cont.)
[module_ packet] [module_ packet] K

80 5.2 Example of Parsing (cont.)
[module_ packet] [module_ packet] The graph with [module_packet] label is initial graph of PGGHD. So the parser finish parsing. K finish parsing TOP(G,K)

81 6. 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 Now, we’ll look at the Hichart editor. The Hichart editor is a graphical editor that supports non-syntax-directed editing and has parser. This editor consists of about steps. These features have already been developed: To check the correctness of diagrams To draw Hichart diagrams aesthetically To generate an SVG file

82 6. Hichart Editor (cont.) Input: Hichart diagrams
Output: Hichart code with derivation tree SVG files with aesthetically drawing The input of the editor is Hichart diagrams. And the output of the editor is the Hichart code with a derivation tree and SVG files with aesthetically drawing.

83 DEMO Parsing on Hichart Editor Generating SVG file on Hichart Editor
Here is a demonstration. In the non-syntax-directed editor, drawing aesthetic Hichart diagrams and generating SVG files are performed automatically after the setup of each node label and parsing. The user put cells on editor and input cell information. Next put edges between nodes. Then the user choose parse from menu. The diagram draw aesthetically. Next we show an example which is described in ISO This is an example of “word count program”. And we try to parse. Next we try to generate SVG file. Here is an SVG files that were generated.

84 7. 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 Now, I’d like to summarize. So far, we have been adopted a precedence relation of graph grammar for Hichart/DXL. And we implemented graphical editor with parser in JAVA.

85 7. Conclusion (cont.) Our graph grammar based method would be able to apply to other visual programming systems that treat tree-like graphs Our graph grammar based method would be able to apply to other visual programming systems that treat tree-like graphs.

86 7. Conclusion (cont.) Future work
To apply our method of graph grammar to Object-Oriented Language We intend to apply our method of graph grammar to Object-Oriented Language in the future. That’s the end of my presentation. Thank you very much.


Download ppt "Precedence Graph Grammar for Hierarchical Program Diagram"

Similar presentations


Ads by Google