-
Notifications
You must be signed in to change notification settings - Fork 1
Parsing
This page details the characteristics of the lowest layer of the stack: parsing the target source code.
Note on naming: The program we want to inspect (whose execution we want to visualize) will be called: target program. We will also use the term target code or target source to refer to the target program;s source code.
The parsing is necessary in order to instrument the target code. What do we mean by that? The idea is to augment the source code with calls to the CodeAlive Rendering API which would be responsible for sending event messages to the Renderer process which would then process them for visualization. Consider this very basic example:
class C2 {
public int Method1(string p1) {
// ...
}
}
class C1 {
private C2 c2; // Initialized at construction time (not shown here)
public void Method1() {
var r = this.c2.Method1("Hello world!");
}
}
Let's focus on C1.Method1
. That method is calling a method of C2
. This will be seen, from a rendering point of view, as an interaction between the two cells representing the instances of class C1
and class C2
. So right after that call, the code must tell the renderer such an interaction took place. So the parser will add a call to the renderer API like:
class C1 {
public void Method1() {
var r = this.c2.Method1("Hello world!");
// Renderer API - Interaction
CodeAlive.Renderer.Event(CodeAlive.Renderer.Events.Interaction, "C2", "C1", "Hello world!", r.ToString());
}
}
The above example is not the shape of the actual API, just an example. The API would be responsible for sending an HTTP message to the renderer in order to tell it that an interaction from C2
to C1
took place and that they did exchange something (a string was sent and an integer was returned).
Project code-alive - 2018