Project

General

Profile

Parsing

Introduction

After the project is setup, the FWD "conversion front end" is run. This is the part of FWD that preprocesses and parses the application code and schemata. It does not run "conversion" to Java, it is just turning the source code and schemata into an Abstract Syntax Tree (AST) form suitable for using automated tools. The Code Analytics needs to process using these ASTs. The "front end" is can be interchangeably referred to as "parsing".

Parse the Code and Schemata

This section assumes you have used the sample project as a template. In that project, there is an Apache Ant build.xml that provides multiple build targets which include parsing.

As noted above, this is referred to as the "front end" because it was originally created as part of the automated conversion process. This front end is reused for the Code Analytics. In fact, the analytics tools must be run on freshly parsed ASTs, it cannot be run using the ASTs as they exist after the full conversion process. This is why it is important to have an isolated run of the front end before running the processing that calculates the report results and statistics.

When you are getting the application code parsed for the first time, it is best to just run the parsing by itself. This is because for larger applications, it is expected that there will be some issues to be resolved. Running the "front end" by itself will avoid other processing (the report calculations) which are useless if the project is not parsing properly. Make sure to review the output of the parsing run to see if there are any errors and resolve those errors before running the report calculation targets.

Before you try to parse, it is very important to carefully review the section on Avoiding Common Parsing Mistakes. Planning properly and carefully following the guidelines will save time.

The project template for build.xml includes two targets that allow running just the conversion front end:

Target Description
convert.front Execute the parse phase of the conversion process, using a pattern as input. This will use the specification mode (-s) of the ConversionDriver, by default passing the top level directory of ./abl/ (the app.4gl.src property in build.xml) and the pattern of *.[wp] (the app.4gl.pattern property in build.xml). When the prepare_template.sh or prepare_template.cmd is executed, it will query the user for the regular expression for program files and will store it in build.properties under the app.4gl.pattern name. This is defaulted by the script to *.[pPwW]. The pattern can be overridden on the ant command line using -Dapp.4gl.pattern="your_pattern".
convert.front.list Execute the parse phase of the conversion process, using the file named 'file-cvt-list.txt' (located in the project directory) as input. This will use the filename list in a text file mode (-f@_ of the @ConversionDriver. The list mode is important for any project that has program names that cannot easily be specified using a simple regular expression OR any project that must exclude some programs from processing while including other programs that match the same regular expression.

To run parsing by itself:

Linux Windows
cd ~/app_name
ant convert.front
c:
cd c:\app_name
ant convert.front

Change the target from convert.front to convert.front.list to use the -f (filename list in a text file) mode. Review the output of the parsing carefully.

To understand the full details on the process, see these chapters from the Conversion Handbook:

Running the Front End Conversion
Resolving Preprocessing Issues
Resolving Parsing Issues
Object Oriented Classes and References


© 2004-2021 Golden Code Development Corporation. ALL RIGHTS RESERVED.

Next: Calculating Report Results