commit 274a8c8f29d88a696904c80312dbe0c6f0b146e8
parent eb64825296de2ba88be00664d5143ad73c139db5
Author: Ethan Long <ethandavidlong@gmail.com>
Date: Tue, 27 Feb 2024 13:26:54 +1100
Added a README
Diffstat:
| A | README.org | | | 50 | ++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 50 insertions(+), 0 deletions(-)
diff --git a/README.org b/README.org
@@ -0,0 +1,50 @@
+#+Title: Toy Finite State Automaton in Rust
+#+Author: Ethan Long
+* What is this?
+This is just a toy project I've been working on to test my knowledge on COMP1600 topics. It's a very basic library for Rust that implements the finite state automaton described in COMP1600.
+
+What is currently implemented:
+ * ε-NFAs
+ * NFAs
+ * DFAs
+ * Deterministic wildcard transitions for all automata, any input not in the alphabet (DFA) or with explicit transitions (NFA) follows the wildcard transition.
+ * Regular expressions with a bit of sugar
+ - Current operators are ~*~, ~+~, ~?~, ~.~, and ~|~.
+ - The following escape sequences: ~\*~, ~\+~, ~\?~, ~\.~, ~\|~, ~\(~, ~\)~, and ~\\~ to map to the characters that are reserved.
+ - Implemented with an LL(1) predictive recursive descent parser.
+ + Correct me if I'm wrong on this
+ * A WASM compilation target with accompanying TypeScript library for use with Node & in the browser.
+ * A basic demo website of the regex engine and parser.
+
+Goals: [0/1]
+ - [ ] Publish demo to a static GitLab page.
+ - [ ] Rewrite the JSON parsing for DFA, NFA, and ENFA to accept wildcard transitions.
+ - [ ] Write tests until I'm satisfied that everything is mostly okay.
+ - [ ] Implement Turing automaton.
+ - [ ] Implement step-through acceptance rendering.
+* How do I run it?
+Currently there are no prebuilt binaries beyond the WASM/JavaScript package in ~/web/pkg~.
+
+To build the main project, simply go
+#+begin_src shell
+ cargo build --release
+#+end_src
+Then to run the binaries:
+#+begin_src shell
+ cargo run --release --bin <BINNAME> <ARGS>
+#+end_src
+
+For a quick start, just run the ~regex~ binary:
+#+begin_src shell
+ cargo run --release --bin regex <REGEX> <INPUT>
+#+end_src
+The ~regex~ is just a simple automaton in this program, it will not search the ~<INPUT>~ string, it will simply tell you if the regex ~<REGEX>~ accepts/directly matches ~<INPUT>~.
+
+If you want to work directly with the automaton binaries, they accept a path to a JSON file describing the automaton. See the ~DFAs~, ~ENFAs~, and ~NFAs~ section. _NOTE: The JSON spec was made before a lot of changes involving the wildcard transition, so it doesn't yet support that._
+
+If you want to work with the automaton as a library, there is a simple ~GraphENFA~ with methods for building up an ε-NFA, which you can then convert to any of the other automaton.
+
+There is a web-demo available to build (in future, it will also be hosted somewhere), this requires Bun for bundling, and of course cargo:
+#+begin_src shell
+ cd web && bun i && bun run build
+#+end_src