Introduction to Formal LanguagesIntroduction to Formal Languages Martin Franzle¨ Informatics and...

Preview:

Citation preview

Introduction toFormal Languages

Martin Franzle

Informatics and Mathematical Modelling

The Technical University of Denmark

02140 Languages and Parsing, MF, Fall 2003 – p.1/16

Formal Languages

What is it?

02140 Languages and Parsing, MF, Fall 2003 – p.2/16

(Formal) Languages

� A language is a set of “legal” sentences.

A sentence is a sequence of symbols.

The symbols can be characters, words punctuation,hieroglyphs, dots and dashes (Morse code),

A formal language is a language defined by a finite set ofunambiguous rules delimiting the legal sentences from theillegal ones.

02140 Languages and Parsing, MF, Fall 2003 – p.3/16

(Formal) Languages

� A language is a set of “legal” sentences.

� A sentence is a sequence of symbols.

� The symbols can be characters, words

punctuation,hieroglyphs, dots and dashes (Morse code), � � �

A formal language is a language defined by a finite set ofunambiguous rules delimiting the legal sentences from theillegal ones.

02140 Languages and Parsing, MF, Fall 2003 – p.3/16

(Formal) Languages

� A language is a set of “legal” sentences.

� A sentence is a sequence of symbols.

� The symbols can be characters, words

punctuation,hieroglyphs, dots and dashes (Morse code), � � �

� A formal language is a language defined by a finite set ofunambiguous rules delimiting the legal sentences from theillegal ones.

02140 Languages and Parsing, MF, Fall 2003 – p.3/16

Why are they interesting?

Because formal languages arise everywhere in computing:

� Programming languages, query languages, etc.

� The inputs expected by programs:

� inputs to be keyed in, e.g. numbers in certain format, names,etc.

� sequences of button clicks in a GUI.

� Protocols for data exchange between computers (e.g. SMTP)

Knowledge of their algorithmic properties permits auto-matic generation of programs for their manipulation.

02140 Languages and Parsing, MF, Fall 2003 – p.4/16

Why are they interesting?

Because formal languages arise everywhere in computing:

� Programming languages, query languages, etc.

� The inputs expected by programs:

� inputs to be keyed in, e.g. numbers in certain format, names,etc.

� sequences of button clicks in a GUI.

� Protocols for data exchange between computers (e.g. SMTP)

Knowledge of their algorithmic properties permits auto-matic generation of programs for their manipulation.

02140 Languages and Parsing, MF, Fall 2003 – p.4/16

Some means of defining formal languages

A finite and unambiguous set of rules can be given by

1. a “computer” with finite memory such that the whole machinecan be described finitely,

“Regular languages”

2. a finite set of recursive definitions of the formif is a natural number then is an arithmetic expression,

,if and are arithmetic expressions then is anarithmetic expression,

“Context-free languages”

3.

02140 Languages and Parsing, MF, Fall 2003 – p.5/16

Some means of defining formal languages

A finite and unambiguous set of rules can be given by

1. a “computer” with finite memory such that the whole machinecan be described finitely,

“Regular languages”

2. a finite set of recursive definitions of the form

� if � is a natural number then � is an arithmetic expression,

� � � ,

� if ��� and ��� are arithmetic expressions then � � � ��� is anarithmetic expression,

� � �

“Context-free languages”

3.

02140 Languages and Parsing, MF, Fall 2003 – p.5/16

Some means of defining formal languages

A finite and unambiguous set of rules can be given by

1. a “computer” with finite memory such that the whole machinecan be described finitely,

“Regular languages”

2. a finite set of recursive definitions of the form

� if � is a natural number then � is an arithmetic expression,

� � � ,

� if ��� and ��� are arithmetic expressions then � � � ��� is anarithmetic expression,

� � �

“Context-free languages”

3. � � �

02140 Languages and Parsing, MF, Fall 2003 – p.5/16

Some means of defining formal languages

A finite and unambiguous set of rules can be given by

1. a “computer” with finite memory such that the whole machinecan be described finitely,

“Regular languages”

2. a finite set of recursive definitions of the form

� if � is a natural number then � is an arithmetic expression,

� � � ,

� if ��� and ��� are arithmetic expressions then � � � ��� is anarithmetic expression,

� � �

“Context-free languages”

3. � � �

02140 Languages and Parsing, MF, Fall 2003 – p.5/16

Regular languages:

Application domains

02140 Languages and Parsing, MF, Fall 2003 – p.6/16

