Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Generic (but simplified) FSA implementation, with actions and simple combinators

NotificationsYou must be signed in to change notification settings

ghuysmans/automata

Repository files navigation

This is a kind of generic FSA implementation.It was written to handle keystrokes, so there are no accepting statesbut each transition can trigger actions:

  • printing constant strings in the terminal:print "hi!"
  • broadcasting the same kind of strings in UDP:bc 2000 "HELLO EVERYONE"

Combinators allow you prioritizing automata:

  • a < b will produceb's actions whena doesn't
  • a || b will produce (at each step) actions froma andb, in this order

Tools

  • server.ml is a UDP server (for pranks, etc.)
  • run.ml is a combinator tester
  • dot.ml converts FSAs to graphs (seeExamples below)

Building

opam install ocamlbuild menhirocamlbuild -lib unix -use-menhir dot.byte run.byte server.byte

Examples

A cash register simulator

Running

./dot.byte cashregister.aut |dot -Tpng >cashregister.png

... on this file

(* transition macros *)digit='0'-'9'(* action macros *)T=broadcast 2000 "tick"D=broadcast 2000 "ding"(* 0 is the initial state *)0:      digit -> typing; Ttyping: digit -> typing; T        '\n' -> 0; D

... yields:

Cash register graph

About

Generic (but simplified) FSA implementation, with actions and simple combinators

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp