SlideShare una empresa de Scribd logo
1 de 25
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente (20)

Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Java script ppt
Java script pptJava script ppt
Java script ppt
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in java
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
Android studio installation
Android studio installationAndroid studio installation
Android studio installation
 
Eclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONEclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATION
 
Composite design pattern
Composite design patternComposite design pattern
Composite design pattern
 
Presentation Spring
Presentation SpringPresentation Spring
Presentation Spring
 
Les Servlets et JSP
Les Servlets et JSPLes Servlets et JSP
Les Servlets et JSP
 
Types of Drivers in JDBC
Types of Drivers in JDBCTypes of Drivers in JDBC
Types of Drivers in JDBC
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Observer design pattern
Observer design patternObserver design pattern
Observer design pattern
 
Struts
StrutsStruts
Struts
 
Io streams
Io streamsIo streams
Io streams
 
REST in AEM by Roy Fielding
REST in AEM by Roy FieldingREST in AEM by Roy Fielding
REST in AEM by Roy Fielding
 
Pros & cons of svelte
Pros & cons of sveltePros & cons of svelte
Pros & cons of svelte
 
Introduction to Eclipse IDE
Introduction to Eclipse IDEIntroduction to Eclipse IDE
Introduction to Eclipse IDE
 
Decision statements in vb.net
Decision statements in vb.netDecision statements in vb.net
Decision statements in vb.net
 
State
StateState
State
 
Object oriented programming 2
Object oriented programming 2Object oriented programming 2
Object oriented programming 2
 

Similar a The State Machine Compiler

Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Servicesmattjive
 
Crushing Latency with Vert.x
Crushing Latency with Vert.xCrushing Latency with Vert.x
Crushing Latency with Vert.xPaulo Lopes
 
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423Giulio Vian
 
Virtual platform
Virtual platformVirtual platform
Virtual platformsean chen
 
PLUG : Presentation Layer Universal Generator
 PLUG : Presentation Layer Universal Generator PLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal GeneratorEmmanuel Fuchs
 
Preparing to program Aurora at Exascale - Early experiences and future direct...
Preparing to program Aurora at Exascale - Early experiences and future direct...Preparing to program Aurora at Exascale - Early experiences and future direct...
Preparing to program Aurora at Exascale - Early experiences and future direct...inside-BigData.com
 
Glomosim adding routing protocol
Glomosim   adding routing protocolGlomosim   adding routing protocol
Glomosim adding routing protocolKathirvel Ayyaswamy
 
DDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkDDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkbanq jdon
 
First Failure Data Capture for your enterprise application with WebSphere App...
First Failure Data Capture for your enterprise application with WebSphere App...First Failure Data Capture for your enterprise application with WebSphere App...
First Failure Data Capture for your enterprise application with WebSphere App...Rohit Kelapure
 
Python Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkPython Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkAljoscha Krettek
 
20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Jorisimec.archive
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.ILEran Harel
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward
 
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0Thomas Conté
 

Similar a The State Machine Compiler (20)

Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Services
 
ECI OpenFlow 2.0 the Future of SDN
ECI OpenFlow 2.0 the Future of SDN ECI OpenFlow 2.0 the Future of SDN
ECI OpenFlow 2.0 the Future of SDN
 
Model_Driven_Development_SDR
Model_Driven_Development_SDRModel_Driven_Development_SDR
Model_Driven_Development_SDR
 
Crushing Latency with Vert.x
Crushing Latency with Vert.xCrushing Latency with Vert.x
Crushing Latency with Vert.x
 
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
Infrastructure as Code in your CD pipelines - London Microsoft DevOps 0423
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
 
Erlang OTP
Erlang OTPErlang OTP
Erlang OTP
 
PLUG : Presentation Layer Universal Generator
 PLUG : Presentation Layer Universal Generator PLUG : Presentation Layer Universal Generator
PLUG : Presentation Layer Universal Generator
 
Preparing to program Aurora at Exascale - Early experiences and future direct...
Preparing to program Aurora at Exascale - Early experiences and future direct...Preparing to program Aurora at Exascale - Early experiences and future direct...
Preparing to program Aurora at Exascale - Early experiences and future direct...
 
