summaryrefslogtreecommitdiff
path: root/javascripts/main.js
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2010-05-18 08:52:24 +0200
committerPatrick Simianer <p@simianer.de>2010-05-18 08:52:24 +0200
commitb90042ebc1f37fa5f911df54ce0d3827da074892 (patch)
tree271ffd81ccf00888380b8b578d9bf238d8e4387b /javascripts/main.js
parentec3f1801c258dbba07dfccbd9864f9b2de0bfae6 (diff)
major
Diffstat (limited to 'javascripts/main.js')
-rw-r--r--javascripts/main.js28
1 files changed, 28 insertions, 0 deletions
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()+'<br />');
+
+ // simulate
+ var simulator = new NfaSimulator(nfa);
+ document.write('\''+word+'\' in <em>L</em>: '+simulator.simulate(word)+'<br />');
+
+ // nfa -> dfa
+ document.write('<pre>');
+ var dfa = new Nfa2Dfa(nfa);
+ var ttable = dfa.do();
+ document.write('</pre>');
+
+ //drawGraph()
+}