{"id":46623840,"url":"https://github.com/cpslabgu/swift-fsmlib","last_synced_at":"2026-03-07T22:01:00.888Z","repository":{"id":190535092,"uuid":"677239366","full_name":"CPSLabGU/swift-fsmlib","owner":"CPSLabGU","description":"Library for logic-labelled finite-state machines","archived":false,"fork":false,"pushed_at":"2026-02-24T03:25:17.000Z","size":1366,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-24T07:40:07.681Z","etag":null,"topics":["finite-state-machine","fsms","llfsm","model-driven-development"],"latest_commit_sha":null,"homepage":"https://cpslabgu.github.io/swift-fsmlib/documentation/fsm/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CPSLabGU.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-08-11T04:38:46.000Z","updated_at":"2026-01-22T21:31:37.000Z","dependencies_parsed_at":"2023-12-24T01:28:58.415Z","dependency_job_id":"089bd699-f5ff-4913-acc7-95b65fbc2851","html_url":"https://github.com/CPSLabGU/swift-fsmlib","commit_stats":null,"previous_names":["cpslabgu/swift-fsmlib"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CPSLabGU/swift-fsmlib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CPSLabGU%2Fswift-fsmlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CPSLabGU%2Fswift-fsmlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CPSLabGU%2Fswift-fsmlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CPSLabGU%2Fswift-fsmlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CPSLabGU","download_url":"https://codeload.github.com/CPSLabGU/swift-fsmlib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CPSLabGU%2Fswift-fsmlib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30233429,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T19:01:10.287Z","status":"ssl_error","status_checked_at":"2026-03-07T18:59:58.103Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["finite-state-machine","fsms","llfsm","model-driven-development"],"created_at":"2026-03-07T22:01:00.427Z","updated_at":"2026-03-07T22:01:00.880Z","avatar_url":"https://github.com/CPSLabGU.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swift-fsmlib\n\nA cross-platform Swift library for Logic-Labelled Finite-State Machines\n(LLFSMs) and FSM conversion tools.\n\n## Overview\n\n`swift-fsmlib` provides robust, type-safe tools for defining, analysing,\nserialising, and converting finite-state machines. It supports both\nmacOS and Linux and is designed for research and production use.\n\n- **FSM**: Core framework for state machines, including states,\n  transitions, state activities, language bindings, and code generation.\n- **fsmconvert**: Command-line tool for converting machines between\n  language formats and creating arrangements from multiple FSMs.\n- **SCXML Support**: Full round-trip conversion between directory-based `.machine` and single-file `.scxml` formats.\n\n## Features\n\n- Type-safe state and transition definitions with UUID-based identifiers\n- Logic-Labelled FSM model with Boolean transition expressions\n- Suspend and resume support for interruptible state machines\n- C and Objective-C++ language bindings with code generation\n- Arrangements for composing multiple FSMs into coordinated systems\n- CMake build system integration for generated code\n- Layout and geometry types for graphical FSM editors\n- Round-trip serialisation via `.machine`, `.arrangement`, and `.scxml` formats\n- Multi-namespace SCXML compatible with ScxmlEditor, Qt Creator, and other tools\n\n## Installation\n\nAdd `swift-fsmlib` as a dependency in your `Package.swift`:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/CPSLabGU/swift-fsmlib.git\", from: \"1.0.0\")\n]\n```\n\nThen add `FSM` as a target dependency:\n\n```swift\n.target(\n    name: \"YourTarget\",\n    dependencies: [\n        .product(name: \"FSM\", package: \"swift-fsmlib\")\n    ]\n)\n```\n\n## Quick Start\n\n```swift\nimport FSM\n\n// Define states\nlet red = State(name: \"Red\")\nlet green = State(name: \"Green\")\n\n// Define transitions with Boolean expressions\nlet toGreen = Transition(label: \"after_ms(5000)\", source: red.id, target: green.id)\nlet toRed = Transition(label: \"after_ms(5000)\", source: green.id, target: red.id)\n\n// Create a logic-labelled FSM\nlet fsm = LLFSM(states: [red, green], transitions: [toGreen, toRed])\n\nprint(\"States: \\(fsm.stateNames)\")\nprint(\"Initial state: \\(fsm.initialState)\")\n```\n\n## Using fsmconvert\n\nConvert a machine to a different language format:\n\n```bash\nswift run fsmconvert MyMachine.machine -f c -o MyMachine_C.machine\n```\n\nConvert a machine to SCXML format:\n\n```bash\nswift run fsmconvert MyMachine.machine -f scxml -o MyMachine.scxml\n```\n\nCreate an arrangement from multiple machines:\n\n```bash\nswift run fsmconvert Machine1.machine Machine2.machine -a -o System.arrangement\n```\n\nRun with verbose output:\n\n```bash\nswift run fsmconvert MyMachine.machine -v -o output.machine\n```\n\n## Examples\n\nThe `examples/` directory contains pre-built machines and arrangements:\n\n- `Counter.machine` / `CounterC.machine` / `CounterCPP.machine`:\n  Basic counter FSMs in different language formats.\n- `SuspendCounter.machine` / `SuspendCounterC.machine`:\n  Suspensible counter FSMs demonstrating suspend and resume.\n- `SuspendCounter.arrangement` / `Counter.arrangement`:\n  Multi-machine arrangements.\n\nSee `examples/README.md` for detailed descriptions.\n\n## Documentation\n\nGenerate DocC documentation locally:\n\n```bash\nswift package generate-documentation\n```\n\nPreview the documentation in a browser:\n\n```bash\nswift package --disable-sandbox preview-documentation --target FSM\n```\n\nThe documentation includes:\n- API reference for all public types and functions\n- Conceptual articles on architecture, language bindings, and\n  arrangement design\n- Hands-on tutorials for getting started, working with examples,\n  and using fsmconvert\n\n## Licence\n\nCopyright \u0026copy; 2015, 2016, 2023, 2025 Rene Hexel. All rights reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpslabgu%2Fswift-fsmlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcpslabgu%2Fswift-fsmlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpslabgu%2Fswift-fsmlib/lists"}