Home

FAQ


        

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

 

 

 

 

 

Cocolsoft Delphi Grammar - FAQ

What version of Delphi does the grammar support?

The Cocolsoft Delphi Grammar works with Delphi version 4.03 and each preceeding Delphi major version. That is, Delphi 1, Delphi 2 and Delphi 3.

This means that the grammar parses those language constructs.

This is quite different from what version of Delphi can be used to compile the grammar so that it is "embedded" in your program. This has been successfully done with Delphi versions up to and including Delphi 6.03 with Service Pack 2.

Please see our separate paper for a detailed description.

What is the grammar written in?

The grammar is written in a form of EBNF (Extended Backus-Naur Form) commonly taught in Computer Science classes and expanded upon in many textbooks. The EBNF used is called Cocol (Compiler Compiler Language).

How do I obtain the grammar?

The Cocolsoft Delphi Grammar is one of the grammars in the latest release of Cogencee.

How can I see what the grammar does?

Download 'GramTst.zip' from Cocolsoft's site. This compressed file has an executable which can be run to see the Cocolsoft Delphi Grammar in operation.

What was the Cocolsoft Delphi Grammar tested against?

The Cocolsoft Delphi Grammar was tested against source code from Delphi 1 through Delphi 4. For Delphi 4.03 it was tested against a cumulative one million lines of code (including whitespace and comments).

Please see our separate paper for a detailed description.

Can I modify the grammar?

One of the great strengths, and major purpose of Cogencee, is that it allows you to modify grammars to suit your requirements.

You may want to extend the grammar to handle special situations. For example, allow "JavaDoc' like Delphi documentation to be written and produced. You may want to add Delphi code that gets executed or triggered at certain places.

Doesn't the grammar only detect Delphi keywords?

This is a common misconception. There are products that will do this and it is unfortunate that the perception is that they can do more. It is true that the Cocolsoft Delphi Grammar can detect Delphi keywords. However it does much more than that. The Cocolsoft Delphi Grammar understands the structure of Delphi code. As a simple illustration, if there is a keyword within a comment, then the "keyword" would be seen as part of a comment and not as a "keyword"!

Does the grammar require error free Delphi code?

It is not necessary to compile your code, and ensure it is error free, prior to running the Cocolsoft Delphi Grammar. The error messages are often more informative than the official ones.

What Delphi constructs does the Delphi grammar support?

The grammar supports most features. For example, the grammar detects and consumes embedded assembly code and comments within that assembly code. However the grammar of assembly code is not catered for. The grammar supports obsolete Delphi 1 features such as Objects, and Inline code.

Please see our separate paper for a detailed description.

What Delphi constructs doesn't the Delphi grammar support?

In its current release the Cocolsoft Delphi Grammar does not support the use of control codes in strings. (For example, ^M^J) However, please see the FAQ "Can I modify the grammar?".

Please see our separate paper for a detailed description.

Where is the paper giving a detailed description of the Cocolsoft Delphi Grammar?

The paper entitled 'Cocolsoft Delphi Grammar' ('DGram.htm') is available on this web site.

Isn't there an official Delphi grammar?

Borland has what it terms an 'Object Pascal grammar'. You can see this in the online Help files or Appendix A of the printed documentation to Delphi 4.03. This is a good starting point for getting a feel for the Delphi language. The official Delphi grammar is not in a machine readable form.

Does your terminology differ from the official Delphi grammar?

We based our terminology on that of our other grammars (eg. Modula-2). Delphi arose from Pascal which was designed by Nicklaus Wirth who went on to design Modula-2 and other languages. Those languages share a common ancestry. It isn't surprising then that the terminology used in the official Delphi grammar closely matches the terminology used in our Modula-2 and Cocolsoft Delphi grammars. (You can change the text of the error messages if you want.)

How fast is the Cocolsoft Delphi Grammar?

Lightning fast. You can see this for yourself by running the demo against any large unit that comes with the Delphi product. For example, unit 'ComCtrls.pas' in the Vcl directory which is 523kb in size and is 18,388 lines long.

Why do you recommend running 'GramTst' against problem programs?

Sometimes you can get a mental block in your coding. You key in your code, run the Delphi complier and it issues an error message. You scratch your head because, for the life of you, you can't figure out your error. If you run 'GramTst' against your problem code it may throw some additional light on your problem.

Is this the first time a Delphi 4 grammar has been released?

Yes, we are pleased to say that the Cocolsoft Delphi Grammar (released 4 March 1999) is the first Delphi grammar in machine readable form available to the public.

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.

Home Up Next