Professional Documents
Culture Documents
To
gain
insight:
Model
language
Model
mechanisms
for
processing
it
Language
models
Language
is
about:
Structure
Meaning
Model:
strips
detail
of
a
topic
25/10/15
Ambiguity
Ambiguous
words:
gure
out
meaning
from
context
E.g.:
bank
log = log2
X=Y=25
37
25/10/15
Language
models
Language
models
provide
insight:
Ambiguity
Eciency
of
language
processing
Computa[onal
complexity
Important:
Eciency
of
processing
a
programming
language
Formal
languages
Formal
models
of
languages
focus
on:
Sequences
of
symbols
Deni[on: alphabet
Strings
Alphabet: huge
Programming
language:
Alphabet:
smaller
but
s[ll
too
big
to
write
down
Convenience:
We
use
smaller
symbol
sets
25/10/15
Length
of
strings
Length
of
string:
The
number
of
symbols
in
it
E.g.:
|abc| = 3
Empty
string
|| = 0
is
a
string,
not
a
symbol!
Not listed in
E.g.:
Length
of
strings
Finite
set
Innite
set
25/10/15
:
Language
consis[ng
of
all
possible
strings
over
the
X
symbol
set
X
E.g.:
Set
formats
Extensional
format:
(i)
Intensional format
(ii), (iii)
E.g.:
Exercise
Book
p154:
8.8
(a)
Book
p154:
8.9
(a)
25/10/15
Opera[ons
on
languages
L1,
L2:
languages
Each
language
L
has
a
complement
\
L
Empty
language
Has
no
strings
Empty
language:
;
Language
with
the
empty
string:
{}
Other
example:
{,
a, aa}
Has
1
string,
of
length
0
Has
3
strings,
of
length
0,
1,
2
Concatena[on
of
languages
Deni[on:
Concatena[on
of
strings
x
and
y
are
strings:
x
y
is
the
concatena[on
of
x
and
y
x
is
a
string:
x = x = x
x
is
a
string:
xx
k = xk+1
x
is
a
string:
x0 =
Not communica[ve
25/10/15
Exercise
Book
p154:
8.7
(b)
Concatena[on
of
languages
Deni[on:
Concatena[on
of
languages
For
language
L
1
and
L
2
:
wrihen
as
L1L2
L1 L2 = {xy|x 2 L1 ^ y 2 L2 }
E.g.:
Not
communica[ve
Possible concatena[ons
L1L2:
2
[mes
3
unique
concatena[ons
L2L2:
3
[mes
3
concatena[ons
Only
5
unique
concatena[ons
Exercise:
give
the
set
L2L2
25/10/15
Exercise
Book
p154:
8.11
Book
p154:
8.12
(a)
Exercise
Book
p155:
8.18
(a)
L=
25/10/15
1
[
Li
Star
(Kleene)
operator
i=0
E.g.:
Consistent
with
Exercise
Book
p154:
8.6
Book
p155:
8.16
(a)
25/10/15
Lower
level
of
analysis
Other
examples:
Posi[ve
integer
tokens:
English:
10
25/10/15
Inner
statement
bears
no
restric[ons
Can
be
a
for
statement
again
Statement
within
a
statement
Recursive
construct
Deni[on:
Recursive
construct
A
construct
is
recursive
if
it
can
contain
within
itself
a
structure
of
the
same
type
11
25/10/15
Intensional
format:
Uses
a
specica[on
of
the
proper[es
the
strings
it
contains
Another
example:
N
a
(x)
denotes
the
number
of
occurrences
of
the
symbol
a
in
the
string
x
Computa[onal ques[ons
Such
that:
Any
par[cular
string
would
ul[mately
occur
Grammar
Computa[onal ques[ons
12
25/10/15
Computa[onal ques[ons
Language
classes
There
are
an
innite
number
of
dierent
languages
over
Some
are
more
complex
than
others
Automaton
is
more
challenging
E.g.:
Grammar
is
more
challenging
Language
classes
Deni[on:
Language
class
Set
of
languages
that
can
be
recognized
by
some
automaton
that
abides
certain
restric[ons
Parallel
to
this:
restric[ons
to
grammars
can
be
specied
13
25/10/15
Language classes
Sets
Regular
language
is
a
context-free
language
14