TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Lucy: A concise language for describing Finite State Machines

126 pointsby whatever35 months ago

8 comments

whilenot-dev5 months ago
A DSL for XState[0] by the co-creator of astro.build[1], cool! But the repo[2] has been archived and there is an active FSM library from the same developer called <i>robot</i>[3].<p>[0]: <a href="https:&#x2F;&#x2F;xstate.js.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;xstate.js.org&#x2F;</a><p>[1]: <a href="https:&#x2F;&#x2F;astro.build&#x2F;" rel="nofollow">https:&#x2F;&#x2F;astro.build&#x2F;</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;lucydsl&#x2F;liblucy">https:&#x2F;&#x2F;github.com&#x2F;lucydsl&#x2F;liblucy</a><p>[3]: <a href="https:&#x2F;&#x2F;github.com&#x2F;matthewp&#x2F;robot">https:&#x2F;&#x2F;github.com&#x2F;matthewp&#x2F;robot</a>
评论 #42565304 未加载
评论 #42565297 未加载
aziis985 months ago
What I don&#x27;t like about these state machine DSLs is that they are not really composable at the &quot;machine level&quot;. It is a known fact that FSM are equivalent to regular expressions [1]<p><pre><code> Alternatively, a regular language can be defined as a language recognised by a finite automaton. The equivalence of regular expressions and finite automata is known as Kleene&#x27;s theorem </code></pre> I think a cool state machine language would use this fact as a starting point for it&#x27;s syntax. Another very useful feature would be &quot;functions&quot; to isolate specific repetitive parts of FSM<p>[1]: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Regular_language" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Regular_language</a>
评论 #42569686 未加载
评论 #42568600 未加载
评论 #42566246 未加载
评论 #42567833 未加载
评论 #42565989 未加载
v9v5 months ago
I quite like the concise state machine definitions used in Rodney Brooks&#x27; &quot;A Robust Layered Control System for a Mobile Robot&quot;[0]. The first element is the state name, and whatever is returned is the next state.<p><pre><code> (defmodule avoid :inputs (force heading) :outputs (command) :instance-vars (resultforce) :states ((nil (event-dispatch (and force heading) plan)) (plan (setf resultforce (select-direction force heading)) go) (go (conditional-dispatch (significant-force-p resultforce 1.0) start nil)) (start (output command (follow-force resultforce)) nil))) </code></pre> [0] <a href="https:&#x2F;&#x2F;www.semanticscholar.org&#x2F;paper&#x2F;A-robust-layered-control-system-for-a-mobile-robot-Brooks&#x2F;fb39b30187babe9bee4afb30b034b5f93b74859a" rel="nofollow">https:&#x2F;&#x2F;www.semanticscholar.org&#x2F;paper&#x2F;A-robust-layered-contr...</a>
shaftway5 months ago
At one point I built a type-based state machine core for Java. The idea was to use interfaces and classes as the basis for defining what transitions are allowed, and as a way to store the associated fields. It relied on Java&#x27;s type-checking to guide you into using it correctly.<p><pre><code> public interface TurnstileState {} public interface LockedState extends TurnstileState {} public class UnlockedState implements TurnstileState { public final int credits; public UnlockedState(int credits) { this.credits = credits; } } public static final LockedState LOCKED = new LockedState() {}; StateMachine&lt;TurnstileState&gt; turnstile = StateMachine.&lt;TurnstileState&gt;.newBuilder() .addValidTransition(LockedState.class, UnlockedState.class) .addValidTransition(UnlockedState.class, LockedState.class) .addValidTransition(UnlockedState.class, UnlockedState.class) .buildWithInitialState(LOCKED); turnstile.transition(new UnlockedState(1)); </code></pre> I never got around to building out examples in Kotlin. I feel like the type checking there would streamline a ton of this even further.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Hounshell&#x2F;st8">https:&#x2F;&#x2F;github.com&#x2F;Hounshell&#x2F;st8</a> if anyone wants to see the gory bits.
zokier5 months ago
One thing that saddens me is how Ragel petered out, I guess they got bit too ambitious with the Colm rewrite. But it was a state machine language that saw a blip of usage at one point
jesuslop5 months ago
There is also vintageish SCXML underwritten by the w3c, with the panoply of xml friends (an xsd schema hence validator, xpath queries and xslt transforms). Also being part of the uml chart family it should be xmi-borne, if you wondered.
mbitard5 months ago
This is an abandonned project :(
评论 #42565457 未加载
TypingOutBugs5 months ago
&gt; This repository has been archived by the owner on Dec 12, 2023. It is now read-only.<p>Hasn&#x27;t been updated in 4 years, and is now archived, so I assume this project is dead. Looks good though!