BNF Basics

  • Tom Fischer

    SSC-Addicted

    Points: 409

    Comments posted to this topic are about the item BNF Basics

  • Lambchop4697

    SSC-Addicted

    Points: 487

    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

    SSC-Insane

    Points: 24198

    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[/url]
    How to post performance problems[/url]
    Tally Table:What it is and how it replaces a loop[/url]

    "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

    SSC Enthusiast

    Points: 131

    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

    SSC-Addicted

    Points: 409

    Some formatting didn't transfer from Word to HTML, such as, underlining & bold.

    Good catch, thank you!

  • RBarryYoung

    SSC Guru

    Points: 143327

    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.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • jcrawf02

    SSC-Insane

    Points: 24198

    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[/url]
    How to post performance problems[/url]
    Tally Table:What it is and how it replaces a loop[/url]

    "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

    SSCarpal Tunnel

    Points: 4219

    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

    SSCrazy

    Points: 2080

    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

    SSC-Insane

    Points: 24198

    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[/url]
    How to post performance problems[/url]
    Tally Table:What it is and how it replaces a loop[/url]

    "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."

  • SqlNightOwl

    SSCrazy

    Points: 2214

    Nice treatment of an unfamiliar topic. I had figured out most of what the syntax/convention was before reading this but didn't know it had a name and defined rules.

    <opinion type="humble">The SQL team wrighting BOL should include a link to understanding the BNF convention as a part of BOL. Kind of like you get with a book where they spell out "conventions used in this book".</opinion>

    --Paul Hunter

  • RBarryYoung

    SSC Guru

    Points: 143327

    Paul Hunter (8/13/2009)


    ...

    <opinion type="humble">The SQL team wrighting BOL should include a link to understanding the BNF convention as a part of BOL. Kind of like you get with a book where they spell out "conventions used in this book".</opinion>

    ...

    Agreed.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Phil Factor

    SSCoach

    Points: 19898

    I really enjoyed and appreciated this article. there is not a lot of information about EBNF around and this was really useful. I seem to remember that these diagrams were in the original Sybase documentation before Microsoft bought the product to turn it into SQL Server, and it has somehow hung on, unloved.

    Best wishes,
    Phil Factor
    Simple Talk

Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic. Login to reply