0% found this document useful (0 votes)
89 views8 pages

Deterministic Finite Automata - Definition

The document defines a Deterministic Finite Automaton (DFA) as consisting of a finite set of states Q, a finite alphabet of input symbols Σ, a start state q0, a set of accepting states F, and a transition function δ. It explains that a DFA reads an input string and determines whether it is acceptable by starting at the start state, computing the next state based on the current state and input symbol using the transition function, and accepting the string if the final state is an accepting state. Regular languages are those recognized by DFAs. An example is provided of building a DFA to recognize strings containing the substring "01".

Uploaded by

Muhammad Fayaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views8 pages

Deterministic Finite Automata - Definition

The document defines a Deterministic Finite Automaton (DFA) as consisting of a finite set of states Q, a finite alphabet of input symbols Σ, a start state q0, a set of accepting states F, and a transition function δ. It explains that a DFA reads an input string and determines whether it is acceptable by starting at the start state, computing the next state based on the current state and input symbol using the transition function, and accepting the string if the final state is an accepting state. Regular languages are those recognized by DFAs. An example is provided of building a DFA to recognize strings containing the substring "01".

Uploaded by

Muhammad Fayaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Deterministic Finite Automata

- Definition
A Deterministic Finite Automaton (DFA)
consists of:
Q ==> a finite set of states
Σ ==> a finite set of input symbols (alphabet)
q0 ==> a start state
F ==> set of accepting states
δ ==> a transition function, which is a mapping
between Q x Σ ==> Q
A DFA is defined by the 5-tuple:
{Q Σ q F δ }
What does a DFA do on reading an input string?
• Input: a word w in Σ*
• Question: Is w acceptable by the DFA?
• Steps:
• Start at the “start state” q0
• For every input symbol in the sequence w do
Compute the next state from the current state, given
the current input symbol in w and the transition
function
• If after all symbols in w are consumed, the current
• state is one of the accepting states (F) then accept
• w; Otherwise, reject w.
Regular Languages

• Let L(A) be a language recognized by a


• DFA A.
• Then L(A) is called a “Regular Language”.
Example #1
• Build a DFA for the following language:
• L = {w | w is a binary string that contains 01 as a
substring}
• Steps for building a DFA to recognize
• L: Σ = {0,1}
• Decide on the states: Q
• Designate start state and final state(s)
• δ: Decide on the transitions:
• “Final” states == same as “accepting states”
• Other states == same as “non-accepting states”
Regular expression: (0+1)*01(0+1)*
DFA for strings containing 01
Syntax Analysis ( Parsing)
• Phases of a Compiler
Parsing Overview

• What is syntax ?
• The way in which words are put together to form
phrases, or sentences.
• The function of a parser :
• Input: sequence of tokens from lexical analyzer
• Output: parse tree of the program
• The parser checks the stream of words (tokens) and
their parts of speech for grammatical correctness.
• It determines if the input is syntactically well
formed.
• It guides context sensitive (“semantic”) analysis
(type checking).
• The parser ensures that sentences of a
programming language that make up a program
abide by the syntax of the language.
• If there are errors, the parser will detect them and
reports them accordingly.

You might also like