Skip to content

Releases: simoneCavalleri/fsmc

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 26 Aug 18:53

What's Changed in v0.3.0

fsmc v0.3.0 introduces major real-time embedded runtime enhancements, static abstract interpretation for Extended Finite State Machines (EFSM), automated Requirement Traceability Matrix (RTM) generation, and a comprehensive overhaul of the documentation and design pattern cookbooks.


🚀 Key Highlights & New Features

1. Lock-Free & Wait-Free SPSC Runtime Engine (fsm::spsc_fsm)

  • Wait-Free O(1) Producer: Designed for Interrupt Service Routines (ISRs) and hard real-time tasks (ARM Cortex-M, RISC-V, FreeRTOS). Pushing events (enqueue) never allocates dynamic memory, never spins on mutexes, and executes in bounded CPU cycles.
  • Sequential RTOS Consumer: Dedicated process_one() and run_until_empty() dispatch loop.
  • Seqlock Context Snapshots: High-frequency telemetry or watchdog tasks can read consistent context snapshots (snapshot_context()) without blocking producers or consumers.

2. EFSM Data Path Interval Analysis (EFSMIntervalAnalyzer)

  • Static abstract interpretation engine based on interval lattices [lo, hi] propagating numerical variable bounds forward across reachable state paths.
  • Statically detects unreachable transition branches and unsatisfiable guards (W_EFSM_UNSATISFIABLE_GUARD) prior to code generation.

3. Requirement Traceability Matrix (RTM) Audit Reports

  • Full audit trail linking @fsm:req annotations in SysML / UML diagrams to covered states, transitions, and formal verification outcomes.
  • Added CLI flags --rtm-output <file> and --rtm-format <json|md> for CI/CD compliance validation.

4. Automatic Resolved Guard & Action Code Generation

  • Statechart boolean conditions (e.g. [batteryLevel >= 20.0 and isGpsLocked]) and assignments (e.g. do waypointIndex += 1;) are automatically parsed, type-checked, and emitted as direct C++ expressions without requiring manual stub implementations.

5. Transition Flight Recorder & Telemetry (dispatch_result)

  • dispatch_result now embeds transition_trace metadata capturing source state, target state, event, guard evaluation, and action execution for real-time diagnostics.

6. Formal Middle-End ChoiceInliningPass

  • Automates Cartesian product flattening for StateKind::Choice and StateKind::Junction nodes on the intermediate representation (FsmIr).
  • Inlines decision trees into direct composite transitions guarded by fsm::and_.

7. Documentation Overhaul & Architectural Cookbooks

  • Reorganized official documentation with clear engineering-focused principles.
  • Added Architectural Design Patterns Cookbook with 4 real-world production recipes (Hardware Sensor ISR, Hierarchical UAV Mission Controller, Network Protocol Parser, Multi-FSM Coordination).

💥 Breaking Changes & Migration

  • Consolidated Thread-Safe Runtimes: Deprecated legacy standalone aliases in favor of fsm::spsc_fsm (for ISR / lock-free single-producer single-consumer queues) and fsm::thread_safe_fsm (for multi-threaded MPSC queues with asynchronous futures).

🧪 Verification & Quality

  • Test Suite: 51/51 GoogleTest unit and integration test suites passing (100% pass rate).
  • Compliance: Zero memory leaks (-fsanitize=address,undefined), -Werror, and clang-format compliant.

Full Changelog: v0.2.0...v0.3.0

Full Changelog: v0.2.0...v0.3.0

Full Changelog: v0.2.0...v0.3.0

Full Changelog: v0.2.0...v0.3.0

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 26 Aug 14:23

What's Changed in v0.2.0

fsmc v0.2.0 marks a major milestone, transforming fsmc into a comprehensive universal state machine compiler toolchain. This release introduces formal model checking (LTL/CTL), multi-format bidirectional transpilation across 7 diagram and MBSE formats, Hierarchical State Machine (HFSM) history recovery, and an interactive WebAssembly playground.


🚀 Key Highlights & New Features

1. Formal Model Checking & Symbolic Verification (LTL & CTL)

  • Mathematical Invariant Verification: Built-in verification engine validating safety, liveness, and reachability properties against Kripke state transition graphs.
  • Temporal Logic Operators: Full support for Linear Temporal Logic (LTL) and Computation Tree Logic (CTL) formulas (G, F, X, U, ->).
  • nuXmv / SMV Formal Emitter: Automatic generation of clean, verifiable SMV symbolic models with discrete clock variables and temporal specifications.

