Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] generating a call-graph
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] generating a call-graph
Xavier Leroy wrote:

>>Does anyone know a way of generating a call-graph from a set of ocaml
>>sources?  What I want to do is, at a minimum, get a list of all the
>>functions that could be called as a result of a given function invocation.
>>
> 
> This requires a non-trivial static analysis called "control flow
> analysis" in the literature; particular instances include Shivers'
> 0-CFA and k-CFA, Jagannathan and Wright's "polymorphic splitting",
> etc.
> 
> The difficulty is that functions are first-class values

.. and the difficulty can be bypassed by considering
the actual industrial requirement, which probably
isn't as stated above.

We often want to know what the definition
of a function depends on, and that clearly *excludes*
any functions passed in as parameters.

Second, an incomplete graph would still be very useful.
For example to determine if you can move a function
definition earlier in the code, so as to call it from
some other function -- or whether you would have to move
a lot more functions back -- and if so which ones --
and, indeed, if it is possible at all (without recursion).

I guess a patch to the parser could gather the required
information easily ( the main difficulty being
the huge number of anonymous functions that tend to
float around when one does currying).

-- 
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners