Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit 950edd9

Browse files
Initial prototype.
This commit introduces a new library, copilot-visualizer, that produces a tikz diagram from a Copilot spec. The library leverages the interpreter, so externs must contain enough samples for the visualization to take place. Co-authored-by: Frank Dedden <frank@systemf.dev>
1 parent 88a045a commit 950edd9

File tree

10 files changed

+1514
-0
lines changed

10 files changed

+1514
-0
lines changed

CHANGELOG

Whitespace-only changes.

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2009
2+
BSD3 License terms
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions
6+
are met:
7+
8+
Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
Redistributions in binary form must reproduce the above copyright
12+
notice, this list of conditions and the following disclaimer in the
13+
documentation and/or other materials provided with the distribution.
14+
15+
Neither the name of the developers nor the names of its contributors
16+
may be used to endorse or promote products derived from this software
17+
without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[![Build Status](https://travis-ci.com/Copilot-Language/copilot.svg?branch=master)](https://app.travis-ci.com/github/Copilot-Language/copilot)
2+
3+
# Copilot: a stream DSL
4+
5+
The visualizer, which draws Copilot specifications using different graphical
6+
formats.
7+
8+
Copilot is a runtime verification framework written in Haskell. It allows the
9+
user to write programs in a simple but powerful way using a stream-based
10+
approach.
11+
12+
Programs can be interpreted for testing (with the library copilot-interpreter),
13+
or translated C99 code to be incorporated in a project, or as a standalone
14+
application. The C99 backend ensures us that the output is constant in memory
15+
and time, making it suitable for systems with hard realtime requirements.
16+
17+
## Installation
18+
19+
Copilot-visualizer can be found on
20+
[Hackage](https://hackage.haskell.org/package/copilot-interpreter). It is
21+
typically only installed as part of the complete Copilot distribution. For
22+
installation instructions, please refer to the [Copilot
23+
website](https://copilot-language.github.io).
24+
25+
## Further information
26+
27+
For further information, install instructions and documentation, please visit
28+
the Copilot website:
29+
[https://copilot-language.github.io](https://copilot-language.github.io)
30+
31+
## License
32+
33+
Copilot is distributed under the BSD-3-Clause license, which can be found
34+
[here](https://raw.githubusercontent.com/Copilot-Language/copilot/master/copilot-interpreter/LICENSE).

Setup.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain

copilot-visualizer.cabal

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
cabal-version: >=1.10
2+
name: copilot-visualizer
3+
version: 4.2
4+
synopsis: Visualizer for Copilot.
5+
description:
6+
Visualizer for Copilot.
7+
.
8+
Copilot is a stream (i.e., infinite lists) domain-specific language (DSL) in
9+
Haskell that compiles into embedded C. Copilot contains an interpreter,
10+
multiple back-end compilers, and other verification tools.
11+
.
12+
A tutorial, examples, and other information are available at
13+
<https://copilot-language.github.io>.
14+
15+
author: Ivan Perez, Frank Dedden
16+
license: BSD3
17+
license-file: LICENSE
18+
maintainer: Ivan Perez <ivan.perezdominguez@nasa.gov>
19+
homepage: https://copilot-language.github.io
20+
bug-reports: https://github.com/Copilot-Language/copilot/issues
21+
stability: Experimental
22+
category: Language, Embedded
23+
build-type: Simple
24+
extra-source-files: README.md, CHANGELOG
25+
data-files: data/tikz.latex
26+
data/timeline.html
27+
28+
x-curation: uncurated
29+
30+
source-repository head
31+
type: git
32+
location: https://github.com/Copilot-Language/copilot.git
33+
subdir: copilot-visualizer
34+
35+
executable copilot-live-backend
36+
default-language: Haskell2010
37+
38+
main-is: Copilot/Live.hs
39+
40+
hs-source-dirs: src
41+
42+
ghc-options:
43+
-Wall
44+
45+
build-depends:
46+
base >= 4.9 && < 5,
47+
aeson,
48+
directory,
49+
filepath,
50+
hint,
51+
pretty >= 1.0 && < 1.2,
52+
ogma-extra >= 1.6.0 && < 1.7,
53+
54+
copilot-core >= 4.2 && < 4.3,
55+
copilot-interpreter >= 4.2 && < 4.3,
56+
copilot-visualizer >= 4.2 && < 4.3,
57+
copilot-language,
58+
copilot,
59+
text,
60+
websockets >= 0.12.7
61+
62+
other-modules:
63+
64+
Paths_copilot_visualizer
65+
66+
library
67+
68+
default-language: Haskell2010
69+
70+
hs-source-dirs: src
71+
72+
ghc-options:
73+
-Wall
74+
75+
build-depends:
76+
base >= 4.9 && < 5,
77+
aeson,
78+
directory,
79+
filepath,
80+
pretty >= 1.0 && < 1.2,
81+
ogma-extra >= 1.6.0 && < 1.7,
82+
83+
copilot-core >= 4.2 && < 4.3,
84+
copilot-interpreter >= 4.2 && < 4.3
85+
86+
exposed-modules:
87+
88+
Copilot.Visualize
89+
90+
other-modules:
91+
92+
Paths_copilot_visualizer

data/tikz.latex

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{{=<% %>=}}
2+
\documentclass{standalone}
3+
\usepackage{tikz}
4+
\usepackage{tikz-timing}
5+
\usepackage{xcolor}
6+
\definecolor{false}{HTML}{ECD9ED}
7+
\definecolor{true}{HTML}{D9ECED}
8+
\begin{document}
9+
\newcommand{\true}{T}
10+
\newcommand{\false}{F}
11+
\tikzset{
12+
every picture/.style={
13+
execute at end picture={
14+
\path (current bounding box.south west) +(-1,-1) (current bounding box.north east) +(1,1);
15+
}
16+
}
17+
}
18+
19+
\tikzset{
20+
timing/.style={x=5ex,y=2ex},
21+
timing/rowdist=4ex,
22+
timing/dslope=0.1,
23+
x=5ex,
24+
timing/coldist=1ex,
25+
timing/name/.style={font=\sffamily\scriptsize},
26+
timing/d/text/.style={font=\sffamily\tiny},
27+
}
28+
\begin{tikztimingtable}
29+
<%#adTraceElems%>
30+
<%teName%> & g<%#teValues%><%#tvIsEmpty%>S<%/tvIsEmpty%><%^tvIsEmpty%><%#teIsBoolean%>[fill=<%tvValue%>]D{\<%tvValue%>}<%/teIsBoolean%><%^teIsBoolean%>D{<%tvValue%>}<%/teIsBoolean%><%/tvIsEmpty%><%/teValues%>\\
31+
<%/adTraceElems%>
32+
\extracode
33+
\begin{background}[shift={(0.05,0)},help lines]
34+
\vertlines[help lines,opacity=0.3]{-0.3ex,...,<%adLastSample%>}
35+
\end{background}
36+
\end{tikztimingtable}
37+
\end{document}

0 commit comments

Comments
 (0)