2. Hierarchical State Machines (HFSM) & History Pseudostates

  • Nested Composite Submachines: Multi-level state hierarchy with parent transition inheritance and automated entry/exit cascades.
  • Shallow [H] & Deep [H*] History: Restores previous active sub-state configurations upon re-entering composite states.

3. Universal Multi-Format Parser & Transpiler Pipeline

  • High-Semantics Formal Frontends:
    • OMG SysML v2 (native textual .sysml grammar).
    • Cameo / MagicDraw (OMG XMI 2.1 schema).
    • W3C SCXML (State Chart XML Recommendation).
  • Visual Diagram Sketch Frontends:
    • PlantUML (@startuml), Mermaid (stateDiagram-v2), Graphviz DOT, and XState JSON.
  • Lossless Roundtrip Transpilation: Convert diagrams seamlessly between any supported format via the canonical Intermediate Representation (FsmIr).

4. Zero-Alloc C++17 & C++20 Code Generators

  • Header-Only Static Dispatch: Emits zero-heap, vtable-free state machine code using compile-time fold expressions.
  • Standalone Single-Header Bundler: Generates self-contained .hpp files with zero external dependencies via --standalone.
  • Async & Thread-Safe Engine: fsm::thread_safe_fsm with concurrent multi-producer queues and std::future promises.

5. Rich Compiler Diagnostics Engine (DiagnosticEngine)

  • Colored terminal diagnostics with source code line spans, visual error carets (^~~~~), and actionable suggestions for common modeling errors.

6. Interactive WebAssembly Playground

  • In-browser live playground powered by fsmc.wasm enabling real-time editing, visualization, formal verification, and C++ compilation directly in the browser.

🧪 Verification & Test Coverage

  • 49 GoogleTest modular test suites covering runtime, parsers, IR transformations, model checkers, and emitters (100% passing).
  • Comprehensive examples included (Aerospace Satellite Mission Controller, Automotive Motor ECU, Connection Manager).

Full Changelog: v0.1.0...v0.2.0

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 24 Aug 22:52

What's Changed in v0.1.0 — Initial Public Release

fsmc (Finite State Machine Compiler) is an open-source compiler toolchain that parses statechart models from MBSE and diagram specifications (SysML v2, PlantUML, Mermaid, SCXML, JSON, DOT) and generates deterministic, zero-allocation C++17 and C++20 header-only state machine code.


🚀 Key Features & Capabilities

1. Zero-Overhead C++ Runtime Engine (include/fsm/runtime/cpp/)

  • Static Compile-Time Table Dispatch: Transition tables are resolved at compile time using template metaprogramming fold expressions with zero dynamic memory allocation and zero virtual function (vtable) lookups.
  • Deterministic Memory Footprint: Minimal object size (sizeof(fsm) = sizeof(Context*) + sizeof(state_id_t)), strictly suitable for bare-metal microcontrollers (ARM Cortex-M, RISC-V) and hard real-time systems.
  • Compile-Time Hook Detection: SFINAE duck-typing invoking on_entry, on_exit, guards, and transition actions only when defined, without requiring base class inheritance.
  • Discrete Deterministic Timers: deterministic_timer_manager for tick-based relative timeouts without background OS threads.

2. Canonical Intermediate Representation (FsmIr)

  • Strongly-typed hierarchical AST capturing states, transition triggers (signals, timeouts), composite boolean guard trees (and_, or_, not_), context variables, and metadata.
  • Deterministic 64-bit FNV-1a hashing for order-invariant reproducible identifiers.

3. Multi-Format Model Ingestion

  • Parsers for OMG SysML v2, PlantUML (@startuml), Mermaid stateDiagram-v2, W3C SCXML, Graphviz DOT, and XState JSON.
  • Renderer-safe @fsm: comment directives for lossless visual diagram enrichment.

4. Middle-End Optimizer & Diagnostics

  • Modular PassManager pipeline featuring canonicalization, dead state pruning, determinism validation, and guard algebraic simplification.
  • Rich terminal diagnostic reporting with ANSI colors, line spans, and visual error carets.

5. Command-Line Tools & Build Integration

  • fsmc: Main compiler driver for single-file and standalone C++ code generation.
  • fsm-opt: Standalone IR optimizer, static linter, and diagram format converter.
  • Full build system integration via CMake (find_package(fsmc)), Conan, and vcpkg.

🧪 Test & Verification

  • 39 modular GoogleTest suites with 100% pass rate.
  • Production showcase examples: Connection Manager, Satellite Mission Controller, Automotive Motor ECU.