Giter Site home page Giter Site logo

2nfa's Introduction

2nfa

This is a rudimentary reference implementation of the three algorithms for converting two-way automata into one-way automata using regular expressions, as documented in the paper:

Hulden, M. (2015). From Two-Way to One-Way Finite Automata - Three Regular Expression-Based Methods. In Drewes, F., editor, Implementation and Application of Automata, 20th International Conference, CIAA 2015, Umeå, Sweden. Volume 9223 of Lecture Notes in Computer Science, pages 176-187. Springer-Verlag.[link]

Usage

The script reads from STDIN and outputs a foma/xfst script to STDOUT. The -a flag controls which algorithm to use: 1, 2, or 3 (see paper). Algorithm 1 handles only 2DFA but is the most efficient conversion while algorithms 2 and 3 handle 2NFA as well.

For example:

python 2nfa2foma.py < example1.att > example1.foma

produces a regular expression script from the file example1.att after which the resulting script can be compiled with foma (or xfst), e.g.:

foma -l example1.foma

which then produces the equivalent minimized 1DFA.

Input file format

The 2DFA/2NFA specification is a modified AT&T format, where each transition is on a single line with whitespace-separate fields:

SOURCE_STATE TARGET_STATE SYMBOL DIRECTION

DIRECTION is one of L,R,S (left, right, stay). Lines with only one number identify final states.

State numbering is assumed to start from 0 and be consecutive. The symbol alphabet needs to be disjoint from the state alphabet - i.e. symbols such as 0 cannot be used.

For example:

0       0       a       R
0       1       b       R
1       1       a       R
1       2       b       L
2       0       a       R
2       2       b       L
0
1
2

Describes the two-way automaton:

Example 1

2nfa's People

Contributors

mhulden avatar

Watchers

 avatar

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.