The length of a derivation: number of substitutions it contains.
A grammar Ggenerates a string w if there is a derivation
for w in G.
L(G), the language generated by a grammar G: set of all strings generated by G
A language L0 is context-free iff there is some
context-free grammarG such that L0 =
L(G)
Two grammars are equivalent iff they generate the same language.
Parse Trees: root, internal nodes, leaves
A grammar Ggenerates a string w if there is a parse
tree for w in G rooted at S (G's start symbol).
Parsing: given string w and grammar G, constructing
parse tree for w in G
Applications of parsing in compilers/interpreters.
Reading:
Chapter 2.1 through middle of p. 105
Skills:
Know new definitions, understand new concepts
Given a CFG G and a string w, find a derivation for
w in G.
Given aCFG G, describe L(G).
Given a description of a language, find a context-free grammar for it.
What are the root, the internal nodes, and the leaves in a parse tree?
What is the string generated by a given parse tree?
Given a derivation, construct the corresponding tree.
Given a CFG G and a string w, find a parse tree for
w in G.
Notes:
In the book, variables are also called "non-terminal symbols",
and symbols are called "terminal symbols".
Last time we showed that {0n 1n : n >= 0}is not a regular
language; today we saw that it is a context-free language.
Backus-Naur form is a special notation for specifying context-free grammars
that is often used to describe the syntax of programming languages.
Here is the Wikipedia
page about it.