Software Archive
Read-only legacy content
17060 Discussions

parser for code analysis

Intel_C_Intel
Employee
1,088 Views
I've found an extremely powerful tool for source code analysis and manipulation. One problem remains: it targets Java. The concept deserves attention, however: reading a Java program to create objects in main memory that represent the program's source code. Representing source code as objects means that e.g. a variable used in an expression can be traced back to its declaration by calling a method on its object-representation.

This object-rich representation opens the door for the smart user to write code that manipulates his programs. E.g. declaring as local a set of previously-COMMON arrays so as to allow running some subroutine in a multi-threaded way, where these now-local arrays to be passed down to inner-subroutines. This example shows a well-defined, but error-prone code manipulation if done by hand.

Now, the typical phrase : "Does anybody know ... " a similar tool for Fortran ? The following requirements seem fair enough :

The tool should be able to :
1) parse
2) build abstract syntax tree
3) resolve references (e.g. find matching declaration for a variable use, etc.). I think this is called "build the symbol table". Dunno for sure.
4) discard syntactic artifacts useless for the final user
5) instantiate an object representation of the work done so far, in C++ or Java.

Any hints ?
0 Kudos
1 Reply
Intel_C_Intel
Employee
1,088 Views
Has anyone experimented with source-to-source transformations of Fortran programs ?

E.g. by using the Nestor library

http://www.cri.ensmp.fr/~silber/nestor/
0 Kudos
Reply