SlideShare a Scribd company logo
SMC
The State Machine Compiler               (40 ’)




  François Perrad
  francois.perrad@gadz.org




                   fperrad@OSDC.fr2009
The State Machine Compiler
   Introduction
   Basic concepts
   Advanced concepts
   More features
   A case study : a Telephone
   Conclusion



                 fperrad@OSDC.fr2009
FSM are everywhere
   FSM : Finite State Machine
   Not a new technology
   Strong theorical base
   Reactive systems / Transformational
    systems
   Event driven
   Applications :
       Telephones, automobiles, communication
        networks, avionic systems, man-machine
        interface

                  fperrad@OSDC.fr2009
FSM graphical view
   Moore
   Mealy
   Grafcet
   UML = Harel statechart




                  fperrad@OSDC.fr2009
A SourceForge project
   Some facts :
       registered in 2000
       ~500 downloads / month
       ~100 bugs (closed)
       written in Java
       mature codebase
       well documented
       3 developers
       Licence MPL

   See :
    http://www.ohloh.net/projects/7339?p=SMC

                     fperrad@OSDC.fr2009
The State Machine Compiler
   Introduction
   Basic concepts
   Advanced concepts
   More features
   A case study : a Telephone
   Conclusion



                 fperrad@OSDC.fr2009
A Compiler
   A input source .sm (yacc-like syntax)
   A output source (readable) in your language
   Currently 14 target languages :
       C, C++, C#, Groovy, Java, Lua, Objective-C, Perl, PHP,
        Python, Ruby, Scala, Tcl and VB.net
   An Object Oriented design :
       your class has a member which is the FSM generated class
   A small RunTime Library
   Parser & Lexer of SMC are written with SMC
   The root of SMC is ATN (Augmented Transition
    Network)
   Robert C. Martin (uncle bob) is the author of the
    initial SMC implementation
                           fperrad@OSDC.fr2009
A Simple Transition
// State 
Idle {
   // Trans    Next State        Actions 
   Run         Running           {} 
} 




                 fperrad@OSDC.fr2009
A Reflexive Transition
// State 
Idle { 
   // Trans    Next State  Actions 
   Timeout     Idle        {} 
} 




                 fperrad@OSDC.fr2009
A Internal Event
// State
Idle { 
   // Trans    Next State  Actions 
   Timeout     nil         {} 
} 




                 fperrad@OSDC.fr2009
A Transition with Actions
// State 
Idle 
{ 
   // Trans 
   Run 
      // Next State 
      Running 
             // Actions 
             { 
                 StopTimer("Idle"); 
                 DoWork(); 
             } 
} 



                     fperrad@OSDC.fr2009
Transition Guards
// State 
Idle 
{ 
    // Trans 
    Run 
    // Guard condition 
    [ctxt.isValid()] 
       // Next State 
       Running 
              // Actions 
              { 
                  StopTimer("Idle"); 
                  DoWork(); 
              } 

    Run       Idle    { RejectRequest(); } 
} 
                        fperrad@OSDC.fr2009
Transition Arguments
// State 
Idle 
{ 
    // Transition 
    Run(msg: const Message&) 
    // Guard condition 
    [msg.isValid()] 
        // Next State 
        Running 
       // Actions 
       { 
           StopTimer("Idle"); 
           DoWork(msg); 
       } 
    Run(msg: const Message&) 
        // Next State Actions 
        Idle          { RejectRequest(msg); } 
} 
                          fperrad@OSDC.fr2009
Entry and Exit Actions
// State 
Idle 
Entry { StartTimer("Idle", 1); CheckQueue(); } 
Exit { StopTimer("Idle"); } 
{ 
   // Transitions 

} 




                     fperrad@OSDC.fr2009
the State Machine Compiler
   Introduction
   Basic concepts
   Advanced concepts
   More features
   A case study : a Telephone
   Conclusion



                 fperrad@OSDC.fr2009
