Home

Description


        

swtop.gif (1189 bytes)
FAQ
Description
swbottom.gif (528 bytes)

 

 

 

 

 

Cocolsoft Delphi Grammar - Description

Introduction

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.

The grammar supports obsolete Delphi 1 features such as objects, and Inline code.

The grammar deals with assembly code by detecting and consuming assembly code. Although the grammar of assembly code is not recognised, assembly comments are recognised and also consumed. Compiler directives are also recognised in assembly code.

Object Pascal units are recognised. That is, code commencing 'UNIT'. The current version supports Object Pascal programs. That is, code commencing 'PROGRAM'. Also supported are LIBRARY and PACKAGE files.

The current version also supports Include files and DOF/OPT files.

Testing

 

Version or suite

directory

files '*.pas'

non unit

IFDEF

Success

PERCENTAGE

 

 

 

 

 

 

 

Delphi 4.03

 

 

 

 

 

 

 

Demos

242

 

ipcthrd

242

100

 

Help

17

regini

 

17

100

 

Objrepos

19

 

 

19

100

 

Ocx

7

 

 

7

100

 

Source\Rtl\Sys

10

delphimm

 

10

100

 

Source\Rtl\Win

35

 

Note 1, 2

32

100

 

Source\Samples

9

 

 

9

100

 

Source\Toolsapi

9

 

 

9

100

 

Source\Vcl

59

 

 

59

100

 

 

 

 

 

 

 

Delphi 1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Cbtsampl

1

 

 

1

100

 

Demos

93

 

Note 3

92

100

 

Gallery

12

crtapp

 

12

100

 

Lib

7

 

Note 3

6

100

 

Source\Rtl70

13

buildowl

objects;validate;windos;Note 3

12

100

 

Source\Samples

5

 

colorgrd;Note 3

4

100

 

 

 

 

 

 

 

RX Library 2.40

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Demo

48

 

10 units

48

100

 

Units

93

 

40 units;Note 4

92

100

Note - The column for IFDEF signifies that there is some form of conditional compilation.

Note 1 - The unit

mmsystem.pas omits an ";"

shlobj.pas omits an ";"

windows.pas there is a syntax error in code.

Note 2 - The unit Win\activex.pas has tab characters in its code.

Note 3 - The unit

Demos\Doc\Textedit\mdiframe.pas has a spurious character after "END."

Lib\olereg.pas has a spurious character after "END."

Samples\colorgrd.pas has a spurious character after "END."

Rtl\custcntl.pas has a spurious character after "END.".

Note 4 - The unit

RXresexp.pas needs the conditional directive '$DEFINE RX_D3' in source to work.

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)

http://www.cocolsoft.com.au

Email
Copyright © 1998-2009 Cocolsoft Computer Solutions. All Rights Reserved.

Back Home Up