https://github.com/keegandonley/automaton-deno
Automaton execution and manipulation tool for Deno
https://github.com/keegandonley/automaton-deno
dfa dfa-simulator nfa nfa-to-dfa-conversion
Last synced: 3 months ago
JSON representation
Automaton execution and manipulation tool for Deno
- Host: GitHub
- URL: https://github.com/keegandonley/automaton-deno
- Owner: keegandonley
- Created: 2020-05-25T21:02:36.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-01T19:46:09.000Z (almost 5 years ago)
- Last Synced: 2025-01-20T08:12:49.544Z (5 months ago)
- Topics: dfa, dfa-simulator, nfa, nfa-to-dfa-conversion
- Language: TypeScript
- Homepage:
- Size: 79.1 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![]()
# Automaton CLI
CLI for executing automatons. This is a port of some of the business logic from the [Online Automaton Builder](https://automatonbuilder.com/).
Designed to be run with [Deno](https://deno.land/):
```bash
deno run index.ts "01010"
```The DFA class can be imported into a Deno project using
```js
import DFA from 'https://raw.githubusercontent.com/keegandonley/automaton-deno/master/automaton.ts';```
Future work will focus on the construction of graphs programatically or reading in from a file. For the time being, a JSON file is loaded with the following structure:
```json
{
"dfa": {
"A": {
"edges": [
{
"target": "B",
"input": "1"
},
{
"target": "C",
"input": "0"
}
],
"accepting": false
},
"B": {
"edges": [
{
"target": "A",
"input": "0"
},
{
"target": "C",
"input": "1"
}
],
"accepting": false
},
"C": {
"edges": [
{
"target": "B",
"input": "0"
},
{
"target": "A",
"input": "1"
}
],
"accepting": true
}
},
"start": "A"
}
```## Interactive Mode
Build an automaton node by node and test strings against it```
make run
```## Class Methods
Processing the input string:```typescript
automaton.process('010')
```will yield:
```typescript
{ path: [ "C", "A", "C" ], accepted: true }
```