the backus naur form-oct19

Upload: romeofatima

Post on 07-Aug-2018

236 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/20/2019 The Backus Naur Form-oct19

    1/23

    The Backus Naur

    Form

  • 8/20/2019 The Backus Naur Form-oct19

    2/23

    Metalanguage

    Language that describes other languages

  • 8/20/2019 The Backus Naur Form-oct19

    3/23

    Parts of a Description of a

    Language Syntax Semantics

  • 8/20/2019 The Backus Naur Form-oct19

    4/23

    Syntax

    Set of rules that determines which constructs

    are correctly formed programs and which are

    not

  • 8/20/2019 The Backus Naur Form-oct19

    5/23

    Semantics

    Description of the way a syntactically correct

    program is interpreted or carried our 

    eg. A:=B;

  • 8/20/2019 The Backus Naur Form-oct19

    6/23

    Backus Naur Form

     A metalanguage that is used to describe the syntax  A formal notation for specifying programming

    language

    t was presented by !ohn Bac"us at an internationalconference in #$%$ &as later slightly modified by 'eter (aur for the

    description of Algol )*

    t soon became the most popular method ofconcisely describing programming language syntax t was parallel to the study of "nown linguist (oam

    +homs"y

  • 8/20/2019 The Backus Naur Form-oct19

    7/23

     JON B!"#$S

    #$,- raduated from /ill school 'ottstown

    #$,- 0ntered the 1ni2ersity of 3irginia. !oined the army

    #$,% 0ntered 4lower and 4ifth A2enue 5edical School in (ew 6or" #$,$ &or"ed on B57S SS0+ computer 

    #$%*8#$%- &atson Lab

    #$%, Bac"us and his team publish 4ortran

    #$%$ De2elopng a notation called Bac"us8(aur 4orm in

    collaboration with (aur

    #$$# 9etirement

    ctober -< #$$ in the 1+LA 5edical +enter at the age of

    +hronology

  • 8/20/2019 The Backus Naur Form-oct19

    8/23

     JON B!"#$S

    #$) 9ecei2es (ational medal of Science

    #$ recei2ed the A+5 >uring Award Lecture.?-@

    #$$ 9ecei2ed doctor honoris causa of the 1ni2ersit /enri'oincar 8 (ancy< 4rance< on December #, #$$.?,@

    #$$ 9ecei2es +harles Star" Draper price for his wor" on 4ortran

    #$$ 4ellow Award 9ecipient of the +omputer /istory 5useum for

    his de2elopment of 49>9A(< contributions to computer systems

    theory and software proCect management.

    Honors and Awards 

    http://www.thocp.net/biographies/backus_john.htm#Metalanguagehttp://www.thocp.net/biographies/backus_john.htm#Syntaxhttp://www.thocp.net/biographies/backus_john.htm#Syntaxhttp://www.strep-necst.org/article.php3?id_article=10http://www.thocp.net/biographies/backus_john.htm#Metalanguage

  • 8/20/2019 The Backus Naur Form-oct19

    9/23

    One %eal &orl' (xample)

     The (nglish Language*rammar

  • 8/20/2019 The Backus Naur Form-oct19

    10/23

    (lements of the BNF

    Notation Set of >erminal Symbols Set of (on8>erminal Symbols

    Set of 'roduction 9ules

    oalbCecti2e

  • 8/20/2019 The Backus Naur Form-oct19

    11/23

    Set of Terminal Sym+ols

     Atomic or non8di2isible symbols that can be

    combined to form 2alid constructs in the

    language

    1sually set of characters though some

    language may consider certain character

    string to be symbols

  • 8/20/2019 The Backus Naur Form-oct19

    12/23

    Set of Non,Terminal Sym+ols

    Symbols which are not included in the

    language itself but are symbols used to

    represent intermediate definitions within the

    language as defined by the production rules 9epresents syntactic classes or categories

  • 8/20/2019 The Backus Naur Form-oct19

    13/23

    Set of Pro'uction %ules

     A definition of a non8terminal symbol

    format:

    E 6

    where E is a nonterminal symbol

      6 is a seFuence of symbols each of

    which can be either >erminalor (on8terminal

  • 8/20/2019 The Backus Naur Form-oct19

    14/23

    *oal Sym+ol

    Start symbol

  • 8/20/2019 The Backus Naur Form-oct19

    15/23

    %ules in Forming *rammars

    #. 02ery (onterminal symbol must appear to

    the left of the of at least one ?#@

    production rule

    -. oal symbol must not appear to the right ofthe of any productions

  • 8/20/2019 The Backus Naur Form-oct19

    16/23

    T-o &ays of $sing a*rammar#. >o generate 2alid programs of a language

    -. 9eduction of a program

  • 8/20/2019 The Backus Naur Form-oct19

    17/23

    >/0 +AL+1LA>9 LA(1A0

  • 8/20/2019 The Backus Naur Form-oct19

    18/23

    "S (NT%. / 012 pointseach3#. &hat happens if grammar is not present in a

    natural languageG

    -. &hat is the importance of a grammar in a

    natural languageG. &hat is the implication if we only ha2e one

    grammar in programmingG

  • 8/20/2019 The Backus Naur Form-oct19

    19/23

    (xten'e' Backus,Naur Form0(BNF3 Additional >hree symbols:

    H Alternation

    I J ptional

    K 9epetition

  • 8/20/2019 The Backus Naur Form-oct19

    20/23

    The !lternation Sym+ol 4

    use of the or symbol to express alternate

    definition for the same non8terminal symbol

    within the single production rule

    eg. dd #

    dd 

    dd %

  • 8/20/2019 The Backus Naur Form-oct19

    21/23

    The Optional Sym+ol

    9epresents an optional item

    Mero or one occurrence of the symbol

    eg. E 6 I M J

  • 8/20/2019 The Backus Naur Form-oct19

    22/23

    The %epetition Sym+ol 5 6

    Specifies repeated item

    eg. E 6 K6

  • 8/20/2019 The Backus Naur Form-oct19

    23/23

     !lpha+et, ! 

     Any single symbol from the "eyboard