File: graph.elpi

package info (click to toggle)
coq-hierarchy-builder 1.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,988 kB
  • sloc: makefile: 109
file content (30 lines) | stat: -rw-r--r-- 954 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*        Hierarchy Builder: algebraic hierarchies made easy
    This software is released under the terms of the MIT license              */

namespace graph {

pred to-file i:string.
to-file File :- !, std.do! [
  open_out File OC,
  output OC "digraph Hierarchy { ",
  std.forall {coq.coercion.db} (private.pp-coercion-dot OC),
  output OC "}",
  close_out OC,
].

/* ------------------------------------------------------------------------- */
/* ----------------------------- private code ------------------------------ */
/* ------------------------------------------------------------------------- */

namespace private {

pred pp-coercion-dot i:out_stream, i:coercion. 
pp-coercion-dot OC (coercion _ _ Src (grefclass Tgt)) :- class-def (class Src _ _), class-def (class Tgt _ _), !, std.do! [
  output OC {gref->modname_short Tgt "_"},
  output OC " -> ",
  output OC {gref->modname_short Src "_"},
  output OC ";\n",
].
pp-coercion-dot _ _.

}}