Glomosim adding routing protocol
Glomosim   adding routing protocolGlomosim   adding routing protocol
Glomosim adding routing protocol
 
DDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkDDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFramework
 
First Failure Data Capture for your enterprise application with WebSphere App...
First Failure Data Capture for your enterprise application with WebSphere App...First Failure Data Capture for your enterprise application with WebSphere App...
First Failure Data Capture for your enterprise application with WebSphere App...
 
Python Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkPython Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on Flink
 
20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
 
Cloud RPI4 tomcat ARM64
Cloud RPI4 tomcat ARM64Cloud RPI4 tomcat ARM64
Cloud RPI4 tomcat ARM64
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
 
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
 
Eclipse RT Day
Eclipse RT DayEclipse RT Day
Eclipse RT Day
 

Último

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Último (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

The State Machine Compiler

  • 1. SMC The State Machine Compiler (40 ’) François Perrad francois.perrad@gadz.org fperrad@OSDC.fr2009
  • 2. The State Machine Compiler  Introduction  Basic concepts  Advanced concepts  More features  A case study : a Telephone  Conclusion fperrad@OSDC.fr2009
  • 3. 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
  • 4. FSM graphical view  Moore  Mealy  Grafcet  UML = Harel statechart fperrad@OSDC.fr2009
  • 5. 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
  • 6. The State Machine Compiler  Introduction  Basic concepts  Advanced concepts  More features  A case study : a Telephone  Conclusion fperrad@OSDC.fr2009
  • 7. 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
  • 8. A Simple Transition // State  Idle { // Trans  Next State Actions  Run  Running  {}  }  fperrad@OSDC.fr2009
  • 9. A Reflexive Transition // State  Idle {  // Trans  Next State  Actions  Timeout  Idle  {}  }  fperrad@OSDC.fr2009
  • 10. A Internal Event // State Idle {  // Trans  Next State  Actions  Timeout  nil  {}  }  fperrad@OSDC.fr2009
  • 11. A Transition with Actions // State  Idle  {  // Trans  Run  // Next State  Running  // Actions  {      StopTimer("Idle");      DoWork();  }  }  fperrad@OSDC.fr2009
  • 12. Transition Guards // State  Idle  {      // Trans      Run  // Guard condition  [ctxt.isValid()]  // Next State  Running  // Actions  {      StopTimer("Idle");      DoWork();  }      Run  Idle  { RejectRequest(); }  }  fperrad@OSDC.fr2009
  • 13. 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
  • 14. Entry and Exit Actions // State  Idle  Entry { StartTimer("Idle", 1); CheckQueue(); }  Exit { StopTimer("Idle"); }  {  // Transitions  }  fperrad@OSDC.fr2009
  • 15. the State Machine Compiler  Introduction  Basic concepts  Advanced concepts  More features  A case study : a Telephone  Conclusion fperrad@OSDC.fr2009
  • 16. 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
  • 17. The Design Pattern fperrad@OSDC.fr2009
  • 18. the State Machine Compiler  Introduction  Basic concepts  Advanced concepts  More features  A case study : a Telephone  Conclusion fperrad@OSDC.fr2009
  • 19. More features  Event management is yours  Graphviz output generation  HTML table generation  Dynamic trace  Namespace support  Reflection/Introspection (for MMI) fperrad@OSDC.fr2009
  • 20. Graphviz output fperrad@OSDC.fr2009
  • 21. the State Machine Compiler  Introduction  Basic concepts  Advanced concepts  More Features  A case study : a Telephone  Conclusion fperrad@OSDC.fr2009
  • 22. A Telephone  Go to the WEB  Play with the demo (Applet Java) @ http://smc.sourceforge.net/SmcDemo.htm fperrad@OSDC.fr2009
  • 23. the State Machine Compiler  Introduction  Basic concepts  Advanced concepts  More Features  A case study : a Telephone  Conclusion fperrad@OSDC.fr2009
  • 24. all contributions welcomed  Eclipse plugin  Debian packaging  Pluggable language support  New target language  Regression test  … fperrad@OSDC.fr2009
  • 25. 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