summaryrefslogtreecommitdiff
path: root/comp/work/44
diff options
context:
space:
mode:
Diffstat (limited to 'comp/work/44')
-rw-r--r--comp/work/44/fsn3
-rwxr-xr-xcomp/work/44/regexbin0 -> 15736 bytes
-rw-r--r--comp/work/44/regex.c15
-rw-r--r--comp/work/44/sheet11
-rw-r--r--comp/work/44/starter27
-rw-r--r--comp/work/44/task16
6 files changed, 62 insertions, 0 deletions
diff --git a/comp/work/44/fsn b/comp/work/44/fsn
new file mode 100644
index 0000000..1d09a23
--- /dev/null
+++ b/comp/work/44/fsn
@@ -0,0 +1,3 @@
+s1 = s2(a)
+s2 = s3(b)
+(s3) = done , s1(a)
diff --git a/comp/work/44/regex b/comp/work/44/regex
new file mode 100755
index 0000000..5a3fde4
--- /dev/null
+++ b/comp/work/44/regex
Binary files differ
diff --git a/comp/work/44/regex.c b/comp/work/44/regex.c
new file mode 100644
index 0000000..6697836
--- /dev/null
+++ b/comp/work/44/regex.c
@@ -0,0 +1,15 @@
+#include <stdlib.h>
+#include <regex.h>
+#include <stdio.h>
+
+void eprint(char *msg){
+fprintf(stderr, "%s\n", msg);
+exit(1);
+}
+
+int main(){
+regex_t expr;
+if (regcomp(&expr, "(1|0)+", 0) != 0) eprint("regcomp failed!");
+int ret = regexec(&expr, "1010", 0, NULL, 0);
+printf("%d\n", ret);
+}
diff --git a/comp/work/44/sheet b/comp/work/44/sheet
new file mode 100644
index 0000000..5226997
--- /dev/null
+++ b/comp/work/44/sheet
@@ -0,0 +1,11 @@
+RE | req
+
+(1|0) | 1 or 0
+1+ | all 1's
+(1|0)+ | all binary strings
+(1|0)*1 | binary string ending with 1
+1(1|0)* | binary string starting with 1
+(1|0)*00 | binary string ending 00
+(0|1)*1(0|1)*1(0|1)*(0|1) | binary string with at least 3 1's, with the ones being between 4 binary strings that can contain anything and can be empty, exepct at the end, where it is a final 1, or 0, and nothing else
+111*((0|1)*|111)*(111)* | binary string with at least 3 consecutive 1's
+(0|1)*110(0|1)* | any binary string with 110 in the middle of it (or the start or end if the first terms occur 0 times)
diff --git a/comp/work/44/starter b/comp/work/44/starter
new file mode 100644
index 0000000..64dc05b
--- /dev/null
+++ b/comp/work/44/starter
@@ -0,0 +1,27 @@
+a+b
+accept:
+ab, aab
+reject:
+a, b, baa
+
+(bc)*a
+accept:
+a, bca, bcbca
+reject:
+bcaa, bcabca
+
+LL?D?D
+accept:
+SO14, BH12, DT6, W1
+reject:
+gu13, 1CH87
+
+0(0|1)*
+accept:
+0, 00, 01, 000, 001, 010
+reject:
+101
+(01)+
+10+1
+(0|1)*
+(10001|1000|1011|10111)
diff --git a/comp/work/44/task1 b/comp/work/44/task1
new file mode 100644
index 0000000..3179baa
--- /dev/null
+++ b/comp/work/44/task1
@@ -0,0 +1,6 @@
+(c|b+)a*
+
+s1 = s2(c), s3(b)
+(s2) = done, s4(a)
+(s3) = done, s3(b), s4(a)
+(s4) = done, s4(a)