Regular languages

arise naturally in

� descriptions of hardware components,

because these are computational devices with finite memory,

� descriptions of communication protocols,

because these engage into an alternation of finitely many differentphases,

� word classification problems, e.g.:is the next word a hyperlink, or is it to be rendered as text?

� descriptions of embedded computer systems,

because these are computers with finite memory.

02140 Languages and Parsing, MF, Fall 2003 – p.7/16

Regular languages

arise naturally in

� descriptions of hardware components,

because these are computational devices with finite memory,

� descriptions of communication protocols,

because these engage into an alternation of finitely many differentphases,

� word classification problems, e.g.:is the next word a hyperlink, or is it to be rendered as text?

� descriptions of embedded computer systems,

because these are computers with finite memory.

02140 Languages and Parsing, MF, Fall 2003 – p.7/16

Finite automata as models:

Embedded computer systems

02140 Languages and Parsing, MF, Fall 2003 – p.8/16

The coffee vending machine — architecture

Vending machine

cout

Financialadministr.

Brewercontrol

caf

canccoin req

02140 Languages and Parsing, MF, Fall 2003 – p.9/16

The coffee vending machine — dynamics

brewidle wait

no payno pay

(*, *, *, req, −caf)(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid(cin, *, −cout, *, *)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

02140 Languages and Parsing, MF, Fall 2003 – p.10/16

An example run

brewidle wait

no payno pay

(*, *, *, req, −caf)(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid(cin, *, −cout, *, *)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, −canc, −cout, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, canc, *, −req, −caf)

Brewer control

paid

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, −cout, *, caf)

(*, *, *, *, caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

02140 Languages and Parsing, MF, Fall 2003 – p.11/16

An example run

brewidle wait

no payno pay

(*, *, *, req, −caf)(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid(cin, *, −cout, *, *)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, −canc, −cout, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, canc, *, −req, −caf)

Brewer control

paid

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, −cout, *, caf)

(*, *, *, *, caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

02140 Languages and Parsing, MF, Fall 2003 – p.11/16

An example run

brewidle wait

no payno pay

(*, *, *, req, −caf)(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid(cin, *, −cout, *, *)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, −canc, −cout, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

brewidle wait

no payno pay

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, canc, *, −req, −caf)

Brewer control

paid

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, −cout, *, caf)

(*, *, *, *, caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

02140 Languages and Parsing, MF, Fall 2003 – p.11/16

An example run

brewidle wait

no payno pay

(*, *, *, req, −caf)(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid(cin, *, −cout, *, *)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, −canc, −cout, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

brewidle wait

no payno pay

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, canc, *, −req, −caf)

Brewer control

paid

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, −cout, *, caf)

(*, *, *, *, caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

02140 Languages and Parsing, MF, Fall 2003 – p.11/16

An example run

brewidle wait

no payno pay

(*, *, *, req, −caf)(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid(cin, *, −cout, *, *)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, −canc, −cout, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, canc, *, −req, −caf)

Brewer control

paid

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, −cout, *, caf)

(*, *, *, *, caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

02140 Languages and Parsing, MF, Fall 2003 – p.11/16

An example run

brewidle wait

no payno pay

(*, *, *, req, −caf)(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid(cin, *, −cout, *, *)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, −canc, −cout, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, canc, *, −req, −caf)

Brewer control

paid

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, −cout, *, caf)

(*, *, *, *, caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

02140 Languages and Parsing, MF, Fall 2003 – p.11/16

An example run

brewidle wait

no payno pay

(*, *, *, req, −caf)(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid(cin, *, −cout, *, *)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, −canc, −cout, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, canc, *, −req, −caf)

Brewer control

paid

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, −cout, *, caf)

