aconchillo / guile-smc

GNU Guile State Machine Compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Guile-SMC

https://github.com/artyom-poptsov/guile-smc/actions/workflows/guile2.2.yml/badge.svg

GNU Guile state machine compiler.

License

Guile-SMC is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Please see COPYING file for the terms of GNU General Public License.

Usage

PlantUML (http://www.plantuml.com/) state machine compiler:

(let ((fsm (puml->fsm (current-input-port))))
  (format #t "output fsm: ~a~%" fsm)
  (format #t "transition table:~%")
  (pretty-print
   (hash-table->transition-list (fsm-transition-table fsm))
   #:display? #t)))

State machine validation:

(let ((fsm (puml->fsm (current-input-port)))
  (format #t "validation report:~%")
  (pretty-print (fsm-validate fsm)))

Want more finite-state machines? Now you can generate a FSM from the PlantUML format that reads a FSM in the PlantUML format – see examples/pumlpuml.scm.

Also see other examples the examples directory.

If you still wonder if there any practical use of that, please take a look at Guile-INI: https://github.com/artyom-poptsov/guile-ini

Ideas

  • Write a PlantUML generator that take a <fsm> instance and produces a PlantUML state diagram.
  • I think it’s possible to implement some FSM profiling facilities that will, for example, measure how much time it takes to go from the entry state of an FSM to an end state and calculate how much time an FSM spends in each state. This measurements can be used to optimize an FSM.
  • Produce a timing diagram based on FSM log output in PlantUML format. That would help with analyzing and optimizing an FSM. It could be implemented in the smc compiler as part of state machine benchmark suite.
  • It is possible to add compilation to other languages aside from Scheme, but it will be quite hard to implement indeed.

About

GNU Guile State Machine Compiler

License:GNU General Public License v3.0


Languages

Language:Scheme 59.0%Language:M4 22.0%Language:Makefile 11.1%Language:Shell 7.4%Language:Emacs Lisp 0.5%