-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregex3.era
More file actions
executable file
·67 lines (45 loc) · 2.11 KB
/
Copy pathregex3.era
File metadata and controls
executable file
·67 lines (45 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
ones = ("I"^"1") | ("II"^"2") | ("III"^"3") | ("IV"^"4") | ("V"^"5") | ("VI"^"6") | ("VII"^"7") | ("VIII"^"8") | ("IX"^"9") ;
ones0 = ones | (""^"0");
tens = ("X"^"1") | ("XX"^"2") | ("XXX"^"3") | ("XL"^"4") | ("L"^"5") | ("LX"^"6") | ("LXX"^"7") | ("LXXX"^"8") | ("XC"^"9") ;
tens0 = tens | (""^"0");
hundreds = ("C"^"1") | ("CC"^"2") | ("CCC"^"3") | ("CD"^"4") | ("D"^"5") | ("DC"^"6") | ("DCC"^"7") | ("DCCC"^"8") | ("CM"^"9") ;
hundreds0 = hundreds | (""^"0");
thousands = ("M"^"1") | ("MM"^"2") | ("MMM"^"3") | ("MF"^"4") | ("F"^"5") | ("FM"^"6") | ("FMM"^"7") | ("FT"^"9");
thousands0 = thousands | (""^"0");
tthousands = ("T"^"1") | ("TT"^"2") | ("TTT"^"3");
N1_99 = ones | (tens . ones0);
N00_99 = tens0 . ones0;
N1_999 = N1_99 | ( hundreds . N00_99) ;
N000_999 = hundreds0 . N00_99 ;
N1_9999 = N1_999 | (thousands . N000_999);
N0000_9999 = thousands0 . N000_999;
N1_39999 = N1_9999 | (tthousands . N0000_9999) ;
printLanguage("N:", "/dev/stdout");
testInfiniteAmbiguity(N1_39999); -> 0
testFunctionality(N1_39999); -> 1
testBoundedVariation(N1_39999); -> 1
printLanguage("N+:", "/dev/stdout");
R = N1_39999+;
testInfiniteAmbiguity(R); -> 0
testFunctionality(R); -> 0
testBoundedVariation(R);
printLanguage("N +:", "/dev/stdout");
B = N1_39999 . ((" "^""). N1_39999)*;
testInfiniteAmbiguity(B); -> 0
testFunctionality(B); -> 1
testBoundedVariation(B); -> 1
printLanguage("S :", "/dev/stdout");
S = ( ( ("T"^"1").(" "^""))* . N1_9999 ) | ( ( ("T"^"1").(" "^" "))* . (tthousands . N0000_9999) );
testInfiniteAmbiguity(S); -> 0
testFunctionality(S); -> 1
testBoundedVariation(S);
printLanguage("S1 :", "/dev/stdout");
S1 = ( ( (("T"^"1")|("M"^"1")).(" "^""))* . N1_9999 ) | ( ( (("T"^"1")|("M"^"1")).(" "^" "))* . (tthousands . N0000_9999) );
testInfiniteAmbiguity(S1);
testFunctionality(S1);
testBoundedVariation(S1);
printLanguage("S2 :", "/dev/stdout");
S2 = ( ( (("T"^"1")|("M"^"2")).(" "^""))* . N1_9999 ) | ( ( (("T"^"1")|("M"^"2")).(" "^" "))* . (tthousands . N0000_9999) );
testInfiniteAmbiguity(S2);
testFunctionality(S2);
testBoundedVariation(S2);