+ All Categories
Home > Documents > Precedence Graph Grammar for Hierarchical Program Diagram

Precedence Graph Grammar for Hierarchical Program Diagram

Date post: 31-Jan-2016
Category:
Upload: afya
View: 36 times
Download: 0 times
Share this document with a friend
Description:
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 - PowerPoint PPT Presentation
Popular Tags:
86
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)
Transcript
Page 1: Precedence  Graph Grammar for Hierarchical  Program Diagram

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)

Page 2: Precedence  Graph Grammar for Hierarchical  Program Diagram

2

1. Introduction2. Hichart/DXL3. Preliminaries4. Graph Grammar for Hichart/DXL5. Parsing of precedence graph grammar for

Hichart/DXL6. Hichart Editor7. Conclusion

Contents

Page 3: Precedence  Graph Grammar for Hierarchical  Program Diagram

3

1. Introduction

1.1 Background1.2 Motivation1.3 Purpose1.4 Results

Page 4: Precedence  Graph Grammar for Hierarchical  Program Diagram

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

Page 5: Precedence  Graph Grammar for Hierarchical  Program Diagram

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 translatePascal, C, or DXL to Hichart  Hichart   to Pascal, C, or DXL

Page 6: Precedence  Graph Grammar for Hierarchical  Program Diagram

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

Page 7: Precedence  Graph Grammar for Hierarchical  Program Diagram

7

1.3 Purpose

To adopt a precedence relation of graph grammar for Hichart/DXL to parse Hichart diagram efficiently

Page 8: Precedence  Graph Grammar for Hierarchical  Program Diagram

8

1.4 Results Adapted a precedence relation of

graph grammar for Hichart/DXL productions   70semantic rules   888precedence relations   256

Implemented graphical editor with parser in JAVA

Page 9: Precedence  Graph Grammar for Hierarchical  Program Diagram

9

2. Hichart/DXL

Page 10: Precedence  Graph Grammar for Hierarchical  Program Diagram

10

2. Hichart/DXL (cont.)

Characteristics of Hichart(1) Diagram is a tree-flowchart with the

same flow control lines as a Neumann program flowchart

(2) The hierarchy of the data structure and the control flow are displayed on a plane simultaneously

Page 11: Precedence  Graph Grammar for Hierarchical  Program Diagram

11

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.)

Page 12: Precedence  Graph Grammar for Hierarchical  Program Diagram

12

Data exchange between various tree-structure diagrams through DXL

2. Hichart/DXL (cont.)

(Hitachi)

Page 13: Precedence  Graph Grammar for Hierarchical  Program Diagram

13

3. Preliminaries

3.1 edNCE Graph Grammar3.2 Precedence Graph Grammar

Page 14: Precedence  Graph Grammar for Hierarchical  Program Diagram

14

3.1 edNCE Graph Grammar [Rozenberg, 1997]

Page 15: Precedence  Graph Grammar for Hierarchical  Program Diagram

15

3.1 edNCE Graph Grammar (cont.)

(c) Result

Example of production & derivation

(a) Host

(b) Production

X:=

Page 16: Precedence  Graph Grammar for Hierarchical  Program Diagram

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].

Page 17: Precedence  Graph Grammar for Hierarchical  Program Diagram

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

)~

,~

,~

,( bDXps

X~

D~

b~

RRVV ~

Page 18: Precedence  Graph Grammar for Hierarchical  Program Diagram

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

iS jS j iL R

D

)~

,~

,~

