Cocolsoft Delphi Grammar - Description
The Cocolsoft Delphi Grammar has been designed to work with program code written in Object Pascal for the Delphi compiler sold by Inprise Corporation.
The main objective has been to work with the most recent version of Delphi. The language Object Pascal has been designed to be upwardly compatible with previous releases so this means that in theory a grammar for the latest release should also work with the earliest release.
Another objective has been to test the Cocolsoft Delphi Grammar with as wide a range of sample programs as possible. To this end we looked at compliance testing by other grammars. For example, the practise of testing an Oberon-2 parser was noted. (Reference 1)
In that case the author was in the good position of drawing on Oberon-2 code in books by the language designer.
In the present case, we drew on the official code provided with Delphi 4. This formed our first benchmark.
Whereas the Oberon-2 case study was tested against "about 92 programs, containing a cumulative 23,000 lines of Oberon code (including whitespace and comments)" we were fortunate in having a larger code base to draw on.
However, due to the complexity of Object Pascal from a compiler writers viewpoint, it is probably desirable for a large code base to be used. So, our first benchmark was against the official Delphi version 4.02 (release of late 1998) consisiting of about 400 programs containing a cumulative one million lines of code (including whitespace and comments). Our benchmark has been redone against the Delphi version 4.03.
Our second benchmark was against the official Delphi version 1 (release of 1995).
Our third benchmark was against a popular third party library designed for different Delphi versions. We chose RX Library (version 2.40 dated 11Feb1998 for Delphi 1, 2 and 3).
The grammar was tested against Delphi 5 Beta source code. The results are similar to that of Delphi 4.03.
The grammr was tested against Delphi 6.03 with Service Pack 2 source code. Some new grammar constructs have been added to the language with this release of Delphi. The grammar does not detect those. Otherwise the results are similar to that of Delphi 4.03.
The grammar supports most features of Object Pascal.
Note 1 - The unit
Note 2 - The unit Win\activex.pas has tab characters in its code.
Note 3 - The unit
Note 4 - The unit
Reference 1 - 'A JavaCC Parser for the Oberon-2 Programming Language' by James Power, Department of Computer Science, National University of Ireland. 17Nov1998.
Delphi is a trademark of Borland (now Inprise Corporation). Other product and company names mentioned herein may be the trademarks of their respective owners.
(Copyright (C) 1999 - 2003 Cocolsoft Computer Solutions. All Rights Reserved.)
(This page updated 28 Jan 2003)