unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* [ANN] GNU Guile State Machine Compiler (Guile-SMC)
@ 2021-04-24 18:43 Artyom V. Poptsov
  2021-04-25 13:40 ` Matt Wette
  0 siblings, 1 reply; 2+ messages in thread
From: Artyom V. Poptsov @ 2021-04-24 18:43 UTC (permalink / raw)
  To: Guile Users' Mailing List

[-- Attachment #1: Type: text/plain, Size: 2493 bytes --]

Hello Guilers!

I heard some of you like finite state machines.  If you love FSM as much
as I do, you may want to take a look on my Guile state machine compiler
(Guile-SMC):
  https://github.com/artyom-poptsov/guile-smc

With Guile-SMC, you can generate state machines using state machines,
and then you can use generated state machines to parse other stuff.

Why?  Because I noticed that I'm repeating myself each time I'm writing
a parser -- and I hand-crafted several of them already[1, 2] (as you may
know.)  Personally I think that it's an unfortunate situation that we,
Guilers, don't have a proper tool for that.  I'm hoping that Guile-SMC
will be able to fill this gap.

Some technical details:

Guile-SMC uses PlantUML[3] format for FSM description.  It reads this
format and produces a Scheme representation of a FSM that can be applied
to another format.

(It's still possible to use Guile-SMC to manually write state machines
using a syntax that loosely resembles state transition tables.  You can
find an example of it in 'modules/smc/puml.scm' file.)

The internal Guile-SMC representation of a FSM consists of a hash-table
for fast state lookup; in turn, each state holds links to other states
that it transitions to, essentially producing a directed graph.

Each transition consists of a guard (a predicate that is used to check
if the transition can be made), an action (a procedure that does the
work) and a target state to transition to if the guard returns #t.

There's an example of a PlantUML parser that generates a state machine
from it and applies it to PlantUML format itself that in turn produces a
new state machine (which is pretty cool as far as I understand.)

Also there's a basic state machine validator that reports dead-ends and
unreachable states.

It should be possible to produce a Scheme code from the intermediate
representation -- that will remove PlantUML-to-Scheme compilation time
from an application cold-boot time.

This is a work-in-progress though and some API is still in development,
so please be patient and report any problems.  Suggestions are very
welcome too.

Thanks,

- Artyom


References:
1: https://github.com/artyom-poptsov/guile-dsv
2: https://github.com/artyom-poptsov/guile-ics
3: http://www.plantuml.com/

-- 
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ANN] GNU Guile State Machine Compiler (Guile-SMC)
  2021-04-24 18:43 [ANN] GNU Guile State Machine Compiler (Guile-SMC) Artyom V. Poptsov
@ 2021-04-25 13:40 ` Matt Wette
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Wette @ 2021-04-25 13:40 UTC (permalink / raw)
  To: guile-user


On 4/24/21 11:43 AM, Artyom V. Poptsov wrote:
> Hello Guilers!
>
> I heard some of you like finite state machines.  If you love FSM as much
> as I do, you may want to take a look on my Guile state machine compiler
> (Guile-SMC):
>    https://github.com/artyom-poptsov/guile-smc
>
> With Guile-SMC, you can generate state machines using state machines,
> and then you can use generated state machines to parse other stuff.
>
Thanks.  I'll be checking this out.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-25 13:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-24 18:43 [ANN] GNU Guile State Machine Compiler (Guile-SMC) Artyom V. Poptsov
2021-04-25 13:40 ` Matt Wette

unofficial mirror of guile-user@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guile-user/0 guile-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-user guile-user/ https://yhetil.org/guile-user \
		guile-user@gnu.org
	public-inbox-index guile-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.lisp.guile.user
	nntp://news.gmane.io/gmane.lisp.guile.user


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git