Post on 28-Mar-2023
Deterministic Context-Free
Languages
DCFL
A family of languages that are accepted by a Deterministic Pushdown Automaton (DPDA)
Many programming languages can be described by means of DCFLs
Prefix and Proper Prefix
Prefix (of a string) Any number of leading symbols of that
string
Example: abc Prefixes: , a, ab, abc
Proper Prefix (of a string) A prefix of a string, but not the string itself
Example: abc Proper prefixes: , a, ab
Prefix Property
Context-Free Language (CFL) L is said to have the prefix property whenever w is in L and no proper prefix of w is in L
Not considered a serve restriction
Why?
Because we can easily convert a DCFL to a
DCFL with the prefix property by introducing an
endmarker
Suffix and Proper Suffix
Suffix (of a string)
Any number of trailing symbols
Proper Suffix
A suffix of a string, but not the string itself
Example Grammar
This is the grammar that will be used in many of the examples:
S’ Sc
S SA | A
A aSb | ab
LR-Grammar
Left-to-right scan of the input producing a rightmost derivation
Simply:
L stands for Left-to-right
R stands for rightmost derivation
LR-Items
An item (for a given CFG)
A production with a dot anywhere in the
right side (including the beginning and end)
In the event of an -production: B B · is an item
Example: Items
Given our example grammar:
S’ Sc, S SA|A, A aSb|ab
The items for the grammar are:
S’·Sc, S’S·c, S’Sc·
S·SA, SS·A, SSA·, S·A, SA·
A·aSb, Aa·Sb, AaS·b, AaSb·, A·ab, Aa·b, Aab·