HOME > > TUTORIALS TABLE OF CONTENTS - - - / - - / - - / - - / - - - Other material for programmers

Delphi tutorial: Syntax Notation (Level 2)

This has good information, and a search button at the bottom of the page

Click here if you want to know more about the source and format of these pages.


Syntax notation:

Master this material, and you will be able to learn more from the Boland "Help" files. The material covered is hard to explain, but not very hard to use... and it covers a powerful tool for describing what is, and isn't, allowed in the language.

For a long time, computer manuals have been using things like "Enter DELETE <name>" as a quick way to say "Press the D, E, L, E, T, E keys, and then the keys which make up the name of the thing you want to delete. E.g. enter DELETE FRED, or DELETE TheUnwantedFile.TXT"

This is a fine and useful convention. Unfortunately, the people who invented HTML (the language used to display web pages) dedicated the > and < symbols to another use, and getting them to appear for you (as they have in this section) is a real pain!

Therefor, in the following, I'm going to use the { and } in place of > and <. NB: In Pascal and Delphi, { and } are alternatives to (* and *). I WON'T use { and } that way here!

BUT... at point (*11*) in the simple Delphi unit above, you will see {}. They should be there, as themselves, not as substitutes for > and <.
It is VERY USEFUL to learn to think of Pascal and Delphi code in the following terms:

A simple procedure declaration is made up as follows:

procedure {name}{formal parameter};

Look at the TForm1.Label1Click procedure declaration in the example unit above.

TForm1.Label1Click is the procedure name.

(Sender:TObject) is the formal paramater.

label1.caption:='Clicked'; is the statement.

If you master this method of communicating, called syntax notation, you will have a powerful tool for expressing or reading about complicated things in a very elegant manner. A lot of the best Pascal and Delphi support, including the Borland supplied help files, uses syntax notation extensively.

It is so important that I am going to digress for a moment, and 'describe' a simple subset of English using syntax notation. You might be amused to learn that I have written programs to generate whimsical sentences using something like the following....

In my subset of English,

an article is 'A' or 'The'

a noun is 'cat' 'dog' 'brick' 'flower' or 'hand'

a verb is 'ate' 'bought' 'painted' or 'planted'

a sentence is....


With nothing more than the above, I've said that in my subset of English, the following are ALLOWED. (Even if they don't make sense!)

"A cat ate a flower."

"The hand painted a brick."

"The brick planted the dog."

... and so on.

Even now, we have a pretty powerful tool. But it gets better!

If we say that putting something between two |s we are saying it is optional, we extend the tool to allow things like....

a sentence is....


NOW, in addition to the sentences which were allowed previously, the following become possible:

"Cat ate."

"A cat ate."

"A dog painted brick."

"Dog painted a brick."

LASTLY... we build in the power of recursion. If I write an element thus..


it will mean that it may appear not at all, or once, or many times. (I'm afraid :++: are non-standard punctuation marks forced on us by the limitations of HTML, too. Sorry.)

Now we can define a "compound sentence", which is....

{sentence} :+and {sentence}+:

which makes possible:

"A cat ate a flower and the hand painted a brick."

"A cat ate a flower and the hand painted a brick and the flower ate dog."

... and so on.

Just using

{sentence} |and {sentence}|

would have only made possible two phrase sentences.

(The logical among you... and logical you must be if you are to program without tears... will have notice that I've been sloppy about the matter of the period at the end of a sentence. It could be dealt with... but I didn't want to!)

Now you have a powerful tool available. Good news: In other reference sources, where the author has diagrams available, you will find a graphical alternative to my |s and :+{thing}+:s.... which make reading the syntax notation child's play, once you get the hang of it.

Was the above of any use? Please send an email, at least. (If you would be interested in more tutorials like this, say so. I'll try to remember to notify you if they become available.) For my idle curiosity... Where are you, please? (City, state, country?)

Even better, download a piece of my software, try it and pass it on to someone?

Cheers, Tom Boyd


   Search this site or the web        powered by FreeFind
  Site search Web search
Site Map    What's New    Search

Click here if you're feeling kind! (Promotes my site via "Top100Borland")
Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows pc) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!

Click here to visit editor's freeware, shareware page.

Link to Tutorials main page
Here is how you can contact this page's author, Tom Boyd.

Valid HTML 4.01 Transitional Page WILL BE tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org

If this page causes a script to run, why? Because of things like Google panels, and the code for the search button. Why do I mention scripts? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....