[antlr-interest] Java Cross Referencing Tool (Alpha Release)

Matt Benson gudnabrsam at yahoo.com
Wed Jan 7 10:50:44 PST 2004


This sounds great, Jim... I'll be checking this out. 
What's the license?

-Matt


--- Jim O'Connor <Jim.OConnor at microfocus.com> wrote:
> To download the zip file, go to
>  
> http://www.antlr.org/share/list
> <http://www.antlr.org/share/list> 
>  
> Introduction
> This is the alpha release of the Java Cross
> Reference Tool (uses ANTLR
> 2.7.2).  It is based on Terence's tool in the file
> sharing section.  To
> review its roots you can take a look at
> www.antlr.org/share/list
> <http://www.antlr.org/share/list> .  There have been
> many improvements and
> additions.  The goal is to have another release in
> the future that improves
> the code and streamlines the "get up and running"
> process.  There might be a
> few bug fixes, as well. :0) 
>  
> Overview
> Input: *.java files, jar files, or a directory
> structure
>  
> Output:  An XML document with a hierarchical
> representation of packages,
> classes and references.  The MyOutput class
> regulates the output location of
> the XML file.  The name is controlled in the
> CodeProject class (currently
> "null").  MyOutput has methods to control output
> when references are
> resolved.
>  
> Installation and execution
>  
>  The process will be streamlined.  The manual
> installation forces the user
> to become familiar necessary configuration steps
> that could be overlooked.  
> Assumptions: Java JDK and Antlr 2.7.2 is installed. 
> An older java.g 1.3 is
> used.  Recent patches have not been integrated.
>  
> 1.	Download JavaCrossRef.zip 
>  
> 2.	Unzip to c:\  (this will create the c:\antlr.xref
> directory
> structure) 
>  
> 3.	cd to the
> c:\antlr.xref\src\org\antlr\java\crossref
> subdirectory 
>  
> 4.	To generate the necessary files run the following
> commands (My path
> includes "c:\j2sdk1.4.2_01\bin"; and my full
> classpath is
> ".;c:\antlr-2.7.2\antlr.jar") 
> A.      java antlr.Tool java.g
> a.       Creates JavaRecognizer.java,
> JavaLexer.java, JavaTokenTypes.java
> and JavaTokenTypes.txt
> B.      java antlr.Tool javatree.g
> a.       Creates JavaTreeParser.java,
> JavaTreeParserTokenTypes.java and
> JavaTreeParserTokenTypes.txt
> C.      java antlr.Tool -glib javaTree.g defs.g 
> a.       Creates JavaDefsTreeParser.java,
> JavaTreeDefsParserTokenTypes.java
> and JavaTreeDefsParserTokenTypes.txt
> b.       Warnings will result for rule
> JavaDefsTreeParser.packageDefinition
> and Rule 'identifier' returning a value
> D.      java antlr.Tool -glib javaTree.g prerefs.g
> a.       Creates JavaPreRefsTreeParser.java,
> JavaTreePreRefsParserTokenTypes.java and
> JavaTreePreRefsParserTokenTypes.txt
> b.       Warnings result for packageDefinition,
> typeSpec, typeSpecArray,
> type, extendsClasue, implementsClause, parameterDef,
> variableDeclarator,
> methodHead, identifier, newExpression and
>
'identifier'-'parameterDef'-'typeSpecArray'-'typeSpec'-newExpression'
> returns a value
> E.      java antlr.Tool -glib javaTree.g refs.g
> a.       Creates JavaRefsTreeParser.java,
> JavaTreeRefsParserTokenTypes.java
> and JavaTreeRefsParserTokenTypes.txt
> b.       Lots more warning messages
>  
> 5.	Before compiling the files you should edit a few
> of the files to
> control the output 
> A.      In CodeProject.java, a few fields are "user
> configurable" and can be
> modified
> a.       protected String name = null; null can be
> changed to name the
> current project.  Otherwise the xml file will get
> the name "null.xml".
> b.       static final boolean saveReferences = true;
>  when set to "true" all
> references are saved to the CodeProject hierarchical
> information model by
> methods in the refElement(), refMethod(), and
> refClass() methods. If you
> only want your project structure in the XML file,
> set to "false".
> c.       static final boolean printDebug = false; 
> There is a large amount
> of debug "System.out.println()" calls in the Scope
> classes.  The printDebug
> flag in CodeProject is a global flag to enable or
> disable the possibility
> for all of these messages.  When printDebug is set
> to true in the
> CodeProject class, you must go to the individual
> class files to turn on
> messages. Other classes with the printDebug flag are
> ClassScope,
> CodeBlockScope, DebugStack (commented out in defs.g,
> prerefs.g, and refs.g),
> FileScope, and ParameterScope.
> B.      In MyOutput.java, final static String
> OUTPUTDIR = "./"; set the
> output directory (OUTPUTDIR), or leave as the
> current directory (".\")
>  
> 6.	Compile the *.java files with the following
> commands 
> 7.	A. javac *.java (or whatever compiler you use) 
> 8.	test run 
> A.      cd c:\antlr.xref\src
> B.      "java org.antlr.java.crossref.Main" should
> produce usage message
> "Usage: Main (directory or filename)"
> C.       
> 9.	Another test with real data 
> A.      "java org.antlr.java.crossref.Main
> org\antlr\java\crossref\location.java"
> B.      This will produce many messages to the
> console in addition to a 70k
> xml file to the current directory named "null.xml"
> C.      I'll go back and set saveReference = false
> and recompile and re-run.
> D.      I still get all the messages but the xml
> file is now 9k, but it
> contains no reference information.  It just contains
> the
> package/class/field/method structure.  This is good
> for structure analysis
> but not for seeing which classes reference others.
>  
>  
> Credits
>  
> All "borrowed" classes are from the open source
> community.  I have no
> obligation to give credit to these sources. 
> However, their mention will
> give credit where I think it is due.  
>  
> K files
>  
> The "K" files are used to read the input stream from
> a "*.class" file,
> extracting the relevant information.  They are used
> with minor modification,
> mostly to the javadoc section.  These files are the
> work of Kimberley
> Burchett. "Class loading" the files was a short bad
> idea.  Thanks for saving
> me some time, Kimberly!  I kept the class file
> writer with the code for
> those of you who want to do some obfuscation work.
>  
> http://www.kimbly.com/code/classfile/
> <http://www.kimbly.com/code/classfile/> 
>  
> Location AST help
>  
> I read the antlraux site to help with the
> LocationAST work.
>  
> http://antlraux.sourceforge.net/
> <http://antlraux.sourceforge.net/> 
>  
> Java Cross Reference Tool
>  
> Antlr and the structure for the tool are based on
> the work of Terence Parr.
> You should be versed in Antlr basics to use this
> tool. (www.antlr.org
> <http://www.antlr.org/> )
>  
> To Do List
> 1. Reduce size of XML document
> 2. Revisit order of imports and "Classpath order".
> 3. Upgrade java.g
> 4. Streamline installation
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list