Why JavaParsing is used:
The ZBNF-script for Java-parsing is developed at first for Java2C. Than it is used for ../../examples_XML/Java2XMI/readme.html to show Java projects with UML. See ModelBasedSwDevelopment. The possibility to convert any Java source code to XML may be able to use for some other applications, at example to get a list of classes or methods, for cross referencing etc. You can use all XML-utilities to evaluate the content of Java-sources. Another possibility is evaluating the parse result with a Java program. It maybe much more effective, because Lists can be used for sorting etc. The here shown parsing may be a base for all evaluations of Java source code.
This example is proper only for a simple test of the parser and the Java syntax.
The syntax of Java:
It is contained in the file
zbnfjax/zbnf/Java2C.zbnf. The syntax is checked with many Javafiles in practice, but it may be considered not all variants yet. The Java syntax is
more lucid as the syntax of C/C++-Headerfiles, but it is complexly too.
The example contains:
del_results.bat testJavaParsing.bat Simple.java TestAll.java Simple.java.reference.xml TestAll.java.reference.xml
del_results.bat: helper to clean.
testJavaParsing.bat: Windows-batch file to call both parsings using ZBNF2XML.
Simple.Java: A simple Java file. It should help to show the principles.
TestAll.java: A complexly Java file which contains all constructs of java-code to test the syntax. The result of parsing should be compared
TestAll.java.reference.xml after any changes of syntax in
Java2C.zbnf. If the syntax is improved, all results with the same inputs should be presented with the same result, because the result
may be processed further in this form. But new syntax contstructs may be recognized.
*.java.reference.xml: The results of the parsing process to compare: Test results with changed conditions should be compared with it.
testJavaParsing.bat is invoked, the following files should be created:
Simple.java.xml TestAll.java.xml Simple.java2XML.rpt TestAll.java2XML.rpt