














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
BNF (Backus-Naur Form) and EBNF (Extended Backus-Naur Form) are formal grammar notations used to specify context-free grammars. the origins, differences, and extensions of these notations. BNF was first introduced by John Backus for Algol 60, while EBNF was later proposed by Niklaus Wirth to add syntactic sugar for more convenient grammar definitions. Both notations are widely used in defining programming languages.
Typology: Lecture notes
1 / 22
This page cannot be seen from the preview
Don't miss anything!
context-free grammars
programming languages ambiguously, i.e.,with English
-^
Backus invented FORTRAN (“FORMulaTRANslator”), the first high-level language ever
, circa 1954
-^
Major influence on the invention offunctional programming in 1970’s
-^
Won the 1977 Turing Award for BNF andFORTRAN
scientist
“:=” instead)
people added their own extensions
he published “What Can We Do About theUnnecessary Diversity of Notation forSyntactic Definitions” in Communicationsof the ACM in 1977
symbols (0 or 1 occurrences), “{ .. }” for 0or more occurrences.
-^
Born in Switzerland, 1934
-^
Desgined Pascal (1970),Modula, Modula-2 (1980),and Oberon (1988)
-^
Won the Turing Award in 1984
-^
Won the IEEE ComputerPioneer Award in 1987
regular expression syntax
” (The Kleene Star): means 0 or more occurrences
” (The Kleene Cross): means 1 or more occurrences
”: means 0 or 1 occurrences (sometimes “[ … ]” used instead)
|
|
'4' | '5' | '6' | '7' | '8' | '9'
|
-^
You can replace it with:
You can replace it with:
s_expression ::= atomic_symbol
| "(" s_expression "." s_expression ")"| list
list ::= "(" s_expression ")"atomic_symbol ::= letter atom_partatom_part ::= empty*
| letter atom_part| number atom_part
letter ::= "a" | "b" | " ..." | "z"number ::= "1" | "2" | " ..." | "9"
-^
BNF uses following notations:
(i) Non-terminals enclosed in
<
and
>
.
(ii) Rules written as
X
::=
Y
(1)
X
is LHS of rule and can only be a NT.
(2)
Y
is RHS of rule:
Y
can be
(a) a terminal, nonterminal, or concatenation of terminal
and nonterminals, or (b) a set of strings separated by alternation symbol
|.
Example: < S >
::=
a < S > |a
-^ Notation
ε
: : Used to represent an empty string (a string of
length 0).