cfpq_data.grammars.generators.java_points_to_grammar_from_graph#

java_points_to_grammar_from_graph(graph: MultiDiGraph, *, start_symbol: Variable = Variable(S)) → CFG[source]#

Returns a Java Points-to grammar that generates a language for the field-sensitive analysis of Java programs [1] with fields corresponding to the load and store edge labels of the given graph.

Parameters:
graph: nx.MultiDiGraph

The graph to be analyzed using the grammar.

start_symbolVariable

Start symbol of the grammar.

Returns:
cfgCFG

Java Points-to context-free grammar.

References

Examples

>>> from cfpq_data import *
>>> import networkx as nx
>>> g = nx.MultiDiGraph()
>>> _ = g.add_edges_from(
...     [(0, 1, {"label": "load_f1"}), (1, 2, {"label": "store_f1"}),
...      (2, 3, {"label": "load_f2"}), (3, 4, {"label": "store_f2"})]
... )
>>> cfg = java_points_to_grammar_from_graph(g)
>>> len(cfg.productions)
11