Advanced Features
   Map : state container
       only one level (multiple with UML)
   Push/Pop
       with stack context
       see UML History
   Default state
        factorisation of common behavior
        in a map
   No concurrency (ie //)
                 fperrad@OSDC.fr2009
The Design Pattern




       fperrad@OSDC.fr2009
the State Machine Compiler
   Introduction
   Basic concepts
   Advanced concepts
   More features
   A case study : a Telephone
   Conclusion



                 fperrad@OSDC.fr2009
More features
   Event management is yours
   Graphviz output generation
   HTML table generation
   Dynamic trace
   Namespace support
   Reflection/Introspection (for MMI)




               fperrad@OSDC.fr2009
Graphviz output




       fperrad@OSDC.fr2009
the State Machine Compiler
   Introduction
   Basic concepts
   Advanced concepts
   More Features
   A case study : a Telephone
   Conclusion



               fperrad@OSDC.fr2009
A Telephone
   Go to the WEB
   Play with the demo (Applet Java)
@   http://smc.sourceforge.net/SmcDemo.htm




                   fperrad@OSDC.fr2009
the State Machine Compiler
   Introduction
   Basic concepts
   Advanced concepts
   More Features
   A case study : a Telephone
   Conclusion



                 fperrad@OSDC.fr2009
all contributions welcomed
   Eclipse plugin
   Debian packaging
   Pluggable language support
   New target language
   Regression test
   …




                fperrad@OSDC.fr2009
Bibliography / Webography
- SMC : http://smc.sourceforge.net/
- Robert C. Martin, "Agile Software Development"
- http://en.wikipedia.org/wiki/Finite_state_machine
- http://en.wikipedia.org/wiki/Statechart
- D. Harel, "Statecharts: A Visual Formalism for Complex
     Systems"
- http://www.uml.org/
- http://fr.wikipedia.org/wiki/Grafcet
- NF C03-190 - Diagramme fonctionnel "GRAFCET"
- http://en.wikipedia.org/wiki/Augmented_transition_network




                         fperrad@OSDC.fr2009

More Related Content

What's hot (20)

PPTX
Opera
dimitrieelol
 
PPTX
09. bachov apsolutizam
ViceMatuan
 
PPTX
Napoleonov slom i bečki kongres
Vale Shau
 
PPT
34.доба великих
Šule Malićević
 
PPT
Antun Branko Šimic - Antonia Oršolić
Privatna srednja ekonomska skola INOVA s pravom javnosti
 
PPT
Rusija i poljska u 18. stoljeću
batica1
 
PPT
Hrvatski narodni preporod – ilirski pokret
batica1
 
PPTX
Srpsko turski ratovi.pptx
MarinaJankoviExStojk
 
PPTX
SDL2の紹介
nyaocat
 
PPTX
Hrvatska u antifašističkoj_borbi
Privatna jezično-informatička gimnazija "Svijet"
 
PPTX
HRVATSKO -UGARSKA NAGODBA.pptx
AMos96
 
PPTX
Sarajevski atentat
zoricahelac
 
PPTX
Ustroj vojne krajine 2.0
Vale Shau
 
PPTX
Deepcheck, 딥러닝 기반의 얼굴인식 출석체크
지운 배
 
PPT
Slavenske države i rubni narodi
batica1
 
PPT
Sveto rimsko carstvo u 18. stoljeću
Privatna jezično-informatička gimnazija "Svijet"
 
PDF
Ponašanje potrošača
Ekonomski portal
 
PPTX
Dinko Šimunović duga
Patrik Sabolić
 
09. bachov apsolutizam
ViceMatuan
 
Napoleonov slom i bečki kongres
Vale Shau
 
34.доба великих
Šule Malićević
 
Antun Branko Šimic - Antonia Oršolić
Privatna srednja ekonomska skola INOVA s pravom javnosti
 
Rusija i poljska u 18. stoljeću
batica1
 
Hrvatski narodni preporod – ilirski pokret
batica1
 
Srpsko turski ratovi.pptx
MarinaJankoviExStojk
 
SDL2の紹介
nyaocat
 
Hrvatska u antifašističkoj_borbi
Privatna jezično-informatička gimnazija "Svijet"
 
HRVATSKO -UGARSKA NAGODBA.pptx
AMos96
 
Sarajevski atentat
zoricahelac
 
Ustroj vojne krajine 2.0
Vale Shau
 
Deepcheck, 딥러닝 기반의 얼굴인식 출석체크
지운 배
 
Slavenske države i rubni narodi
batica1
 
Sveto rimsko carstvo u 18. stoljeću
Privatna jezično-informatička gimnazija "Svijet"
 
Ponašanje potrošača
Ekonomski portal
 
Dinko Šimunović duga
Patrik Sabolić
 

Similar to The State Machine Compiler (20)

PPT
Open Source XMPP for Cloud Services
mattjive
 
PPTX
ECI OpenFlow 2.0 the Future of SDN
ECI – THE ELASTIC NETWORK™
 
PDF
Model_Driven_Development_SDR
ADLINK Technology IoT
 
PDF
Crushing Latency with Vert.x
Paulo Lopes
 
PPTX
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Giulio Vian
 
PPT
Virtual platform
sean chen
 
PPT
Erlang OTP
Zvi Avraham
 
PDF
Preparing to program Aurora at Exascale - Early experiences and future direct...
inside-BigData.com
 
PDF
Glomosim adding routing protocol
Kathirvel Ayyaswamy
 
PPT
DDD Framework for Java: JdonFramework
banq jdon
 
PPT
First Failure Data Capture for your enterprise application with WebSphere App...
Rohit Kelapure
 
PPTX
Python Streaming Pipelines with Beam on Flink
Aljoscha Krettek
 
PPT
20081114 Friday Food iLabt Bart Joris
imec.archive
 
PPTX
C Programming Language Tutorial for beginners - JavaTpoint
JavaTpoint.Com
 
PPTX
Ob1k presentation at Java.IL
Eran Harel
 
PDF
Cloud RPI4 tomcat ARM64
Jean-Frederic Clere
 
PDF
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward
 
PPTX
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
Thomas Conté
 
PPT
Eclipse RT Day
Brett Hackleman
 
ODP
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Marcelo Gornstein
 
Open Source XMPP for Cloud Services
mattjive
 
ECI OpenFlow 2.0 the Future of SDN
ECI – THE ELASTIC NETWORK™
 
Model_Driven_Development_SDR
ADLINK Technology IoT
 
Crushing Latency with Vert.x
Paulo Lopes
 
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Giulio Vian
 
Virtual platform
sean chen
 
Erlang OTP
Zvi Avraham
 
Preparing to program Aurora at Exascale - Early experiences and future direct...
inside-BigData.com
 
Glomosim adding routing protocol
Kathirvel Ayyaswamy
 
DDD Framework for Java: JdonFramework
banq jdon
 
First Failure Data Capture for your enterprise application with WebSphere App...
Rohit Kelapure
 
Python Streaming Pipelines with Beam on Flink
Aljoscha Krettek
 
20081114 Friday Food iLabt Bart Joris
imec.archive
 
C Programming Language Tutorial for beginners - JavaTpoint
JavaTpoint.Com
 
Ob1k presentation at Java.IL
Eran Harel
 
Cloud RPI4 tomcat ARM64
Jean-Frederic Clere
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward
 
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
Thomas Conté
 
Eclipse RT Day
Brett Hackleman
 
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Marcelo Gornstein
 
Ad

Recently uploaded (20)

PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PPTX
Wondershare Filmora Crack Free Download 2025
josanj305
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Survival Models: Proper Scoring Rule and Stochastic Optimization with Competi...
Paris Women in Machine Learning and Data Science
 
PDF
Home Cleaning App Development Services.pdf
V3cube
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Wondershare Filmora Crack Free Download 2025
josanj305
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Survival Models: Proper Scoring Rule and Stochastic Optimization with Competi...
Paris Women in Machine Learning and Data Science
 
Home Cleaning App Development Services.pdf
V3cube
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Ad

The State Machine Compiler