Professional Documents
Culture Documents
RV College of
Engineering
By:-
KIRTI NANDAN -1RV18CS071
PRIYANK KUMAR SINGH -1RV18CS122
RV College of
Engineering PROGRAMMING FSMs Go, change the world
CONTENTS:
• Introduction to FSM (Finite State Machine)
• Relevance to our Curriculum
• Technologies & Concepts
• Applications
❑ Text Sentiment Classifier
❑ FSM for Regular Expression
• Conclusion
RV College of
Engineering PROGRAMMING FSMs Go, change the world
Introduction:
A finite state machine is a mathematical abstraction used to design algorithms.
In simpler terms, a state machine will read a series of inputs. When it reads an input, it will switch to a different state.
Each state specifies which state to switch to, for a given input.
The circles are “states” that the machine can be in. The arrows are the transitions. So, if you are in state s and read
an ‘a’, you’ll transition to state q. If you read a ‘b’, you’ll stay in state s. So if we start on s and read the paper tape
above from left to right, we will read the ‘a’ and move to state q.
RV College of
Engineering PROGRAMMING FSMs Go, change the world
Introduction:
A very simple example would be to determine if a page of HTML contains these tags in this order:
The state machine can move to a state that shows it has read the html tag, loop until it gets to the head tag, loop until it gets to
the head close tag, and so on.
Finite state machines can also be used to represent many other systems — such as the mechanics of a parking meter, pop
machine, automated gas pump, hardware logics and embedded programming and many more.
RV College of
Engineering PROGRAMMING FSMs Go, change the world
Introduction:
Deterministic FSM - From any state, there is only one transition for any allowed input. (example shown in previous slide)
Non-Deterministic FSM - Non-deterministic finite state machines are finite state machines where a given input from a
particular state can lead to more than one different state. (example shown beside)
Regular Expressions:
- Regular expressions and finite state machines are functionally equivalent. Anything
you can accept or match with a regular expression, can be accepted or matched with
a state machine.
- The language accepted by finite automata can be easily described by simple
expressions called Regular Expressions. It is the most effective way to represent any
Pattern matching finite state
language. machine
We have studied right from the beginning starting from the basics of Automation, Finite Automata & Regular Language.
These are the building blocks for moving further up the hierarchy of languages (as shown above) for automating more
complex logics and problem solutions.
RV College of
Engineering PROGRAMMING FSMs Go, change the world
The concept of Finite State Machine (FSM) is a building block towards the understanding and
deriving of various other complex and advanced algorithms, emerged and yet emerging
technologies.
The understanding of STATES changing w.r.t. to processed inputs as we have studied in the
beginning chapters of our course, paves the way for programming many hardware logics, event
driven machines,etc.
RV College of
Engineering PROGRAMMING FSMs Go, change the world
• Industrially important Hardware and in a digital circuit, an FSM may be built using
a programmable logic device, a programmable logic controller, logic gates and flip
flops or relays. More specifically, a hardware implementation requires a register to store
state variables, a block of combinational logic that determines the state transition, and a
second block of combinational logic that determines the output of an FSM.
RV College of
Engineering PROGRAMMING FSMs Go, change the world
Applications:
The FSMs are used in designing Compilers, Linguistics Processing, Step workflows, Game Design, Protocols Procedures
(like TCP/IP), Event-driven programming, Conversational AI and many more.
As we discussed so far about the concept of FSM and it’s concept involved in various fields. In order to demonstrate FSM as
to how the changing inputs change the “states” and eventually the outputs, we are considering two examples that we have
worked on:
❑ Text Sentiment Classifier
❑ FSM for Regular Expression
RV College of
Engineering PROGRAMMING FSMs Go, change the world
We want to recognize the meaning of very small sentences with an extremely limited vocabulary and syntax:
● an adjective or
e.g.
Conclusion:
Even though this may not be the most efficient way to implement and build FSM but it is the most
intuitive way indeed. The edges and state transitions, translate well into if and elif statements or the
decision functions, while each state is being modeled as an independent coroutine and we still do
things in a sequential manner.
The entire execution is like a relay race where the baton of execution is being passed from one
coroutine (state) to another.
RV College of
Engineering FAFL (18CS52) Go, change the world
THANKYOU!