質問編集履歴
2
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,511 +1,256 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
|
-
|
4
|
-
|
5
3
|
現在構文解析を勉強していて、その過程でbisonを使っていました。.yファイルの内容をオートマトンに書き起こしたいと思い、
|
6
|
-
|
7
4
|
http://www.cs.info.mie-u.ac.jp/~toshi/lectures/compiler/yacc-parser.html
|
8
|
-
|
9
5
|
のページを参考にして、```bison -g test.y```のようにして実行したのですが、出力されたvcgファイルをオートマトンの画像にする方法がわかりません。
|
10
|
-
|
11
6
|
どうにかして状態遷移図をみたいです。解決方法を教えていただけると幸いです。
|
12
7
|
|
13
|
-
|
14
|
-
|
15
8
|
### 出力されたファイル
|
16
|
-
|
17
9
|
このような形式のファイルが出力されました。
|
18
|
-
|
19
|
-
```
|
10
|
+
```vcg
|
20
|
-
|
21
11
|
graph: {
|
22
|
-
|
23
12
|
display_edge_labels: yes
|
24
|
-
|
25
13
|
long_straight_phase: yes
|
26
|
-
|
27
14
|
priority_phase: yes
|
28
|
-
|
29
15
|
port_sharing: no
|
30
|
-
|
31
16
|
crossing_weight: median
|
32
|
-
|
33
17
|
splines: yes
|
34
|
-
|
35
|
-
node: {
|
18
|
+
node: {
|
36
|
-
|
37
19
|
title: "0"
|
38
|
-
|
39
20
|
label: "state 0\n $accept -> . lines $end"
|
40
|
-
|
41
|
-
}
|
21
|
+
}
|
42
|
-
|
43
|
-
edge: {
|
22
|
+
edge: {
|
44
|
-
|
45
|
-
sourcename: "0"
|
23
|
+
sourcename: "0"
|
46
|
-
|
47
24
|
targetname: "1"
|
48
|
-
|
49
25
|
label: "'\n'"
|
50
|
-
|
51
|
-
color: blue
|
26
|
+
color: blue
|
52
|
-
|
53
|
-
textcolor: black
|
27
|
+
textcolor: black
|
54
|
-
|
55
|
-
}
|
28
|
+
}
|
56
|
-
|
57
|
-
edge: {
|
29
|
+
edge: {
|
58
|
-
|
59
|
-
sourcename: "0"
|
30
|
+
sourcename: "0"
|
60
|
-
|
61
|
-
targetname: "2"
|
31
|
+
targetname: "2"
|
62
|
-
|
63
|
-
label: "'a'"
|
32
|
+
label: "'a'"
|
64
|
-
|
65
|
-
color: blue
|
33
|
+
color: blue
|
66
|
-
|
67
|
-
textcolor: black
|
34
|
+
textcolor: black
|
68
|
-
|
69
|
-
}
|
35
|
+
}
|
70
|
-
|
71
|
-
edge: {
|
36
|
+
edge: {
|
72
|
-
|
73
|
-
sourcename: "0"
|
37
|
+
sourcename: "0"
|
74
|
-
|
75
|
-
targetname: "3"
|
38
|
+
targetname: "3"
|
76
|
-
|
77
|
-
label: "'('"
|
39
|
+
label: "'('"
|
78
|
-
|
79
|
-
color: blue
|
40
|
+
color: blue
|
80
|
-
|
81
|
-
textcolor: black
|
41
|
+
textcolor: black
|
82
|
-
|
83
|
-
}
|
42
|
+
}
|
84
|
-
|
85
|
-
edge: {
|
43
|
+
edge: {
|
86
|
-
|
87
|
-
sourcename: "0"
|
44
|
+
sourcename: "0"
|
88
|
-
|
89
45
|
targetname: "4"
|
90
|
-
|
91
46
|
label: "lines"
|
92
|
-
|
93
|
-
color: green
|
47
|
+
color: green
|
94
|
-
|
95
|
-
textcolor: black
|
48
|
+
textcolor: black
|
96
|
-
|
97
|
-
}
|
49
|
+
}
|
98
|
-
|
99
|
-
edge: {
|
50
|
+
edge: {
|
100
|
-
|
101
|
-
sourcename: "0"
|
51
|
+
sourcename: "0"
|
102
|
-
|
103
52
|
targetname: "5"
|
104
|
-
|
105
53
|
label: "line"
|
106
|
-
|
107
|
-
color: green
|
54
|
+
color: green
|
108
|
-
|
109
|
-
textcolor: black
|
55
|
+
textcolor: black
|
110
|
-
|
111
|
-
}
|
56
|
+
}
|
112
|
-
|
113
|
-
edge: {
|
57
|
+
edge: {
|
114
|
-
|
115
|
-
sourcename: "0"
|
58
|
+
sourcename: "0"
|
116
|
-
|
117
59
|
targetname: "6"
|
118
|
-
|
119
|
-
label: "S"
|
60
|
+
label: "S"
|
120
|
-
|
121
|
-
color: green
|
61
|
+
color: green
|
122
|
-
|
123
|
-
textcolor: black
|
62
|
+
textcolor: black
|
124
|
-
|
125
|
-
}
|
63
|
+
}
|
126
|
-
|
127
|
-
node: {
|
64
|
+
node: {
|
128
|
-
|
129
65
|
title: "1"
|
130
|
-
|
131
66
|
label: "state 1\n line -> '\n' ."
|
132
|
-
|
133
|
-
}
|
67
|
+
}
|
134
|
-
|
135
|
-
node: {
|
68
|
+
node: {
|
136
|
-
|
137
69
|
title: "2"
|
138
|
-
|
139
70
|
label: "state 2\n S -> 'a' ."
|
140
|
-
|
141
|
-
}
|
71
|
+
}
|
142
|
-
|
143
|
-
node: {
|
72
|
+
node: {
|
144
|
-
|
145
73
|
title: "3"
|
146
|
-
|
147
74
|
label: "state 3\n S -> '(' . L"
|
148
|
-
|
149
|
-
}
|
75
|
+
}
|
150
|
-
|
151
|
-
backedge: {
|
76
|
+
backedge: {
|
152
|
-
|
153
|
-
sourcename: "3"
|
77
|
+
sourcename: "3"
|
154
|
-
|
155
|
-
targetname: "2"
|
78
|
+
targetname: "2"
|
156
|
-
|
157
|
-
label: "'a'"
|
79
|
+
label: "'a'"
|
158
|
-
|
159
|
-
color: blue
|
80
|
+
color: blue
|
160
|
-
|
161
|
-
textcolor: black
|
81
|
+
textcolor: black
|
162
|
-
|
163
|
-
}
|
82
|
+
}
|
164
|
-
|
165
|
-
edge: {
|
83
|
+
edge: {
|
166
|
-
|
167
|
-
sourcename: "3"
|
84
|
+
sourcename: "3"
|
168
|
-
|
169
|
-
targetname: "3"
|
85
|
+
targetname: "3"
|
170
|
-
|
171
|
-
label: "'('"
|
86
|
+
label: "'('"
|
172
|
-
|
173
|
-
color: blue
|
87
|
+
color: blue
|
174
|
-
|
175
|
-
textcolor: black
|
88
|
+
textcolor: black
|
176
|
-
|
177
|
-
}
|
89
|
+
}
|
178
|
-
|
179
|
-
edge: {
|
90
|
+
edge: {
|
180
|
-
|
181
|
-
sourcename: "3"
|
91
|
+
sourcename: "3"
|
182
|
-
|
183
92
|
targetname: "7"
|
184
|
-
|
185
93
|
label: "')'"
|
186
|
-
|
187
|
-
color: blue
|
94
|
+
color: blue
|
188
|
-
|
189
|
-
textcolor: black
|
95
|
+
textcolor: black
|
190
|
-
|
191
|
-
}
|
96
|
+
}
|
192
|
-
|
193
|
-
edge: {
|
97
|
+
edge: {
|
194
|
-
|
195
|
-
sourcename: "3"
|
98
|
+
sourcename: "3"
|
196
|
-
|
197
99
|
targetname: "8"
|
198
|
-
|
199
|
-
label: "S"
|
100
|
+
label: "S"
|
200
|
-
|
201
|
-
color: green
|
101
|
+
color: green
|
202
|
-
|
203
|
-
textcolor: black
|
102
|
+
textcolor: black
|
204
|
-
|
205
|
-
}
|
103
|
+
}
|
206
|
-
|
207
|
-
edge: {
|
104
|
+
edge: {
|
208
|
-
|
209
|
-
sourcename: "3"
|
105
|
+
sourcename: "3"
|
210
|
-
|
211
106
|
targetname: "9"
|
212
|
-
|
213
107
|
label: "L"
|
214
|
-
|
215
|
-
color: green
|
108
|
+
color: green
|
216
|
-
|
217
|
-
textcolor: black
|
109
|
+
textcolor: black
|
218
|
-
|
219
|
-
}
|
110
|
+
}
|
220
|
-
|
221
|
-
node: {
|
111
|
+
node: {
|
222
|
-
|
223
112
|
title: "4"
|
224
|
-
|
225
113
|
label: "state 4\n $accept -> lines . $end"
|
226
|
-
|
227
|
-
}
|
114
|
+
}
|
228
|
-
|
229
|
-
edge: {
|
115
|
+
edge: {
|
230
|
-
|
231
116
|
sourcename: "4"
|
232
|
-
|
233
117
|
targetname: "10"
|
234
|
-
|
235
118
|
label: "$end"
|
236
|
-
|
237
|
-
color: blue
|
119
|
+
color: blue
|
238
|
-
|
239
|
-
textcolor: black
|
120
|
+
textcolor: black
|
240
|
-
|
241
|
-
}
|
121
|
+
}
|
242
|
-
|
243
|
-
node: {
|
122
|
+
node: {
|
244
|
-
|
245
123
|
title: "5"
|
246
|
-
|
247
124
|
label: "state 5\n lines -> line . lines"
|
248
|
-
|
249
|
-
}
|
125
|
+
}
|
250
|
-
|
251
|
-
backedge: {
|
126
|
+
backedge: {
|
252
|
-
|
253
|
-
sourcename: "5"
|
127
|
+
sourcename: "5"
|
254
|
-
|
255
128
|
targetname: "1"
|
256
|
-
|
257
129
|
label: "'\n'"
|
258
|
-
|
259
|
-
color: blue
|
130
|
+
color: blue
|
260
|
-
|
261
|
-
textcolor: black
|
131
|
+
textcolor: black
|
262
|
-
|
263
|
-
}
|
132
|
+
}
|
264
|
-
|
265
|
-
backedge: {
|
133
|
+
backedge: {
|
266
|
-
|
267
|
-
sourcename: "5"
|
134
|
+
sourcename: "5"
|
268
|
-
|
269
|
-
targetname: "2"
|
135
|
+
targetname: "2"
|
270
|
-
|
271
|
-
label: "'a'"
|
136
|
+
label: "'a'"
|
272
|
-
|
273
|
-
color: blue
|
137
|
+
color: blue
|
274
|
-
|
275
|
-
textcolor: black
|
138
|
+
textcolor: black
|
276
|
-
|
277
|
-
}
|
139
|
+
}
|
278
|
-
|
279
|
-
backedge: {
|
140
|
+
backedge: {
|
280
|
-
|
281
|
-
sourcename: "5"
|
141
|
+
sourcename: "5"
|
282
|
-
|
283
|
-
targetname: "3"
|
142
|
+
targetname: "3"
|
284
|
-
|
285
|
-
label: "'('"
|
143
|
+
label: "'('"
|
286
|
-
|
287
|
-
color: blue
|
144
|
+
color: blue
|
288
|
-
|
289
|
-
textcolor: black
|
145
|
+
textcolor: black
|
290
|
-
|
291
|
-
}
|
146
|
+
}
|
292
|
-
|
293
|
-
edge: {
|
147
|
+
edge: {
|
294
|
-
|
295
|
-
sourcename: "5"
|
148
|
+
sourcename: "5"
|
296
|
-
|
297
149
|
targetname: "11"
|
298
|
-
|
299
150
|
label: "lines"
|
300
|
-
|
301
|
-
color: green
|
151
|
+
color: green
|
302
|
-
|
303
|
-
textcolor: black
|
152
|
+
textcolor: black
|
304
|
-
|
305
|
-
}
|
153
|
+
}
|
306
|
-
|
307
|
-
edge: {
|
154
|
+
edge: {
|
308
|
-
|
309
|
-
sourcename: "5"
|
155
|
+
sourcename: "5"
|
310
|
-
|
311
156
|
targetname: "5"
|
312
|
-
|
313
157
|
label: "line"
|
314
|
-
|
315
|
-
color: green
|
158
|
+
color: green
|
316
|
-
|
317
|
-
textcolor: black
|
159
|
+
textcolor: black
|
318
|
-
|
319
|
-
}
|
160
|
+
}
|
320
|
-
|
321
|
-
edge: {
|
161
|
+
edge: {
|
322
|
-
|
323
|
-
sourcename: "5"
|
162
|
+
sourcename: "5"
|
324
|
-
|
325
163
|
targetname: "6"
|
326
|
-
|
327
|
-
label: "S"
|
164
|
+
label: "S"
|
328
|
-
|
329
|
-
color: green
|
165
|
+
color: green
|
330
|
-
|
331
|
-
textcolor: black
|
166
|
+
textcolor: black
|
332
|
-
|
333
|
-
}
|
167
|
+
}
|
334
|
-
|
335
|
-
node: {
|
168
|
+
node: {
|
336
|
-
|
337
169
|
title: "6"
|
338
|
-
|
339
170
|
label: "state 6\n line -> S . '\n'"
|
340
|
-
|
341
|
-
}
|
171
|
+
}
|
342
|
-
|
343
|
-
edge: {
|
172
|
+
edge: {
|
344
|
-
|
345
173
|
sourcename: "6"
|
346
|
-
|
347
174
|
targetname: "12"
|
348
|
-
|
349
175
|
label: "'\n'"
|
350
|
-
|
351
|
-
color: blue
|
176
|
+
color: blue
|
352
|
-
|
353
|
-
textcolor: black
|
177
|
+
textcolor: black
|
354
|
-
|
355
|
-
}
|
178
|
+
}
|
356
|
-
|
357
|
-
node: {
|
179
|
+
node: {
|
358
|
-
|
359
180
|
title: "7"
|
360
|
-
|
361
181
|
label: "state 7\n L -> ')' ."
|
362
|
-
|
363
|
-
}
|
182
|
+
}
|
364
|
-
|
365
|
-
node: {
|
183
|
+
node: {
|
366
|
-
|
367
184
|
title: "8"
|
368
|
-
|
369
185
|
label: "state 8\n L -> S . L"
|
370
|
-
|
371
|
-
}
|
186
|
+
}
|
372
|
-
|
373
|
-
backedge: {
|
187
|
+
backedge: {
|
374
|
-
|
375
|
-
sourcename: "8"
|
188
|
+
sourcename: "8"
|
376
|
-
|
377
|
-
targetname: "2"
|
189
|
+
targetname: "2"
|
378
|
-
|
379
|
-
label: "'a'"
|
190
|
+
label: "'a'"
|
380
|
-
|
381
|
-
color: blue
|
191
|
+
color: blue
|
382
|
-
|
383
|
-
textcolor: black
|
192
|
+
textcolor: black
|
384
|
-
|
385
|
-
}
|
193
|
+
}
|
386
|
-
|
387
|
-
backedge: {
|
194
|
+
backedge: {
|
388
|
-
|
389
|
-
sourcename: "8"
|
195
|
+
sourcename: "8"
|
390
|
-
|
391
|
-
targetname: "3"
|
196
|
+
targetname: "3"
|
392
|
-
|
393
|
-
label: "'('"
|
197
|
+
label: "'('"
|
394
|
-
|
395
|
-
color: blue
|
198
|
+
color: blue
|
396
|
-
|
397
|
-
textcolor: black
|
199
|
+
textcolor: black
|
398
|
-
|
399
|
-
}
|
200
|
+
}
|
400
|
-
|
401
|
-
backedge: {
|
201
|
+
backedge: {
|
402
|
-
|
403
|
-
sourcename: "8"
|
202
|
+
sourcename: "8"
|
404
|
-
|
405
203
|
targetname: "7"
|
406
|
-
|
407
204
|
label: "')'"
|
408
|
-
|
409
|
-
color: blue
|
205
|
+
color: blue
|
410
|
-
|
411
|
-
textcolor: black
|
206
|
+
textcolor: black
|
412
|
-
|
413
|
-
}
|
207
|
+
}
|
414
|
-
|
415
|
-
edge: {
|
208
|
+
edge: {
|
416
|
-
|
417
|
-
sourcename: "8"
|
209
|
+
sourcename: "8"
|
418
|
-
|
419
210
|
targetname: "8"
|
420
|
-
|
421
|
-
label: "S"
|
211
|
+
label: "S"
|
422
|
-
|
423
|
-
color: green
|
212
|
+
color: green
|
424
|
-
|
425
|
-
textcolor: black
|
213
|
+
textcolor: black
|
426
|
-
|
427
|
-
}
|
214
|
+
}
|
428
|
-
|
429
|
-
edge: {
|
215
|
+
edge: {
|
430
|
-
|
431
|
-
sourcename: "8"
|
216
|
+
sourcename: "8"
|
432
|
-
|
433
217
|
targetname: "13"
|
434
|
-
|
435
218
|
label: "L"
|
436
|
-
|
437
|
-
color: green
|
219
|
+
color: green
|
438
|
-
|
439
|
-
textcolor: black
|
220
|
+
textcolor: black
|
440
|
-
|
441
|
-
}
|
221
|
+
}
|
442
|
-
|
443
|
-
node: {
|
222
|
+
node: {
|
444
|
-
|
445
223
|
title: "9"
|
446
|
-
|
447
224
|
label: "state 9\n S -> '(' L ."
|
448
|
-
|
449
|
-
}
|
225
|
+
}
|
450
|
-
|
451
|
-
node: {
|
226
|
+
node: {
|
452
|
-
|
453
227
|
title: "10"
|
454
|
-
|
455
228
|
label: "state 10\n $accept -> lines $end ."
|
456
|
-
|
457
|
-
}
|
229
|
+
}
|
458
|
-
|
459
|
-
node: {
|
230
|
+
node: {
|
460
|
-
|
461
231
|
title: "11"
|
462
|
-
|
463
232
|
label: "state 11\n lines -> line lines ."
|
464
|
-
|
465
|
-
}
|
233
|
+
}
|
466
|
-
|
467
|
-
node: {
|
234
|
+
node: {
|
468
|
-
|
469
235
|
title: "12"
|
470
|
-
|
471
236
|
label: "state 12\n line -> S '\n' ."
|
472
|
-
|
473
|
-
}
|
237
|
+
}
|
474
|
-
|
475
|
-
node: {
|
238
|
+
node: {
|
476
|
-
|
477
239
|
title: "13"
|
478
|
-
|
479
240
|
label: "state 13\n L -> S L ."
|
480
|
-
|
481
|
-
}
|
241
|
+
}
|
482
|
-
|
483
|
-
|
484
|
-
|
485
242
|
|
486
243
|
|
487
244
|
}
|
488
|
-
|
489
245
|
```
|
490
246
|
|
491
|
-
|
492
|
-
|
493
247
|
### 補足情報(FW/ツールのバージョンなど)
|
494
|
-
|
495
248
|
環境はwindows10のwsl2で、bisonのバージョンは以下のとおりです。
|
496
|
-
|
497
249
|
```
|
498
|
-
|
499
250
|
bison (GNU Bison) 1.875
|
500
|
-
|
501
251
|
Written by Robert Corbett and Richard Stallman.
|
502
252
|
|
503
|
-
|
504
|
-
|
505
253
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
506
|
-
|
507
254
|
This is free software; see the source for copying conditions. There is NO
|
508
|
-
|
509
255
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
510
|
-
|
511
256
|
```
|
1
タグの追加
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|