是否有一种具有内置状态机结构的编程语言?

发布于 2024-08-12 11:22:04 字数 291 浏览 9 评论 0原文

我只是好奇是否有一种编程语言以状态机(类似于 boost::statechart)作为主要语言构造。

类比 - c# 有委托,而 java 使用观察者模式,而 C 有回调。 Perl 和 python 有内置的哈希值,而 C++ 和 java 需要一个库。

更新:

这应该是 C++、C#、Java、Lisp 意义上的通用编程语言……

我的意思是“成熟”的状态机,具有 Harel 形式主义或 UML 状态级别的所有花哨功能图表或 boost::statechart。

I am just curious if there is a programming language which has state machines (similar to boost::statechart) as primary language construct.

Analogies - c# has delegates where java uses the observer pattern and C has callbacks. Perl and python have built-in hashes while C++ and java needs a library.

Update:

This should be general programming language in the sense of C++, C#, Java, Lisp ...

I mean "mature" state machines with all bells and whistles on the level of Harel formalism or UML state diagrams or boost::statechart.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(16

天赋异禀 2024-08-19 11:22:04

Ragel 是一种状态机语言。 IOW,它不是一种支持状态机的语言,它是一种支持状态机的语言。这显然意味着它不是图灵完备的,但谁需要它呢?

更准确地说,Ragel 是一个状态机编译器,它采用类似正则表达式的语言描述状态机,并生成该状态机的 C、C++、Objective-C、D、Java 或 Ruby 实现。 (想想 yacc 但用于状态机而不是 LALR(1) 表解析器。)Ragel 的主要目的是解析二进制协议(例如网络协议或磁盘文件格式),但它可以也可以用于文本。

使用 Ragel 的一个著名例子是 Ruby 的 Mongrel Web 服务器:它的 HTTP 内核是用 Ragel 编写的,这使得它非常快速和安全。事实上,HTTP 内核非常好,以至于它已在不同的应用程序中多次重用:Thin、Unicorn 和 Rainbows 也是 Web 服务器,实际上是 Mongrel 的直接竞争对手。 Ebb 是一个反向 HTTP 代理。 RFuzz 是一个针对 Web 应用程序的模糊测试工具。此外,一些安全工具也使用它。

Ragel 还允许将主机语言中的代码嵌入到状态机中,从而使其成为图灵完备的,并且不仅能够识别,而且能够解释协议。

一般来说,每种语言都通过协程(例如 Lua)或延续(例如 Scala)或 GOTO(例如 PHP)或适当的方式支持高级用户定义控制流。尾部调用(例如Scheme)可用于轻松实现状态机。 (生成器(Python)又名迭代器(C#),基本上是“蹩脚的协程”,可能会也可能不会工作,这取决于你对“工作”的定义。)任何具有灵活语法(例如Ruby)或支持元句法抽象的语言(例如 Clojure)可用于描述状态机。 (对非 ASCII 标识符的支持也有帮助,以便您可以为状态机使用实际的箭头。)

这意味着,如果您将两者结合,并使用支持两者的语言尾部调用元句法抽象,您将获得非常好的状态机,无需本地语言支持。 Shriram Krishnamurthi 在首届轻量级语言会议上发表了一场现在(不名气)著名的演讲,题为“The Swine before Perl”,他在演讲中演示了Scheme 中的 FSM 实现。 (这里是幻灯片,一个录音解释代码的论文)。代码本身是一个 26 行(实际上非​​常短的行)宏,允许您编写如下代码:

(define my-regex
  (automaton init
             [init : (c → more)]
             [more : (a → more)
                     (d → more)
                     (r → end)]
             [end : accept]))

这是与正则表达式 c(a|d)*r< 对应的状态机规范/代码>。它不仅是一个规范,而且还是一个实现该状态机的可运行程序。

我可以这样称呼它:

(my-regex '(c a d a d d r))

在这种情况下,得到结果 #t (这是 true 的方案说法)。

Ragel is a state machine language. IOW, it's not a language that also supports state machines, it's a language that only supports state machines. Which obviously means that it's not Turing-complete, but who needs that?

More precisely, Ragel is a state machine compiler, which takes a description of a state machine in a regexp-like language and generates an implementation of that state machine in C, C++, Objective-C, D, Java or Ruby. (Think yacc but for state machines instead of LALR(1) table parsers.) The primary purpose of Ragel is parsing binary protocols (such as networking protocols or also on-disk file formats), but it can just as well be used for text.

One famous example of using Ragel is the Mongrel webserver for Ruby: its HTTP kernel is written in Ragel, which makes it extremely fast and secure. The HTTP kernel is so good in fact, that it has been reused a number of times in different applications: Thin, Unicorn and Rainbows are also webservers, and in fact direct competitors to Mongrel. Ebb is a reverse HTTP proxy. RFuzz is a fuzz testing tool for web applications. Also, some security tools use it.

Ragel also allows embedding code in the host language into the state machine, thus making it Turing-complete, and able to not only recognize but also interpret protocols.

In general, every language with support for advanced user-defined control-flow via either coroutines (e.g. Lua) or continuations (e.g. Scala) or GOTO (e.g. PHP) or proper tail calls (e.g. Scheme) can be used to easily implement state machines. (Generators (Python) aka iterators (C#), which are basically "crappy coroutines" might or might not work, depending on your definition of "work".) And any language which has flexible syntax (e.g. Ruby) or supports metasyntactic abstraction (e.g. Clojure) can be used to describe state machines. (Support for non-ASCII identifiers helps, too, so that you can use actual arrows for your state machine.)

Which means that if you combine the two, and use a language that supports both tail calls and metasyntactic abstraction, you get very nice state machines, without requiring native language support. Shriram Krishnamurthi gave a now (in)famous talk titled "The Swine before Perl" at the inaugural Lightweight Languages Conference, in which he demonstrated an FSM implementation in Scheme. (Here are the slides, an audio recording and a paper explaining the code). The code itself is a 26 line (very short lines, actually) macro, that allows you to write code like this:

(define my-regex
  (automaton init
             [init : (c → more)]
             [more : (a → more)
                     (d → more)
                     (r → end)]
             [end : accept]))

This is a specification of the state machine corresponding to the regular expression c(a|d)*r. And it is not only a specification, but also a runnable program implementing that state machine.

I can call it like this:

(my-regex '(c a d a d d r))

And in this case get the result #t (which is Scheme-speak for true).

已下线请稍等 2024-08-19 11:22:04

有一种新的基于 W3C XML 的状态机语言,称为 SCXML,基于 David Harel 的 StateChart 形式主义(支持分层和并行状态机)。

Apache Commons 有一个基于 Java 的 SCXML 实现

Commons SCXML 是一种实现,旨在创建和维护 Java SCXML 引擎,该引擎能够执行使用 SCXML 文档定义的状态机,同时抽象出环境接口。

There's a new W3C XML-based state machine language called SCXML, based on David Harel's StateChart formalism (which supports hierarchical and parallel state machines).

Apache Commons has a Java based implementation of SCXML:

Commons SCXML is an implementation aimed at creating and maintaining a Java SCXML engine capable of executing a state machine defined using a SCXML document, while abstracting out the environment interfaces.

不语却知心 2024-08-19 11:22:04

Plaid 编程语言引入了“面向类型状态的编程,一种使用类型状态扩展面向对象编程的范例”。

这是文档: http://www.cs.cmu.edu/~aldrich/plaid /

例如:

state File {
    public final String filename;
}

state OpenFile extends File {
    private CFilePtr filePtr;
    public int read() { ... }
    public void close() [OpenFile>>ClosedFile]
        { ... }
}

state ClosedFile extends File {
    public void open() [ClosedFile>>OpenFile]
        { ... }
}

The Plaid Programming Language introduce "Typestate-Oriented Programming, a paradigm that extends object-oriented programming with typestates."

Here is the doc: http://www.cs.cmu.edu/~aldrich/plaid/

E.g:

state File {
    public final String filename;
}

state OpenFile extends File {
    private CFilePtr filePtr;
    public int read() { ... }
    public void close() [OpenFile>>ClosedFile]
        { ... }
}

state ClosedFile extends File {
    public void open() [ClosedFile>>OpenFile]
        { ... }
}
明媚如初 2024-08-19 11:22:04

SMC 是一个简单的域特定语言的编译器,它将为许多流行语言生成状态机。我已经使用它为各种事物生成可维护的状态机,例如复杂的用户界面和自定义网络协议。

SMC is a compiler for a simple domain specific language that will generate state machines for many popular languages. I have used it to generate maintainable state machines for a wide variety of things such as complex user interfaces and custom network protocols.

偏爱你一生 2024-08-19 11:22:04

我刚刚找到了一个:AsmL(抽象状态机语言)。< br>
以下是 CodePlex 上的页面,其中包含更多信息

有趣的是,它是由微软开发的。

I have just found one: AsmL (Abstract State Machine Language).
Here is the page with more info on it at CodePlex.

Interesting enough, it is developed by Microsoft.

谎言月老 2024-08-19 11:22:04

Erlang 的 OTP 通过“gen_fsm”支持状态机构造。自从我上次查看它以来已经有几年了,所以我有点生疏了,但是你可以在 Google 上搜索“Erlang gen_fsm”并找到大量参考资料

Erlang's OTP supports state machine constructs via 'gen_fsm'. It's been a couple of years since I last looked at it, so I'm a bit rusty, but you can Google for 'Erlang gen_fsm' and find loads of reference material

久伴你 2024-08-19 11:22:04

微软研究院最近在 GitHub 上发布了 P 语言。他们还有 PSharp 框架提供 C# 扩展库和高级语法以及该语言的编译器。

我很期待尝试一下。

以下是他们的 C# 扩展示例之一的一部分:

internal class Server : Machine
{
    MachineId Client;

    [Start]
    [OnEntry(nameof(InitOnEntry))]
    class Init : MachineState { }

    void InitOnEntry()
    {
        ...
        this.Goto(typeof(Active));
    }

    ...

这是他们的高级语法的一部分:

using System;

namespace TheStateMachine
{
  internal machine Client
  {
    private machine Server;
    private start state Init
    {
      entry
      {
        this.Server = (trigger as Config).target;
        jump(Playing);
      }
    }

    private state Playing
    {
      entry
      {
        //execute logic
      }
      on AnotherEvent goto AnotherState;
      on SomeEvent do ProcessSomeLogic;
    }

  ...

Microsoft Research recently released the P language on GitHub. They also have the PSharp framework which provides a C# extension library and a high-level syntax with compiler for the language.

I am looking forward to trying it out.

Here is a portion from one of their examples for the C# extensions:

internal class Server : Machine
{
    MachineId Client;

    [Start]
    [OnEntry(nameof(InitOnEntry))]
    class Init : MachineState { }

    void InitOnEntry()
    {
        ...
        this.Goto(typeof(Active));
    }

    ...

Here is a portion of their high-level syntax:

using System;

namespace TheStateMachine
{
  internal machine Client
  {
    private machine Server;
    private start state Init
    {
      entry
      {
        this.Server = (trigger as Config).target;
        jump(Playing);
      }
    }

    private state Playing
    {
      entry
      {
        //execute logic
      }
      on AnotherEvent goto AnotherState;
      on SomeEvent do ProcessSomeLogic;
    }

  ...
晨光如昨 2024-08-19 11:22:04

不完全是,但 Python 有一个状态机模块,可让您使用装饰器来支持实现 Harel 风格的状态图,包括具有多个状态的上下文、具有或不具有历史记录的嵌套子状态。该代码最终看起来如下所示。
模块位于 http://wiki.python.org/moin/State%20Machine% 20via%20装饰器

 #!/bin/env/python
"""
This example now works. The state pattern module
allows defining states which are their their own context for 
implementing substates.  Substate Medium (class Medium) shows this here.
"""
"""
Example with 5 buttons. Two ,'up','down' cause state to rotate among the
several states.  The other three, bx,by,bz, invoke state dependent behavior.

Switching into a state causes the labels of the three buttons bx,by,bz to
change.  Pressing one of the buttons causes associated text to appear in
corresponding static text box. An 'onEnter' method changes the text.
"""
import wx
import DecoratorStateMachine as dsm

class MyFrame(wx.Frame, dsm.ContextBase):

   xtable = dsm.TransitionTable('pstate')


   def __init__(self):
      MyFrame.xtable.initialize(self)

      wx.Frame.__init__(self, None, -1, "My Frame", size=(470,220))

      family = wx.SWISS
      style = wx.NORMAL
      weight = wx.BOLD
      font = wx.Font(11,family,style,weight, False, "Verdana")
      self.SetFont(font)

      panel = wx.Panel(self, -1)

      b = wx.Button(panel, -1, "Up", pos=(50,20), size=(80,35))
      self.Bind(wx.EVT_BUTTON, self.OnUp, b)
      b.SetDefault()

      b = wx.Button(panel, -1, "Down", pos=(50,60), size=(80,35))
      self.Bind(wx.EVT_BUTTON, self.OnDown, b)

      self.bx = wx.Button(panel, -1, "xxx", pos=(50,100), size=(110,35))
      self.Bind(wx.EVT_BUTTON, self.OnBA, self.bx)
      self.tx = wx.StaticText(panel, -1, "", pos=(50,140), size=(110,35))

      self.by = wx.Button(panel, -1, "yyy", pos=(180,100), size=(110,35))
      self.Bind(wx.EVT_BUTTON, self.OnBB, self.by)
      self.ty = wx.StaticText(panel, -1, "", pos=(180,140), size=(110,35))

      self.bz = wx.Button(panel, -1, "zzz", pos=(310,100), size=(110,35))
      self.Bind(wx.EVT_BUTTON, self.OnBC, self.bz )
      self.tz = wx.StaticText(panel, -1, "", pos=(310,140), size=(110,35))


   @dsm.transition(xtable)
   def OnUp(self, event):
      pass

   @dsm.transition(xtable)
   def OnDown(self, event):
      pass

   @dsm.event(xtable)
   def OnBA(self, event):
      pass

   @dsm.event(xtable)
   def OnBB(self, event):
      pass

   @dsm.event(xtable)
   def OnBC(self, event):
      self.tz.SetLabel("Bossy")


class Off(MyFrame):
   "This is state Off "

   def onEnter(self):
      self.bx.SetLabel("Chase")
      self.by.SetLabel("Onry")
      self.bz.SetLabel("Cow")

   def OnBA(self, event):
      self.tx.SetLabel("Chase the")

   def OnBB(self, event):
      self.ty.SetLabel("Onry")


class Low(MyFrame):
   "This is state Low "
   items = ["Walk", "Green", "Llama"]

    def onEnter(self):
      self.bx.SetLabel(self.items[0])
      self.by.SetLabel(self.items[1])
      self.bz.SetLabel(self.items[2])

   def OnBA(self, event):
      self.tx.SetLabel("Walk the ")

   def OnBB(self, event):
      self.ty.SetLabel(self.items[1])

   def OnBC(self, event):
      self.tz.SetLabel(self.items[2])


class Medium(MyFrame):
   "This is state Medium "
   ytable = dsm.TransitionTable('qstate')

   def onEnter(self):
      if not hasattr(self, 'qstate'):    #unconditionally initialize for no history
         self.ytable.initialize(self)
      self.doEnter()

   @dsm.event(ytable)
   def doEnter(): pass

   @dsm.transitionevent(ytable)
   def OnBA(self, event):
      pass

   @dsm.transitionevent(ytable)
   def OnBB(self, event):
      pass

   @dsm.transitionevent(ytable)
   def OnBC(self, event):
      pass


class High(Low):
   "This is state High "

   items = ["Pet","Tame", "Dog"]

   def OnBA(self, event):
      self.tx.SetLabel("Pet his")

class MedBlue(Medium):
   """State med blu"""

   items = ["Med BLue","Checkered", "Tractor"]

   def onEnter(self):
      self.bx.SetLabel(self.items[0])
      self.by.SetLabel(self.items[1])
      self.bz.SetLabel(self.items[2])

   def doEnter(self):
      self.onEnter()

   def OnBA(self, event):
      self.tx.SetLabel("Med Blue")
   def OnBB(self, event):
      self.ty.SetLabel("Chekered")
   def OnBC(self, event):
      self.tz.SetLabel("Tractor")


class MedRed(Medium):
   """State med red"""

   items = ["Med Red","Striped", "Combine"]

   def onEnter(self):
      self.bx.SetLabel(self.items[0])
      self.by.SetLabel(self.items[1])
      self.bz.SetLabel(self.items[2])

   def doEnter(self):
      self.onEnter()

   def OnBA(self, event):
      self.tx.SetLabel("Med Red")
   def OnBB(self, event):
      self.ty.SetLabel("Striped")
   def OnBC(self, event):
      self.tz.SetLabel("Combine")


MyFrame.xtable.nextStates(Low, (Medium,Off))
MyFrame.xtable.nextStates(Medium, (High,Low))
MyFrame.xtable.nextStates(High, (Off,Medium))
MyFrame.xtable.nextStates(Off, (Low,High))
MyFrame.xtable.initialstate = Off

Medium.ytable.nextStates(MedBlue, (MedBlue, MedRed, MedRed))
Medium.ytable.nextStates(MedRed,  (MedBlue, MedBlue, MedRed))
Medium.ytable.initialstate = MedBlue


if __name__=='__main__':
   app = wx.PySimpleApp()
   frame = MyFrame()
   frame.Show(True)
   app.MainLoop()

Not quite, but there is a state machine module for Python that lets you use decorators to support implementing Harel style statecharts, including contexts with multiple states, nesting substates with and without history. The code winds up looking something like below.
Module is at http://wiki.python.org/moin/State%20Machine%20via%20Decorators

 #!/bin/env/python
"""
This example now works. The state pattern module
allows defining states which are their their own context for 
implementing substates.  Substate Medium (class Medium) shows this here.
"""
"""
Example with 5 buttons. Two ,'up','down' cause state to rotate among the
several states.  The other three, bx,by,bz, invoke state dependent behavior.

Switching into a state causes the labels of the three buttons bx,by,bz to
change.  Pressing one of the buttons causes associated text to appear in
corresponding static text box. An 'onEnter' method changes the text.
"""
import wx
import DecoratorStateMachine as dsm

class MyFrame(wx.Frame, dsm.ContextBase):

   xtable = dsm.TransitionTable('pstate')


   def __init__(self):
      MyFrame.xtable.initialize(self)

      wx.Frame.__init__(self, None, -1, "My Frame", size=(470,220))

      family = wx.SWISS
      style = wx.NORMAL
      weight = wx.BOLD
      font = wx.Font(11,family,style,weight, False, "Verdana")
      self.SetFont(font)

      panel = wx.Panel(self, -1)

      b = wx.Button(panel, -1, "Up", pos=(50,20), size=(80,35))
      self.Bind(wx.EVT_BUTTON, self.OnUp, b)
      b.SetDefault()

      b = wx.Button(panel, -1, "Down", pos=(50,60), size=(80,35))
      self.Bind(wx.EVT_BUTTON, self.OnDown, b)

      self.bx = wx.Button(panel, -1, "xxx", pos=(50,100), size=(110,35))
      self.Bind(wx.EVT_BUTTON, self.OnBA, self.bx)
      self.tx = wx.StaticText(panel, -1, "", pos=(50,140), size=(110,35))

      self.by = wx.Button(panel, -1, "yyy", pos=(180,100), size=(110,35))
      self.Bind(wx.EVT_BUTTON, self.OnBB, self.by)
      self.ty = wx.StaticText(panel, -1, "", pos=(180,140), size=(110,35))

      self.bz = wx.Button(panel, -1, "zzz", pos=(310,100), size=(110,35))
      self.Bind(wx.EVT_BUTTON, self.OnBC, self.bz )
      self.tz = wx.StaticText(panel, -1, "", pos=(310,140), size=(110,35))


   @dsm.transition(xtable)
   def OnUp(self, event):
      pass

   @dsm.transition(xtable)
   def OnDown(self, event):
      pass

   @dsm.event(xtable)
   def OnBA(self, event):
      pass

   @dsm.event(xtable)
   def OnBB(self, event):
      pass

   @dsm.event(xtable)
   def OnBC(self, event):
      self.tz.SetLabel("Bossy")


class Off(MyFrame):
   "This is state Off "

   def onEnter(self):
      self.bx.SetLabel("Chase")
      self.by.SetLabel("Onry")
      self.bz.SetLabel("Cow")

   def OnBA(self, event):
      self.tx.SetLabel("Chase the")

   def OnBB(self, event):
      self.ty.SetLabel("Onry")


class Low(MyFrame):
   "This is state Low "
   items = ["Walk", "Green", "Llama"]

    def onEnter(self):
      self.bx.SetLabel(self.items[0])
      self.by.SetLabel(self.items[1])
      self.bz.SetLabel(self.items[2])

   def OnBA(self, event):
      self.tx.SetLabel("Walk the ")

   def OnBB(self, event):
      self.ty.SetLabel(self.items[1])

   def OnBC(self, event):
      self.tz.SetLabel(self.items[2])


class Medium(MyFrame):
   "This is state Medium "
   ytable = dsm.TransitionTable('qstate')

   def onEnter(self):
      if not hasattr(self, 'qstate'):    #unconditionally initialize for no history
         self.ytable.initialize(self)
      self.doEnter()

   @dsm.event(ytable)
   def doEnter(): pass

   @dsm.transitionevent(ytable)
   def OnBA(self, event):
      pass

   @dsm.transitionevent(ytable)
   def OnBB(self, event):
      pass

   @dsm.transitionevent(ytable)
   def OnBC(self, event):
      pass


class High(Low):
   "This is state High "

   items = ["Pet","Tame", "Dog"]

   def OnBA(self, event):
      self.tx.SetLabel("Pet his")

class MedBlue(Medium):
   """State med blu"""

   items = ["Med BLue","Checkered", "Tractor"]

   def onEnter(self):
      self.bx.SetLabel(self.items[0])
      self.by.SetLabel(self.items[1])
      self.bz.SetLabel(self.items[2])

   def doEnter(self):
      self.onEnter()

   def OnBA(self, event):
      self.tx.SetLabel("Med Blue")
   def OnBB(self, event):
      self.ty.SetLabel("Chekered")
   def OnBC(self, event):
      self.tz.SetLabel("Tractor")


class MedRed(Medium):
   """State med red"""

   items = ["Med Red","Striped", "Combine"]

   def onEnter(self):
      self.bx.SetLabel(self.items[0])
      self.by.SetLabel(self.items[1])
      self.bz.SetLabel(self.items[2])

   def doEnter(self):
      self.onEnter()

   def OnBA(self, event):
      self.tx.SetLabel("Med Red")
   def OnBB(self, event):
      self.ty.SetLabel("Striped")
   def OnBC(self, event):
      self.tz.SetLabel("Combine")


MyFrame.xtable.nextStates(Low, (Medium,Off))
MyFrame.xtable.nextStates(Medium, (High,Low))
MyFrame.xtable.nextStates(High, (Off,Medium))
MyFrame.xtable.nextStates(Off, (Low,High))
MyFrame.xtable.initialstate = Off

Medium.ytable.nextStates(MedBlue, (MedBlue, MedRed, MedRed))
Medium.ytable.nextStates(MedRed,  (MedBlue, MedBlue, MedRed))
Medium.ytable.initialstate = MedBlue


if __name__=='__main__':
   app = wx.PySimpleApp()
   frame = MyFrame()
   frame.Show(True)
   app.MainLoop()
吃颗糖壮壮胆 2024-08-19 11:22:04

2015 年 9 月,xstate 项目启动。它实现了 SCXML,旨在为现代网络提供 JavaScript 和 TypeScript 有限状态机和状态图。 文档链接

In Sep 2015 the xstate project was launched. It implements SCXML and aims to provide JavaScript and TypeScript finite state machines and statecharts for the modern web. link to the documentation

淡笑忘祈一世凡恋 2024-08-19 11:22:04

在 C# 中,迭代器(带有“yield return”和“yield break”)是一种直接转换为状态机的语言结构。我实际上从未使用过它,但我实际上认为它可以在实践中使用。

恰好有一个关于它的 stackoverflow 问题 此处。不过,得票最高的答案却阻止了它......

In C#, iterators (with 'yield return' and 'yield break') are a language construct that directly translates to state machines. I haven't actually ever used it as such, but I actually think it could be usable in practice.

There happens to be a stackoverflow question about it here. The highest voted answer discourages it though ...

夏花。依旧 2024-08-19 11:22:04

除了 Ragel 之外,还有一种技术上有趣但相当晦涩的语言,称为 SL1。
请参阅 http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber= 1095580。它由斯洛文尼亚的 Iskratel 创建,旨在开发以状态机为基本块的电信系统。

Apart from Ragel there is a technically interesting,but quite obscure language called SL1.
See http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=1095580. It was created by Iskratel in Slovenia in order to develop telecom systems where state machines are the basic blocks.

风情万种。 2024-08-19 11:22:04

Shriram Krishnamurthi 有一个关于使用宏的演讲和论文将自动机的嵌入式子语言添加到Scheme。不过,我不确定是否有任何计划将他的宏作为标准库包含在内。

Shriram Krishnamurthi has a talk and a paper about using macros to add an embedded sublanguage for automata to Scheme. I'm not sure if any Schemes include his macros as a standard library, though.

风和你 2024-08-19 11:22:04

我迟到了将近十年,但最近我偶然发现了一种晦涩的语言,它借鉴了 FSM 的思想,称为 Hume

我不确定它是否仍在积极维护,但您至少可以下载编译器并使用它。信息很难获得,但网上有一些论文和文章展示了要点。

I'm almost a decade late to the party but I recently stumbled upon an obscure language which borrows ideas from FSMs called Hume

I'm not sure if it's still actively maintained, but you can at least download the compiler and play around with it. Information is hard to come by, but there's a few papers and articles online that show the essentials.

苏大泽ㄣ 2024-08-19 11:22:04

这项工作已经进一步发展成为非常好的东西,请参阅 https://microsoft.github.io/coyote

This work has evolved further into something very nice, see https://microsoft.github.io/coyote.

帥小哥 2024-08-19 11:22:04

在 C++ 中,还有 Eduard Hiti 在 2005 年创建的 Macho(非常小的)框架。
Macho 代表“C++ 机器对象”。
此处提供:https://github.com/yattom/macho

非常小,适合 HSM ,无需升压。

In C++, there is also the Macho (very small) framework created in 2005 by Eduard Hiti.
Macho stands for "C++ Machine Objects".
Available here : https://github.com/yattom/macho

Very small, does the job for HSM, without requiring boost.

黑寡妇 2024-08-19 11:22:04

FSM (https://github.com/morazanm/fsm) 是我工作的一种语言,具有状态机(包括图灵机和组合图灵机)的构造函数、正则表达式、正则、上下文无关和上下文相关语法,以及一堆其他东西。这本书有助于导航语言,但文档也非常可靠 https ://link.springer.com/book/10.1007/978-3-031-43973-5

FSM (https://github.com/morazanm/fsm) is a language I work on, has constructors for state machines (including Turing machines and composed Turing machines), regular expressions, regular, context-free, and context-sensitive grammars, and a bunch of other stuff. This book helps navigate the language but the documentation is also pretty solid https://link.springer.com/book/10.1007/978-3-031-43973-5.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文