(*, *, *, *, caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

02140 Languages and Parsing, MF, Fall 2003 – p.11/16

An example run

brewidle wait

no payno pay

(*, *, *, req, −caf)(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid(cin, *, −cout, *, *)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, −canc, −cout, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, canc, *, −req, −caf)

Brewer control

paid

(*, canc, cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, −cout, *, caf)

(*, *, *, *, caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

brewidle wait

no payno pay

(*, *, *, req, −caf)

(*, −canc, *, −req, −caf)

(*, canc, *, −req, −caf)

(*, *, *, *, caf)

Brewer control

paid

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, −canc, −cout, *, −caf)

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

brewidle wait

no payno pay

Brewer control

paid

Financial administration

(−cin, *, −cout, *, *)

(−cin, *, *, *, −caf)

(cin, *, −cout, *, *)

(cin, *, *, *, −caf)

(*, −canc, *, −req, −caf)

(*, *, *, req, −caf)

(*, −canc, −cout, *, −caf)

(*, *, *, *, caf)

(*, *, −cout, *, caf)

(*, canc, cout, *, −caf)

(*, canc, *, −req, −caf)

02140 Languages and Parsing, MF, Fall 2003 – p.11/16

The coffee vending machineProduct automaton: Financial admin. * Brewer ctrl.

(*, −canc, −cout, req, −caf)

no pay no pay no pay

paid paid paid

(*, −canc, −cout, −req, −caf)

(−cin, *, −cout, *, caf)

(−cin, *, −cout, req, −caf)

(−cin, −canc, −cout, −req, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(−cin, *, −cout, *, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(cin, *, −cout, *, −caf)

(*, *, −cout, *, caf)

brew

idle wait brew

idle wait(−cin, canc, −cout, −req, −caf)

(*, canc,

cout, r

eq, −

caf)

Product automaton: Financial admin. * Brewer ctrl.

(*, −canc, −cout, req, −caf)

no pay no pay no pay

paid paid paid

(*, −canc, −cout, −req, −caf)

(−cin, *, −cout, *, caf)

(−cin, *, −cout, req, −caf)

(−cin, −canc, −cout, −req, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(−cin, *, −cout, *, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(cin, *, −cout, *, −caf)

(*, *, −cout, *, caf)

brew

idle wait brew

idle wait(−cin, canc, −cout, −req, −caf)

(*, canc,

cout, r

eq, −

caf)

Unreachable states!

Product automaton: Financial admin. * Brewer ctrl.

(*, −canc, −cout, req, −caf)

no pay no pay no pay

paid paid paid

(*, −canc, −cout, −req, −caf)

(−cin, *, −cout, req, −caf)

(−cin, −canc, −cout, −req, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(−cin, *, −cout, *, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(*, *, −cout, *, caf)

brew

idle wait brew

idle wait(−cin, canc, −cout, −req, −caf)

(cin, *, −cout, *, −caf)

(*, canc,

cout, r

eq, −

caf)

(−cin, *, −cout, *, caf)

Free coffee!

02140 Languages and Parsing, MF, Fall 2003 – p.12/16

The coffee vending machine

Product automaton: Financial admin. * Brewer ctrl.

(*, −canc, −cout, req, −caf)

no pay no pay no pay

paid paid paid

(*, −canc, −cout, −req, −caf)

(−cin, *, −cout, *, caf)

(−cin, *, −cout, req, −caf)

(−cin, −canc, −cout, −req, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(−cin, *, −cout, *, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(cin, *, −cout, *, −caf)

(*, *, −cout, *, caf)

brew

idle wait brew

idle wait(−cin, canc, −cout, −req, −caf)

(*, canc,

cout, r

eq, −

caf)

Product automaton: Financial admin. * Brewer ctrl.

(*, −canc, −cout, req, −caf)

no pay no pay no pay

paid paid paid

(*, −canc, −cout, −req, −caf)

(−cin, *, −cout, *, caf)

(−cin, *, −cout, req, −caf)

(−cin, −canc, −cout, −req, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(−cin, *, −cout, *, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(cin, *, −cout, *, −caf)

(*, *, −cout, *, caf)

brew

idle wait brew

idle wait(−cin, canc, −cout, −req, −caf)

(*, canc,

cout, r

eq, −

caf)

Unreachable states!

Product automaton: Financial admin. * Brewer ctrl.

(*, −canc, −cout, req, −caf)

no pay no pay no pay

paid paid paid

(*, −canc, −cout, −req, −caf)

(−cin, *, −cout, req, −caf)

(−cin, −canc, −cout, −req, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(−cin, *, −cout, *, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(*, *, −cout, *, caf)

brew

idle wait brew

idle wait(−cin, canc, −cout, −req, −caf)

(cin, *, −cout, *, −caf)

(*, canc,

cout, r

eq, −

caf)

(−cin, *, −cout, *, caf)

Free coffee!

02140 Languages and Parsing, MF, Fall 2003 – p.12/16

The coffee vending machine

Product automaton: Financial admin. * Brewer ctrl.

(*, −canc, −cout, req, −caf)

no pay no pay no pay

paid paid paid

(*, −canc, −cout, −req, −caf)

(−cin, *, −cout, *, caf)

(−cin, *, −cout, req, −caf)

(−cin, −canc, −cout, −req, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(−cin, *, −cout, *, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(cin, *, −cout, *, −caf)

(*, *, −cout, *, caf)

brew

idle wait brew

idle wait(−cin, canc, −cout, −req, −caf)

(*, canc,

cout, r

eq, −

caf)

Product automaton: Financial admin. * Brewer ctrl.

(*, −canc, −cout, req, −caf)

no pay no pay no pay

paid paid paid

(*, −canc, −cout, −req, −caf)

(−cin, *, −cout, *, caf)

(−cin, *, −cout, req, −caf)

(−cin, −canc, −cout, −req, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(−cin, *, −cout, *, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(cin, *, −cout, *, −caf)

(*, *, −cout, *, caf)

brew

idle wait brew

idle wait(−cin, canc, −cout, −req, −caf)

(*, canc,

cout, r

eq, −

caf)

Unreachable states!

Product automaton: Financial admin. * Brewer ctrl.

(*, −canc, −cout, req, −caf)

no pay no pay no pay

paid paid paid

(*, −canc, −cout, −req, −caf)

(−cin, *, −cout, req, −caf)

(−cin, −canc, −cout, −req, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(−cin, *, −cout, *, −caf)

(−cin, −can, −cout, *, −caf)

(*, canc, cout, −req, −caf)

(*, *, −cout, *, caf)

brew

idle wait brew

idle wait(−cin, canc, −cout, −req, −caf)

(cin, *, −cout, *, −caf)

(*, canc,

cout, r

eq, −

caf)

(−cin, *, −cout, *, caf)

Free coffee!

02140 Languages and Parsing, MF, Fall 2003 – p.12/16

What you’ll learn

1. The model of finite automata,

2. methods for expressing properties like “free coffee”, namelyregular expressions,

3. algorithms for manipulating regular languages,

4. how to plug these algorithms together such that theyautomatically check properties like “free coffee”.

I.e., you will build programs which analyze programs!

02140 Languages and Parsing, MF, Fall 2003 – p.13/16

What you’ll learn

1. The model of finite automata,

2. methods for expressing properties like “free coffee”, namelyregular expressions,

3. algorithms for manipulating regular languages,

4. how to plug these algorithms together such that theyautomatically check properties like “free coffee”.

I.e., you will build programs which analyze programs!

02140 Languages and Parsing, MF, Fall 2003 – p.13/16

Embedded systems in-the-large

02140 Languages and Parsing, MF, Fall 2003 – p.14/16

Context-free languages:

Application domains

02140 Languages and Parsing, MF, Fall 2003 – p.15/16

Context-free languages

arise naturally in

� in the definition of programming languages, query lang., etc.:

if � is a natural number then � is an arithmetic expression,

if ��� and ��� are arithmetic expressions then � � � ��� is an arithmeticexpression,

� � �

formal definition permits tool support by compiler-compilers,

� descriptions of expected document structures, e.g. DTDs in XML

formal def. facilitates conformance check and automatic decomposition.

You’ll learn

to formally define context-free languages,

to use compiler-compilers based on CFLs.

02140 Languages and Parsing, MF, Fall 2003 – p.16/16

Context-free languages

arise naturally in

� in the definition of programming languages, query lang., etc.:

if � is a natural number then � is an arithmetic expression,

if ��� and ��� are arithmetic expressions then � � � ��� is an arithmeticexpression,

� � �

formal definition permits tool support by compiler-compilers,

� descriptions of expected document structures, e.g. DTDs in XML

formal def. facilitates conformance check and automatic decomposition.

You’ll learn

to formally define context-free languages,

to use compiler-compilers based on CFLs.

02140 Languages and Parsing, MF, Fall 2003 – p.16/16

Context-free languages

arise naturally in

� in the definition of programming languages, query lang., etc.:

if � is a natural number then � is an arithmetic expression,

if ��� and ��� are arithmetic expressions then � � � ��� is an arithmeticexpression,

� � �

formal definition permits tool support by compiler-compilers,

� descriptions of expected document structures, e.g. DTDs in XML

formal def. facilitates conformance check and automatic decomposition.

You’ll learn

� to formally define context-free languages,

� to use compiler-compilers based on CFLs.

02140 Languages and Parsing, MF, Fall 2003 – p.16/16

Recommended