Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #1

Merged
merged 11 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Use `rebar3` to run the program from the command line or to compile it.
# ./_build/default/bin/chorer ./path/to/your/program.erl main
```

otherwise
or

```erlang
# rebar3 shell
Expand All @@ -25,9 +25,9 @@ finished

### Output

The tool will create a DOT file for each actor's local view and a DOT file for the global view in the specified folder. To visualize the Choreography Automatas, copy paste the content's files in a [DOT viewer](https://dreampuf.github.io/GraphvizOnline).
The tool will create a DOT file for each actor's local view and a DOT file for the global view in the specified folder. To visualize the Choreography Automatas copy and paste the `.dot` files' content in a [DOT viewer](https://dreampuf.github.io/GraphvizOnline).

## Credits

This project was made for the Bachelor's degree Thesis of the Computer Science course at Alma Mater Studiorum - University of Bologna.
I am grateful to the professor [Ivan Lanese](https://github.com/lanese), who supervised the development of this project.
I am grateful to the professor [Ivan Lanese](http://www.cs.unibo.it/~lanese/), who supervised the development of this project.
145 changes: 145 additions & 0 deletions doc/actor_emul.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Module actor_emul</title>
<link rel="stylesheet" type="text/css" href="edoc-extensions.css" title="EDoc">
</head>
<body class="markdown-body language-erlang"><script src="prism.js"></script>
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>

<h1>Module actor_emul</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>
This module simulate an actor's localview during a globalview.


<h2><a name="description">Description</a></h2>
This module simulate an actor's localview during a globalview.
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#add_proc_localvars-2">add_proc_localvars/2</a></td><td>
Add a variable to the local variables of the localview.</td></tr>
<tr><td valign="top"><a href="#add_proc_mess_queue-2">add_proc_mess_queue/2</a></td><td>
Add a message to the message queue of the process.</td></tr>
<tr><td valign="top"><a href="#add_proc_spawnvars-2">add_proc_spawnvars/2</a></td><td>
Add a variable to the spawn arguments of the localview.</td></tr>
<tr><td valign="top"><a href="#del_proc_mess_queue-2">del_proc_mess_queue/2</a></td><td>
Delete a message from the message queue of the process.</td></tr>
<tr><td valign="top"><a href="#get_proc_data-1">get_proc_data/1</a></td><td>
Get the all the data of the process.</td></tr>
<tr><td valign="top"><a href="#get_proc_edge_info-2">get_proc_edge_info/2</a></td><td>
Get the informations of a localview's edge.</td></tr>
<tr><td valign="top"><a href="#get_proc_edges-1">get_proc_edges/1</a></td><td>
Get all the localview's current edges.</td></tr>
<tr><td valign="top"><a href="#get_proc_localvars-1">get_proc_localvars/1</a></td><td>
Get the list of the local variables.</td></tr>
<tr><td valign="top"><a href="#get_proc_mess_queue-1">get_proc_mess_queue/1</a></td><td>
Get the message queue of the process.</td></tr>
<tr><td valign="top"><a href="#get_proc_out_degree-1">get_proc_out_degree/1</a></td><td>
Get all the number of the localview's current edges.</td></tr>
<tr><td valign="top"><a href="#proc_loop-1">proc_loop/1</a></td><td>
Loop function to simulate a process.</td></tr>
<tr><td valign="top"><a href="#set_proc_data-2">set_proc_data/2</a></td><td>
Set the all the data of the process.</td></tr>
<tr><td valign="top"><a href="#use_proc_transition-2">use_proc_transition/2</a></td><td>
Use a transition of the localview.</td></tr>
</table>

<h2><a name="functions">Function Details</a></h2>

<h3 class="function"><a name="add_proc_localvars-2">add_proc_localvars/2</a></h3>
<div class="spec">
<p><code>add_proc_localvars(P, V) -&gt; any()</code></p>
<p></p>
</div><p>
Add a variable to the local variables of the localview.</p>

<h3 class="function"><a name="add_proc_mess_queue-2">add_proc_mess_queue/2</a></h3>
<div class="spec">
<p><code>add_proc_mess_queue(P, M) -&gt; any()</code></p>
<p></p>
</div><p>
Add a message to the message queue of the process.</p>

<h3 class="function"><a name="add_proc_spawnvars-2">add_proc_spawnvars/2</a></h3>
<div class="spec">
<p><code>add_proc_spawnvars(P, V) -&gt; any()</code></p>
<p></p>
</div><p>
Add a variable to the spawn arguments of the localview.</p>

<h3 class="function"><a name="del_proc_mess_queue-2">del_proc_mess_queue/2</a></h3>
<div class="spec">
<p><code>del_proc_mess_queue(P, M) -&gt; any()</code></p>
<p></p>
</div><p>
Delete a message from the message queue of the process.</p>

<h3 class="function"><a name="get_proc_data-1">get_proc_data/1</a></h3>
<div class="spec">
<p><code>get_proc_data(P) -&gt; any()</code></p>
<p></p>
</div><p>
Get the all the data of the process.</p>

<h3 class="function"><a name="get_proc_edge_info-2">get_proc_edge_info/2</a></h3>
<div class="spec">
<p><code>get_proc_edge_info(P, E) -&gt; any()</code></p>
<p></p>
</div><p>
Get the informations of a localview's edge.</p>

<h3 class="function"><a name="get_proc_edges-1">get_proc_edges/1</a></h3>
<div class="spec">
<p><code>get_proc_edges(P) -&gt; any()</code></p>
<p></p>
</div><p>
Get all the localview's current edges.</p>

<h3 class="function"><a name="get_proc_localvars-1">get_proc_localvars/1</a></h3>
<div class="spec">
<p><code>get_proc_localvars(P) -&gt; any()</code></p>
<p></p>
</div><p>
Get the list of the local variables.</p>

<h3 class="function"><a name="get_proc_mess_queue-1">get_proc_mess_queue/1</a></h3>
<div class="spec">
<p><code>get_proc_mess_queue(P) -&gt; any()</code></p>
<p></p>
</div><p>
Get the message queue of the process.</p>

<h3 class="function"><a name="get_proc_out_degree-1">get_proc_out_degree/1</a></h3>
<div class="spec">
<p><code>get_proc_out_degree(P) -&gt; any()</code></p>
<p></p>
</div><p>
Get all the number of the localview's current edges.</p>

<h3 class="function"><a name="proc_loop-1">proc_loop/1</a></h3>
<div class="spec">
<p><code>proc_loop(Data) -&gt; any()</code></p>
<p></p>
</div><p>
Loop function to simulate a process.</p>

<h3 class="function"><a name="set_proc_data-2">set_proc_data/2</a></h3>
<div class="spec">
<p><code>set_proc_data(P, Data) -&gt; any()</code></p>
<p></p>
</div><p>
Set the all the data of the process.</p>

<h3 class="function"><a name="use_proc_transition-2">use_proc_transition/2</a></h3>
<div class="spec">
<p><code>use_proc_transition(P, E) -&gt; any()</code></p>
<p></p>
</div><p>
Use a transition of the localview.</p>
<hr>

<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc</i></p>
</body>
</html>
32 changes: 32 additions & 0 deletions doc/assets/codebeam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Title
Chorer: a static analyser to generate Choreography Automata

## Abstract
One of the main features of Erlang is that it enables easy communication between processes.
Choreographies are a mathematical model to describe the message-passing communications among
two or more processes. Choreography Automata are a way to graphically present a Choreography
as a finite state automaton. This representation can be used both for program understanding
and to support automatic analysis of behavioral properties, such as deadlock freedom. This
talk will present Chorer, a static analysis prototype which takes as input an Erlang source
code and ganerates a Choreography Automaton which is an over-approximation of all its possible
interactions. The talk will focus on how Chorer works, how to interpret its output, and the
basic ideas underlying its construction.

## Talk objective: What will the audience learn from your talk?
The audience will learn what are choreographies and how Chorer allows one to exploit them for
understanding and analysis of Erlang program.

## Target audience: Who would this talk appeal to?
Erlang programmers

### Which three words would best sum up your talk?
choreographies, static-analysis, concurrency


### Speaker tagline
Master student in Computer Science at University of Bologna

### Speaker biography
I'm a Master student in Computer science at Alma Mater Studiorum - University of Bologna.
I gradueted with a thesis focused on choreographies for Erlang, supervised by Prof. Ivan Lanese.
Into languages and distributed systems.
File renamed without changes.
File renamed without changes.
59 changes: 59 additions & 0 deletions doc/chorer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Module chorer</title>
<link rel="stylesheet" type="text/css" href="edoc-extensions.css" title="EDoc">
</head>
<body class="markdown-body language-erlang"><script src="prism.js"></script>
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>

<h1>Module chorer</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>
The main module of the program.


<h2><a name="description">Description</a></h2>
The main module of the program.
It initialize the ets tables and generetes the localviews and the globalview.
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#generate-2">generate/2</a></td><td>
Generate the localviews and the globalview with base settings.</td></tr>
<tr><td valign="top"><a href="#generate-3">generate/3</a></td><td>
Generate the localviews and the globalview specifing the output directory.</td></tr>
<tr><td valign="top"><a href="#main-1">main/1</a></td><td>
Function called when the tool is used from the CLI (Command Line Interface).</td></tr>
</table>

<h2><a name="functions">Function Details</a></h2>

<h3 class="function"><a name="generate-2">generate/2</a></h3>
<div class="spec">
<p><code>generate(InputFile, EntryPoint) -&gt; atom()</code>
<ul class="definitions"><li><code>InputFile = string()</code></li><li><code>EntryPoint = atom()</code></li></ul></p>
<p></p>
</div><p>
Generate the localviews and the globalview with base settings.</p>

<h3 class="function"><a name="generate-3">generate/3</a></h3>
<div class="spec">
<p><code>generate(InputFile, EntryPoint, OutDir) -&gt; atom()</code>
<ul class="definitions"><li><code>InputFile = string()</code></li><li><code>EntryPoint = atom()</code></li><li><code>OutDir = string()</code></li></ul></p>
<p></p>
</div><p>
Generate the localviews and the globalview specifing the output directory.
It initialize the ets tables and generates the localviews and globalview.</p>

<h3 class="function"><a name="main-1">main/1</a></h3>
<div class="spec">
<p><code>main(Args) -&gt; any()</code></p>
<p></p>
</div><p>
Function called when the tool is used from the CLI (Command Line Interface).</p>
<hr>

<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc</i></p>
</body>
</html>
47 changes: 47 additions & 0 deletions doc/digraph_to_dot.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Module digraph_to_dot</title>
<link rel="stylesheet" type="text/css" href="edoc-extensions.css" title="EDoc">
</head>
<body class="markdown-body language-erlang"><script src="prism.js"></script>
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>

<h1>Module digraph_to_dot</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>
Module based from
<a href="https://github.com/jkrukoff/digraph_export/blob/master/src/digraph_export_dot.erl">jkrukoff</a>.


<h2><a name="description">Description</a></h2><p>
Module based from
<a href="https://github.com/jkrukoff/digraph_export/blob/master/src/digraph_export_dot.erl">jkrukoff</a>.</p>

Features added:
<ul>
<li>distinctions between initial and final states</li>
<li>changed orientation of graphs from left to right</li>
<li>enanched format</li>
</ul>
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#convert-2">convert/2</a></td><td>
Convert a graph to a dot graph.</td></tr>
</table>

<h2><a name="functions">Function Details</a></h2>

<h3 class="function"><a name="convert-2">convert/2</a></h3>
<div class="spec">
<p><code>convert(Graph, Name) -&gt; Serialized</code>
<ul class="definitions"><li><code>Graph = <a href="/home/geno/Desktop/stdlib/doc/digraph.html#type-graph">digraph:graph()</a></code></li><li><code>Name = <a href="/home/geno/Desktop/stdlib/doc/unicode.html#type-charlist">unicode:charlist()</a></code></li><li><code>Serialized = <a href="/home/geno/Desktop/stdlib/doc/unicode.html#type-charlist">unicode:charlist()</a></code></li></ul></p>
<p></p>
</div><p>
Convert a graph to a dot graph.</p>
<hr>

<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc</i></p>
</body>
</html>
65 changes: 65 additions & 0 deletions doc/edoc-extensions.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
@import url("github-markdown.css");
@import url("prism.css");

body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
@media (max-width: 767px) {
body {
padding: 15px;
}
}
/* Don't apply the table style to the top-level navigation bar. */
.navbar table {
display: table;
width: 100%;
}
.navbar table tr,
.navbar table th,
.navbar table td {
border: 0;
}
/* Keep the same font side inside code blocks than everywhere else. */
.markdown-body pre code,
code[class*="language-"] {
font-size: 85%;
}
/* Force the color for link on code blocks used for @see tags. */
.markdown-body a code,
.markdown-body a code span.token {
color: var(--color-accent-fg);
}
/* Copy the style of code blocks. */
.markdown-body .spec {
background: #f5f2f0;
padding: 1em;
margin: .5em 0;
overflow: auto;
border-radius: 6px;
}
/* Improve margins inside function spec blocks so that:
- empty paragraphs don't add useless margins
- the final top and bottom margins are equal */
.markdown-body .spec p,
.markdown-body .spec ul {
margin-top: 16px;
margin-bottom: 0;
}
.markdown-body .spec p:first-child,
.markdown-body .spec p:empty {
margin-top: 0;
}
/* Put the function prototype in bold characters. */
.markdown-body .spec > p > code:first-child {
font-weight: bold;
}
/* Add some margin below the module short description between the table
of contents in the Description section. This text isn't in a
<p></p>. */
.index + p {
margin-top: 16px;
}
3 changes: 3 additions & 0 deletions doc/edoc-info
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
%% encoding: UTF-8
{application,chorer}.
{modules,[actor_emul,chorer,digraph_to_dot,eval,fsa,gv,lv,md,share]}.
Binary file added doc/erlang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading