GithubHelp home page GithubHelp logo

automatty's Introduction

Automatty

A lightweight library that implements automata with the Scala3 compiler (Dotty).

Related to ENSEIRB-MATMECA module IF114: "Finite automata and applications".

Note: This project is under construction.

Example:

import com.automatty.implicits._
import com.automatty.automata._
import com.automatty.automata.states._

trait Alphabet
case object A extends Alphabet
case object B extends Alphabet

// Automata that check if there is an even number of A and an odd number of B
val s00 = new State("(0, 0)") with InitialState
val s01 = new State("(0, 1)") with AcceptorState
val s10 = new State("(1, 0)")
val s11 = new State("(1, 1)")
val automaton = FiniteAutomaton.Complete[Alphabet, Nothing](
  s00,
  Set(s01, s10, s11),
  Set(
    s00--B->s01,
    s00--A->s10,
    s01--B->s00,
    s01--A->s11,
    s11--B->s10,
    s11--A->s01,
    s10--B->s11,
    s10--A->s00
  )
)

automaton.accepts(List(A, B, A)) // returns True

It is also possible to generate the rendering of automata with the render method automaton.render('automata.png').

An automaton rendered by automatty

sbt project compiled with Scala 3

Usage

This is a normal sbt project. You can compile code with sbt compile, run it with sbt run, test it with sbt test, and sbt console will start a Scala 3 REPL.

For more information on the sbt-dotty plugin, see the dotty-example-project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.