Deterministic Finite Automata - Definition
Deterministic Finite Automata - Definition
- 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
• 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.