From b90042ebc1f37fa5f911df54ce0d3827da074892 Mon Sep 17 00:00:00 2001 From: Patrick Simianer
Date: Tue, 18 May 2010 08:52:24 +0200
Subject: major
---
javascripts/main.js | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 javascripts/main.js
(limited to 'javascripts/main.js')
diff --git a/javascripts/main.js b/javascripts/main.js
new file mode 100644
index 0000000..dc3c98b
--- /dev/null
+++ b/javascripts/main.js
@@ -0,0 +1,28 @@
+// globals
+var EPSILON = '~';
+var NEXTSTATE = 0;
+var EMPTYSYMBOL = '%';
+var ALPHABET = 'abc'+EMPTYSYMBOL;
+var REDELIMITER = '$';
+var regex = 'a*b|b*a' //(a|b)*'//'a(a|b)*a');
+var word = 'ba'; //'abba';
+
+
+function main() {
+ // parse regular expression
+ var parser = new RegexParser();
+ var nfa = parser.parse(regex);
+ document.write('Parsing: '+parser.getErrorMessage()+'
');
+
+ // simulate
+ var simulator = new NfaSimulator(nfa);
+ document.write('\''+word+'\' in L: '+simulator.simulate(word)+'
');
+
+ // nfa -> dfa
+ document.write('
'); + var dfa = new Nfa2Dfa(nfa); + var ttable = dfa.do(); + document.write(''); + + //drawGraph() +} -- cgit v1.2.3