[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ANN] Guile-SMC 0.6.0 released

From: Artyom V. Poptsov
Subject: [ANN] Guile-SMC 0.6.0 released
Date: Sun, 30 Apr 2023 21:58:08 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hello Guilers,

I'm pleased to announce Guile State Machine Compiler (Guile-SMC), version

This release improves the common context code for FSMs and drops support
for "guile-standalone-copy" compilation target.  See the full list of
user-visible changes below.

* What is Guile-SMC?

Guile-SMC is a state machine compiler that allows to describe finite
state machines (FSMs) in Scheme in terms of transition tables.  It is
capable to generate such transition tables from a PlantUML state
diagrams. [1]

Some of the key features:
- A transition table can be verified and checked for dead-ends and
  infinite loops.
- Guile-SMC FSMs gather statistics when they run (steps/transitions);
  the statistics can be used can be used to compare/analyze FSMs..
- There's an FSM profiler that runs on FSMs trace logs.  The profiler
  output shows how much time the FSM spends in each state.  This can be
  useful for optimization.
- The state machine compiler supports three "targets" for compilation: a
  regular "guile" target where the output FSM depends on Guile-SMC;
  "guile-standalone" target that produce an FSM that does not depend on
- Guile-SMC allows to run a FSM on-the-fly with a single "smc run"
  command -- see the docs and the examples for more information.
- Common context code for parsers that work with characters or bytes.
  This includes special data structures to provide memory for FSMs
  (although it is not required to use them; FSMs can use custom
  procedures and data structures.)

Guile-SMC comes with a Scheme program called 'smc' -- a state machine
compiler itself.  It produces a Scheme code for an FSM from the PlantUML
format.  This tool is meant to be called on a PlantUML file when a
program with a FSM is being built (for example, from a Makefile.)

I'm hoping that it will ease the burden of writing format parsers and
other useful GNU Guile libraries for the community.

* User-visible changes

--8<---------------cut here---------------start------------->8---
* Version 0.6.0 (2023-04-30)
** New context implementation                                    :API_CHANGE:
New FSM context implementation consists of three modules that contain
implementation of common actions/guards:
- =(smc context common)= -- Common actions/guards.
- =(smc context char)= -- Guards for a stream of characters.
- =(smc context u8)= -- Guards for a stream of bytes.

Also there are now two types of structures that provide memory for an FSM:
- =(smc context functional ...)= -- FSM context based on =(srfi srfi-9 gnu)=
- =(smc context oop ...)= -- FSM context based on =(oop goops)=.
** Drop the support for =guile-standalone-copy= target           :API_CHANGE:
It seems that only two targets are reasonable to keep for now: =guile= (which
produces code that depends on Guile-SMC) and =guile-standalone= (which
produces code that does not depend on Guile-SMC and mimic hand-crafted FSM

Extra compilation targets are adding extra maintenance burden so I'd prefer to
focus my somewhat limited resources on those that make sense in the long run.
** =<fsm>= now supports "pre-actions" and "post-actions"
The class slots can be set with "#:pre-action" and "#:post-action" keyword
parameters in the class constructor.

"pre-action" is a global action that is performed on a context and event
before all the other guards and actions.

"post-action" is a global action that is performed on a context and event
after all the other guards and actions are executed in a chain.

By default both actions are procedures that return a context as is.
** =smc compile= and =smc context= now support "--guile-smc-path"
The option sets the path where Guile-SMC core modules are stored.  E.g.:
** =smc context=
*** New option: "--type", "-T"
This option allows to specify context type for the output context when an
intermediate context is generated.
** =smc run=: Remove the deprecated "--log-file= option           :API_CHANGE:
** =smc profile= now allow to print data in JSON format
** =smc=: Improve the "--debug" mode
Now when the debug mode is enabled =smc= will not enable stderr logging.  To
enable logging to stderr in addition to the regular logging drivers, there's
now logger option "stderr" that can be used to enable/disable stderr logging.
For example,
$ smc compile --log-driver file --log-opt "file=out.log,stderr=true"
--8<---------------cut here---------------end--------------->8---

* Usage examples

- Guile-INI -- INI[2] format parser:
- Guile-ICS -- iCalendar (RFC 5545) and vCard (RFC 6350) parser:
- Guile-PNG -- Pure Scheme Portable Network Graphics (PNG, RFC 2083)

Happy hacking,

- Artyom


Artyom "avp" Poptsov <>
Home page:
CADR Hackerspace co-founder:
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]