SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


BNF Basics


BNF Basics

Author
Message
Tom Fischer
Tom Fischer
Valued Member
Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)

Group: General Forum Members
Points: 71 Visits: 65
Comments posted to this topic are about the item BNF Basics
Lambchop4697
Lambchop4697
SSC Rookie
SSC Rookie (42 reputation)SSC Rookie (42 reputation)SSC Rookie (42 reputation)SSC Rookie (42 reputation)SSC Rookie (42 reputation)SSC Rookie (42 reputation)SSC Rookie (42 reputation)SSC Rookie (42 reputation)

Group: General Forum Members
Points: 42 Visits: 43
Excellent subject, but the write up, while well intended, tries to summarize too much information. For most folks, I doubt if they would even bother trying to match up the information into the functional example to really understand much. The foo:bar example really needs expanding and perhaps revised to apply to the example that is initially displayed at the beginning of the article. This article is intended as an application article or an explanation/resolution article. Either way, it misses the mark as it really does not bring the reader forward in logical steps that make sense without further research into the topic. My 2 cents...



jcrawf02
jcrawf02
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2936 Visits: 19324
Disagree with Lambchop in general, but specifically think the comment about requiring additional research was on the mark. However, don't think that's a bad thing. I think you've provided a great springboard for newbies to get their feet wet in BNF/BOL and get comfortable enough to sort out the details.

Those who won't bother reading through the article to figure it out will be the ones who don't bother reading BOL either, so no biggy.

Good job!

Jon

---------------------------------------------------------
How best to post your question
How to post performance problems
Tally Table:What it is and how it replaces a loop

"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
michael.kjorling
michael.kjorling
SSC Journeyman
SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)

Group: General Forum Members
Points: 89 Visits: 73
In the second example under BNF ala T-SQL, am I missing something?

Let us also make it a requirement that when calling bar it demands further information, which can be accomplished via squiggly brackets. And if these arguments are not provided, then bar will assume a default value of constant “1” as indicated by an underline.

<foo>::= [<foo> |<bar>]
<bar>::= {1 | 2}


Where is the underline? I assume that the second line is really supposed to read:

<bar>::= {_1_ | 2}

but it would be nice to know.

Good writeup, otherwise!

Also, a somewhat off-topic question. Should one really be required to manually HTML-escape the less than and greater than signs, or am I doing something wrong?
Tom Fischer
Tom Fischer
Valued Member
Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)

Group: General Forum Members
Points: 71 Visits: 65
Some formatting didn't transfer from Word to HTML, such as, underlining & bold.

Good catch, thank you!
RBarryYoung
RBarryYoung
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19264 Visits: 9518
Nice article. I have a couple of notes though:

1) What you are describing is actually a simplified informal version of EBNF, not BNF (though the standards groups do use the formal versions). For instance it adds the ellipsis ("...") as a repetition operator as well as other common conventions. This is the language definition format used almost universally in Language Syntax Manuals since the 60's.

2) In English, these ("{ }") are called braces, not "brackets" or "curly brackets", or even "squiggly brackets". It seriously undermines the credibility of anyone talking about language definitions if they do not know the proper terms for the language that they themselves are using. (yes, it's a hot button of mine)

Still, very nice article.

-- RBarryYoung, (302)375-0451 blog: MovingSQL.com, Twitter: @RBarryYoung
Proactive Performance Solutions, Inc.
"Performance is our middle name."
jcrawf02
jcrawf02
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2936 Visits: 19324
RBarryYoung (8/12/2009)
Nice article. I have a couple of notes though:

1) What you are describing is actually a simplified informal version of EBNF, not BNF (though the standards groups do use the formal versions). For instance it adds the ellipsis ("...") as a repetition operator as well as other common conventions. This is the language definition format used almost universally in Language Syntax Manuals since the 60's.

2) In English, these ("{ }") are called braces, not "brackets" or "curly brackets", or even "squiggly brackets". It seriously undermines the credibility of anyone talking about language definitions if they do not know the proper terms for the language that they themselves are using. (yes, it's a hot button of mine)

Still, very nice article.


And just to clarify, when people refer to braces, they are really talking about orthodontia.

---------------------------------------------------------
How best to post your question
How to post performance problems
Tally Table:What it is and how it replaces a loop

"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
Scott-144766
Scott-144766
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1602 Visits: 1103
And just to clarify, when people refer to braces, they are really talking about orthodontia.


I'm usually discussing ways of keeping my trousers from falling down. My father-in-law is a carpenter and has a different take on the word altogether.

The last time someone really pushed my button on the topic of punctuation was when I told one of my colleagues to use an apostrophe and he asked me if that was the "comma up in the air". I was very impressed with the way that I managed to refrain from comment at the time.

--
Scott
sjsubscribe
sjsubscribe
Old Hand
Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)

Group: General Forum Members
Points: 369 Visits: 595
Good topic Tom. Speaking of BOL, I think it can be improved by providing a better match between BNF descriptions and examples that follow. One easy way would be to repeat the applicable BNF with each example. Another would be to make the examples more exhaustive so that all BNF options used in the definition are used in examples. Otherwise BNF just acts as another layer of indirection and not a natural part of composing T-SQL.
jcrawf02
jcrawf02
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2936 Visits: 19324
sjsubscribe (8/12/2009)
Another would be to make the examples more exhaustive so that all BNF options used in the definition are used in examples. Otherwise BNF just acts as another layer of indirection and not a natural part of composing T-SQL.


I wouldn't want to be the guy creating all those examples, but good idea, that would help.

---------------------------------------------------------
How best to post your question
How to post performance problems
Tally Table:What it is and how it replaces a loop

"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search