,(,),1|( 1 iiiiiis

i bRLpsNnniGGDi

ji ss , iDj ss jDi ss

Page 19: Precedence  Graph Grammar for Hierarchical  Program Diagram

19

3.2 Precedence Graph Grammar (cont.)

DD v D wv w s s

An ordering of the nodes in Gn is

,,, are the precedence relation between nodes

The precedence relations between labels

,,,,R

is the set of all )}(),,(),,(),({),( wλvwEwvEvλwvlab GGG

Page 20: Precedence  Graph Grammar for Hierarchical  Program Diagram

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

Page 21: Precedence  Graph Grammar for Hierarchical  Program Diagram

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

Page 22: Precedence  Graph Grammar for Hierarchical  Program Diagram

22

4.1 Attribute Graph Grammar for Hichart/DXL (cont.)

Fig. Example of production and semantic rules of GGHD

Page 23: Precedence  Graph Grammar for Hierarchical  Program Diagram

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’.

Page 24: Precedence  Graph Grammar for Hierarchical  Program Diagram

24

4.2 Derivation of GGHD  

(cont.)

Remove mother node and edges that connect

with [profile_module_list]

Page 25: Precedence  Graph Grammar for Hierarchical  Program Diagram

25

4.2 Derivation of GGHD  

(cont.)

Embed the daughter graph

Page 26: Precedence  Graph Grammar for Hierarchical  Program Diagram

26

4.2 Derivation of GGHD  

(cont.)

Establish edges using the connection instructions

Page 27: Precedence  Graph Grammar for Hierarchical  Program Diagram

27

4.3 Precedence Relation for GGHD

We adopted a precedence relation of graph grammar for Hichart/DXL using Kaul’s definitions

Page 28: Precedence  Graph Grammar for Hierarchical  Program Diagram

28

4.3 Precedence Relation for GGHD (cont.)

Page 29: Precedence  Graph Grammar for Hierarchical  Program Diagram

29

4.3 Precedence Relation for GGHD (cont.)

Page 30: Precedence  Graph Grammar for Hierarchical  Program Diagram

30

4.3 Precedence Relation for GGHD (cont.)

s1=(P1, [module_packet], D1, b)

sD(2)=s1

sD(3)=s1

Page 31: Precedence  Graph Grammar for Hierarchical  Program Diagram

31

4.3 Precedence Relation for GGHD (cont.)

Page 32: Precedence  Graph Grammar for Hierarchical  Program Diagram

32

4.3 Precedence Relation for GGHD (cont.)

s2=(P3, [profile_module_list], D2, b)

sD(4)=s2

sD(5)=s2

Page 33: Precedence  Graph Grammar for Hierarchical  Program Diagram

33

4.3 Precedence Relation for GGHD (cont.)

Page 34: Precedence  Graph Grammar for Hierarchical  Program Diagram

34

4.3 Precedence Relation for GGHD (cont.)

s3=(P4, [profile], D3, b)

sD(6)=s3

sD(7)=s3

Page 35: Precedence  Graph Grammar for Hierarchical  Program Diagram

35

4.3 Precedence Relation for GGHD (cont.)

Page 36: Precedence  Graph Grammar for Hierarchical  Program Diagram

36

4.3 Precedence Relation for GGHD (cont.)

s4=(P5, [module_list], D4, b)

sD(8)=s4

Page 37: Precedence  Graph Grammar for Hierarchical  Program Diagram

37

4.3 Precedence Relation for GGHD (cont.)

432104321

GGGGGssssderivation

sequence :

sD(6)=s3, sD(7)=s3, s3 =D s3, 6 = 7

6 7 ⇔ sD(6) D sD(7)

lab(6, 7) = ("profile", #, , "explanation") R ∈ =

[The precedence relation between 6 and 7 ]

421321 ,, ssssss DDDD

Page 38: Precedence  Graph Grammar for Hierarchical  Program Diagram

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

Page 39: Precedence  Graph Grammar for Hierarchical  Program Diagram

39

5. Parsing of Precedence Graph Grammar for Hichart/DXL

5.1 Algorithm for parsing5.2 Example of Parsing

Page 40: Precedence  Graph Grammar for Hierarchical  Program Diagram

40

5.1 Algorithm for parsing

uses a stack for storing traversed nodes Starts parsing from the root node of an input graph

[parsing]1. shift as long as possible2. If there is no ascending node, the parser searches

a production where the right-hand-side is isomorphic to the precedence handle.

3. reduce the precedence handle to lhs of the production

Page 41: Precedence  Graph Grammar for Hierarchical  Program Diagram

41

“m_packet” “profile”

“identifier_is”

“explanation”

“module_algorithm”

“BoxEmpty1”

<

< <

<

M_Packet

0

G

K※

5.2 Example of ParsingAn input

graph

An ordered listof G

Page 42: Precedence  Graph Grammar for Hierarchical  Program Diagram

42

“m_packet” “profile”

“identifier_is”

“explanation”

“module_algorithm”

“BoxEmpty1”

<

< <

<

“m_packet”

0

G

K

5.2 Example of Parsing (cont.)

Page 43: Precedence  Graph Grammar for Hierarchical  Program Diagram

43

“m_packet” “profile”

“identifier_is”

“explanation”

“module_algorithm”

“BoxEmpty1”

<

< <

<

“m_packet”

0

G

K

TOP(G,K)

5.2 Example of Parsing (cont.)

Page 44: Precedence  Graph Grammar for Hierarchical  Program Diagram

44

“m_packet”

0

“profile”

1

G

K

5.2 Example of Parsing (cont.)

“m_packet” “profile”

“identifier_is”

“explanation”

“module_algorithm”

“BoxEmpty1”

<

< <

<

Page 45: Precedence  Graph Grammar for Hierarchical  Program Diagram

45

G

K

TOP(G,K)

5.2 Example of Parsing (cont.)

“m_packet” “profile”

“identifier_is”

“explanation”

“module_algorithm”

“BoxEmpty1”< <

※“m_packet”

0

“profile”

1

< <

Page 46: Precedence  Graph Grammar for Hierarchical  Program Diagram

46

G

K “explanation”

2

5.2 Example of Parsing (cont.)

“m_packet” “profile”

“identifier_is”

“explanation”

“module_algorithm”

“BoxEmpty1”< <

< <

“m_packet”

0

“profile”

1

Page 47: Precedence  Graph Grammar for Hierarchical  Program Diagram

47

G

K “explanation”

2

5.2 Example of Parsing (cont.)

“m_packet” “profile”

“identifier_is”

“explanation”

“module_algorithm”

“BoxEmpty1”< <

< <

“m_packet”

0

“profile”

1

TOP(G,K)

Page 48: Precedence  Graph Grammar for Hierarchical  Program Diagram

48

G

K “explanation”

2

5.2 Example of Parsing (cont.)

“m_packet” “profile”

“identifier_is”

“explanation”

“module_algorithm”

“BoxEmpty1”< <

< <

“m_packet”

0

“profile”

1

TOP(G,K)

find_production

P10

Page 49: Precedence  Graph Grammar for Hierarchical  Program Diagram

49

G

K [explanation]

2

5.2 Example of Parsing (cont.)

“m_packet” “profile”

“identifier_is”

[explanation]

“module_algorithm”

“BoxEmpty1”< <

< =

“m_packet”

0

“profile”

1

Page 50: Precedence  Graph Grammar for Hierarchical  Program Diagram

50

G

K [explanation]

2

5.2 Example of Parsing (cont.)

“m_packet” “profile”

“identifier_is”

[explanation]

“module_algorithm”

“BoxEmpty1”< <

< =

“m_packet”

0

“profile”

1

TOP(G,K)

Page 51: Precedence  Graph Grammar for Hierarchical  Program Diagram

51

G

K [explanation]

2

5.2 Example of Parsing (cont.)

“m_packet” “profile”

“identifier_is”

[explanation]

“module_algorithm”

“BoxEmpty1”< <

< =

“m_packet”

0

“profile”

1

TOP(G,K)

find_production

P04

Page 52: Precedence  Graph Grammar for Hierarchical  Program Diagram

52

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

“module_algorithm”

“BoxEmpty1”< <

<

“m_packet”

0

[profile]

1

[profile]

<

Page 53: Precedence  Graph Grammar for Hierarchical  Program Diagram

53

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

“module_algorithm”

“BoxEmpty1”< <

<

“m_packet”

0

[profile]

1

[profile]

<

TOP(G,K)

Page 54: Precedence  Graph Grammar for Hierarchical  Program Diagram

54

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

“module_algorithm”

“BoxEmpty1”< <

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2

Page 55: Precedence  Graph Grammar for Hierarchical  Program Diagram

55

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

“module_algorithm”

“BoxEmpty1”< <

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2

TOP(G,K)

Page 56: Precedence  Graph Grammar for Hierarchical  Program Diagram

56

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

“module_algorithm”

“BoxEmpty1”< <

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2“module_algorithm”

3

Page 57: Precedence  Graph Grammar for Hierarchical  Program Diagram

57

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

“module_algorithm”

“BoxEmpty1”< <

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2“module_algorithm”

3

TOP(G,K)

Page 58: Precedence  Graph Grammar for Hierarchical  Program Diagram

58

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

“module_algorithm”

“BoxEmpty1”< <

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2“module_algorithm”

3

“BoxEmpty1”

4

Page 59: Precedence  Graph Grammar for Hierarchical  Program Diagram

59

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

“module_algorithm”

“BoxEmpty1”< <

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2“module_algorithm”

3

“BoxEmpty1”

4

TOP(G,K)

Page 60: Precedence  Graph Grammar for Hierarchical  Program Diagram

60

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

“module_algorithm”

“BoxEmpty1”< <

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2“module_algorithm”

3

“BoxEmpty1”

4

TOP(G,K)

find_production

P14

Page 61: Precedence  Graph Grammar for Hierarchical  Program Diagram

61

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

“module_algorithm”

[statement_list]

< =

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2“module_algorithm”

3[statement_

list]

4

Page 62: Precedence  Graph Grammar for Hierarchical  Program Diagram

62

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

“module_algorithm”

[statement_list]

< =

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2“module_algorithm”

3[statement_

list]

4

TOP(G,K)

Page 63: Precedence  Graph Grammar for Hierarchical  Program Diagram

63

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

“module_algorithm”

[statement_list]

< =

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2“module_algorithm”

3[statement_

list]

4

TOP(G,K)

find_production

P11

Page 64: Precedence  Graph Grammar for Hierarchical  Program Diagram

64

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

<

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2[module_algorithm]

3

[module_algorithm]

Page 65: Precedence  Graph Grammar for Hierarchical  Program Diagram

65

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

<

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2[module_algorithm]

3

[module_algorithm]

TOP(G,K)

Page 66: Precedence  Graph Grammar for Hierarchical  Program Diagram

66

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

<

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2[module_algorithm]

3

[module_algorithm]

TOP(G,K)

find_production

P08

Page 67: Precedence  Graph Grammar for Hierarchical  Program Diagram

67

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

=

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2

[explanation_modue_algorithm]

[explanation_modue_algorithm]

3

Page 68: Precedence  Graph Grammar for Hierarchical  Program Diagram

68

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

=

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2

[explanation_modue_algorithm]

[explanation_modue_algorithm]

3

TOP(G,K)

Page 69: Precedence  Graph Grammar for Hierarchical  Program Diagram

69

G

K

5.2 Example of Parsing (cont.)

“m_packet”

“identifier_is”

=

<

“m_packet”

0

[profile]

1

[profile]

<

“identifier_is”

2

[explanation_modue_algorithm]

[explanation_modue_algorithm]

3

TOP(G,K)

find_production

P07

Page 70: Precedence  Graph Grammar for Hierarchical  Program Diagram

70

G

K

5.2 Example of Parsing (cont.)

“m_packet”<

“m_packet”

0

[profile]

1

[profile]

<

[module]

[module]

2

Page 71: Precedence  Graph Grammar for Hierarchical  Program Diagram

71

G

K

5.2 Example of Parsing (cont.)

“m_packet”<

“m_packet”

0

[profile]

1

[profile]

<

[module]

[module]

2

TOP(G,K)

Page 72: Precedence  Graph Grammar for Hierarchical  Program Diagram

72

G

K

5.2 Example of Parsing (cont.)

“m_packet”<

“m_packet”

0

[profile]

1

[profile]

<

[module]

[module]

2

TOP(G,K)

find_production

P05

Page 73: Precedence  Graph Grammar for Hierarchical  Program Diagram

73

G

K

5.2 Example of Parsing (cont.)

“m_packet”<

“m_packet”

0

[profile]

1

[profile]

=

[module_list]

[module_list]

2

Page 74: Precedence  Graph Grammar for Hierarchical  Program Diagram

74

G

K

5.2 Example of Parsing (cont.)

“m_packet”<

“m_packet”

0

[profile]

1

[profile]

=

[module_list]

[module_list]

2

TOP(G,K)

Page 75: Precedence  Graph Grammar for Hierarchical  Program Diagram

75

G

K

5.2 Example of Parsing (cont.)

“m_packet”<

“m_packet”

0

[profile]

1

[profile]

=

[module_list]

[module_list]

2

TOP(G,K)

find_production

P03

Page 76: Precedence  Graph Grammar for Hierarchical  Program Diagram

76

G

K

5.2 Example of Parsing (cont.)

“m_packet”=

“m_packet”

0

profile_module_list

profile_module_list

1

Page 77: Precedence  Graph Grammar for Hierarchical  Program Diagram

77

G

K

5.2 Example of Parsing (cont.)

“m_packet”=

“m_packet”

0

profile_module_list

profile_module_list

1

TOP(G,K)

Page 78: Precedence  Graph Grammar for Hierarchical  Program Diagram

78

G

K

5.2 Example of Parsing (cont.)

“m_packet”=

“m_packet”

0

profile_module_list

profile_module_list

1

TOP(G,K)

find_productionP01

Page 79: Precedence  Graph Grammar for Hierarchical  Program Diagram

79

[module_packet]

[module_packet]

0

G

K

5.2 Example of Parsing (cont.)

Page 80: Precedence  Graph Grammar for Hierarchical  Program Diagram

80

[module_packet]

[module_packet]

0

G

K

5.2 Example of Parsing (cont.)

finish parsing

TOP(G,K)

Page 81: Precedence  Graph Grammar for Hierarchical  Program Diagram

81

6. Hichart Editor【 Outline 】Hichart Editor Supports non-syntax-directed editing has parserJava ( 10,000steps )【 features 】

1. To check the correctness of diagrams2. To draw Hichart diagrams aesthetically3. To generate an SVG file

Page 82: Precedence  Graph Grammar for Hierarchical  Program Diagram

82

Input: Hichart diagrams

Output: Hichart code with derivation tree

SVG files with aesthetically drawing

6. Hichart Editor (cont.)

Page 83: Precedence  Graph Grammar for Hierarchical  Program Diagram

83

DEMO

Parsing on Hichart Editor Generating SVG file on Hichart Editor

Page 84: Precedence  Graph Grammar for Hierarchical  Program Diagram

84

7. ConclusionSummary 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

Page 85: Precedence  Graph Grammar for Hierarchical  Program Diagram

85

7. Conclusion (cont.)

Our graph grammar based method would be able to apply to other visual programming systems that treat tree-like graphs

Page 86: Precedence  Graph Grammar for Hierarchical  Program Diagram

86

7. Conclusion (cont.)

Future workTo apply our method of graph grammar

to Object-Oriented Language


Recommended