Hi Andrew,
In Boa all nodes are either statements or expressions. Variable declarations are marked with expression kind VARDECL and variable accesses are marked with expression kind VARACCESS. By tokens, do you mean literals? If so, there are also marked with expression kind LITERAL.
Once you have the variables and literals, you can simply construct and output a sequence (per project, per class, per method, etc). You may have to post process it to prepare a context of tokens before and after each variable. Something like this.
sequence := "";
visit(input, visitor{
before expr: Expression -> {
if (expr.kind == ExpressionKind.VARDECL) {
// extract the declared variable from the LHS of the expression
seq = format("%s,DEF_%s", seq, declVar);
} else if (expr.kind == ExpressionKind.VARACCESS) {
// extract the used variable
seq = format("%s,USE_%s", seq, usedVar);
} else if (expr.kind == ExpressionKind.LITERAL) {
// store the literal in either a collection or an aggregator
seq = format("%s,%s", seq, token);
}
}
});
Boa can support several GB output.
Hope this is useful.
Thanks
Ganesh