-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMP.java
More file actions
1162 lines (994 loc) · 33.5 KB
/
MP.java
File metadata and controls
1162 lines (994 loc) · 33.5 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Arjemariel J. Requina
* CMSC 141 : Machine Problem Assignment 1
*
* Description : A program that asks an input file with C statements namely
* variable declarations, function declarations, and function definitions
* and have an output file that states whether each snippet of code is
* valid definition or declaration or not.
*
* Main Class : Parser
*
* Constraints :
* a. Usage of Regular Expressions are prohibited
*/
import java.io.*;
import java.util.*;
/**
* VAR AND VAR = false, VAR AND FUNC = false, FUNC AND VAR = true, FUNC AND FUNC = false
* The main class of the program. This contains the functions that does the checking of the
* C statements.
*/
class Parser {
private static final String VOID = "void";
private static final String INT = "int";
private static final String CHAR = "char";
private static final String FLOAT = "float";
private static final String DOUBLE = "double";
ArrayList<String> words;
ArrayList<Stop> stop_words;
ArrayList<Integer> visited;
ArrayList<Integer> s_queue;
ArrayList<State> states;
Checker checker;
FileHandler file_handler;
String input_filename;
String output_filename;
Graph graph;
String type;
ArrayList<String> declared;
int balance;
ArrayList<String> gen_var;
ArrayList<String> arr_var;
public Parser(String input_filename, String output_filename){
this.input_filename = input_filename;
this.output_filename = output_filename;
graph = new Graph();
states = graph.states();
checker = new Checker();
file_handler = new FileHandler(input_filename, output_filename);
visited = new ArrayList<>();
s_queue = new ArrayList<>();
s_queue.add(0);
declared = new ArrayList<>();
gen_var = new ArrayList<>();
arr_var = new ArrayList<>();
type = null;
retrieveContents();
balance = 0;
}
private void retrieveContents(){
words = file_handler.retrieveContents();
stop_words = file_handler.stop_words;
}
/**
* ; :: MODIFIER || MODIFIER :: ; || MODIFIER :: MODIFIER
*/
public void run(){
ArrayList<Integer> a = new ArrayList<>();
String s = "";
if(!stop_words.isEmpty()){
if(stop_words.size() > 1){
Stop start = stop_words.remove(0);
Result result = new Result();
boolean find_end = false;
while(!stop_words.isEmpty()){
Stop end = stop_words.remove(0);
if(checker.isModifier1(end.detail) && start.detail.equals(";")){
start = end;
if(!stop_words.isEmpty()){
end = stop_words.remove(0);
}
}
while(!end.detail.equals("}") && !end.detail.equals(";") && !stop_words.isEmpty()){
if(!stop_words.isEmpty()){
end = stop_words.remove(0);
}
}
System.out.println(start.detail);
System.out.println(end.detail);
result = checkPath(start, end, s_queue);
System.out.println(result.getResult());
if(checker.isModifier1(start.detail) && (end.detail.equals(";") || end.detail.equals("}"))){
s += result.getResult() + "\n";
}
start = end;
}
file_handler.writeResults(s);
System.out.println(s);
} else {
file_handler.writeResults("invalid variable declaration" + "\n");
}
}
//Stop start = stop_words.remove(0);
}
public Result checkPath(Stop start, Stop end, ArrayList<Integer> s_queue){
String var_name = "";
Result result = new Result();
int vis_index = -1;
ArrayList<Integer> next = new ArrayList<>();
ArrayList<String> declared = new ArrayList<>();
boolean stop_checking = false;
int i = start.index;
String ass_var = "";
State curr = null;
String word = null;
boolean valid = false;
while(!s_queue.isEmpty()){
boolean skip = false;
int idx = s_queue.remove(0);
// if(word.equals(";") || word.equals("}") && i == words.size() - 1){
// if(curr.next.contains(9)){
// System.out.println("VARIABLE");
// break;
// } if(curr.next.contains(34)){
// break;
// }
// }
System.out.println("-- WORD : " + word + " --");
System.out.println("-- STATE : " + idx);
if(idx > -1){
curr = states.get(idx);
word = words.get(i);
if(idx == 0){
if(checker.isModifier1(word)){
System.out.println(word + " : MODIFIER11");
type = word;
skip = true;
}
} if(idx == 1 || idx == 2 || idx == 3 || idx == 28 || // ALPHA, NUM, _ : variables
idx == 29 || idx == 30|| idx == 57|| idx == 58 || idx == 59) {
if(idx == 1 || idx == 28 || idx == 57){
if(checker.isAlpha(word)){
System.out.println(word + " : ALPHABET");
skip = true;
}
} else if(idx == 2 || idx == 29 || idx == 58){
if(word.equals(curr.detail)){
System.out.println(word + " : _");
skip = true;
}
} else if(idx == 3 || idx == 30 || idx == 59){
if(checker.isNum(word)){
System.out.println(word + " : NUM");
skip = true;
}
}
if(skip){
var_name = var_name + word;
skip = true;
}
} if(idx == 5 || idx == 19 || idx == 21 || // DECLARED
idx == 24|| idx == 45 || idx == 62 ) {
int prev = checker.getPrevious(visited.size() - 1, visited);
if(prev == 4){
if(checker.isValidVar(word)){
ass_var = ass_var + word;
skip = true;
}
} else if(prev == 17){
if(checker.isValidVar(word)){
ass_var = ass_var + word;
skip = true;
}
} else if(prev == 20 || prev == 8){
if(checker.isValidVar(word)){
ass_var = ass_var + word;
skip = true;
}
} else if(prev == 23){
if(checker.isValidVar(word)){
ass_var = ass_var + word;
skip = true;
}
} else if(prev == 35 || prev == 50 || prev == 55){
if(checker.isValidVar(word)){
ass_var = ass_var + word;
skip = true;
}
} else if(prev == 60 || prev == 61){
if(checker.isValidVar(word)){
ass_var = ass_var + word;
skip = true;
}
}
} if(idx == 6 || idx == 12 || idx == 40 ) { // NUM
int prev = checker.getPrevious(visited.size() - 1, visited);
if(idx == 6){
if(checker.isNum(word)){
skip = true;
System.out.println(word + " : NUM");
}
} else if(idx == 12){
if(checker.isNum(word)){
skip = true;
System.out.println(word + " : NUM");
}
} else if(idx == 40){
if(checker.isNum(word)){
skip = true;
System.out.println(word + " : NUM");
}
}
} if(idx == 8 || idx == 7 || idx == 32 || idx == 60) { // Store variable names
if(word.equals(curr.detail)){
if(idx == 8 || idx == 32){
if(!checker.isDeclared(var_name,result.declared)){
result.arr_dec.add(var_name);
result.declared.add(var_name);
skip = true;
var_name = "";
}
}
int prev = checker.getPrevious(visited.size() - 1, visited);
if(prev == 31){
if(!checker.isDeclared(var_name, result.declared)){
result.declared.add(var_name);
skip = true;
var_name = "";
}
} else if(prev == 57 || prev == 58 || prev == 59){
if(!checker.isDeclared(var_name, result.declared)){
result.declared.add(var_name);
skip = true;
var_name = "";
}
}
}
} if(idx == 35){ // Curly Open
if(word.equals(curr.detail)){
skip = true;
result.type = Result.FUNCN;
result.subtype = Result.DEFN;
}
} if(idx == 26){ // Paren Open
System.out.println(curr.detail + " -- " + curr.index);
if(word.equals(curr.detail)){
skip = true;
result.type = Result.FUNCN;
result.subtype = Result.DECN;
}
} if(idx == 34) { // Paren Close
if(word.equals(curr.detail)){
skip = true;
result.type = Result.FUNCN;
result.subtype = Result.DECN;
}
} if(idx == 15 || idx == 43) { // One Size
if(checker.hasOneSize(word)){
skip = true;
}
} if(idx == 9 || idx == 36 || idx == 53 || // End }, ;
idx == 73|| idx == 75) {
if(word.equals(curr.detail)){
if(idx == 9) {
if(checker.isVisited(4, visited)){
skip = true;
}
System.out.println(var_name);
if(!checker.isDeclared(var_name, result.declared)){
result.declared.add(var_name);
var_name = "";
} else {
result.validity = Result.INVALID;
}
} else {
skip = true;
}
if(idx == 9){
result.validity = Result.VALID;
System.out.println(result.getResult());
if(ass_var.equals("")){
if(checker.isDeclared(ass_var, result.declared)){
skip = true;
ass_var = "";
}
ass_var = "";
}
} else if(idx == 36){
result.validity = Result.VALID;
result.type = Result.FUNCN;
result.subtype = Result.DECN;
skip = true;
} else if(idx == 75){
result.validity = Result.VALID;
result.type = Result.FUNCN;
result.subtype = Result.DEFN;
skip = true;
} else if(idx == 53 || idx == 73){
result.validity = Result.VALID;
result.type = Result.FUNCN;
result.subtype = Result.DEFN;
skip = true;
}
}
} if(idx == 7 || idx == 18 || idx == 22 || idx == 72){ // Check Assigned
if(!ass_var.equals("")){
System.out.println(ass_var);
if(checker.isDeclared(ass_var, result.declared) && !checker.isDeclared(ass_var, result.arr_dec)){
skip = true;
ass_var = "";
} else {
result.validity = Result.INVALID;
}
ass_var = "";
}
if(idx == 7){
skip = true;
} else if(idx == 18){
if(words.get(i++).equals(";") || words.get(i++).equals(",")){
skip = true;
result.validity = Result.VALID;
} else {
result.validity = Result.INVALID;
}
}
} if(idx == 27 || idx == 56) { // MODIFIER2
} if(idx == 38) { // RUNFUNCTION
skip = true;
Parser parser = new Parser(input_filename, output_filename)
//LATER
} if(idx == 37) { // check return keyword
if(checker.isReturn(word)){
skip = true;
}
} if(idx == 47 || idx == 51 || idx == 67 || idx == 69){ // Postincrements og post decrements
if(!(checker.isVisited(50, visited) && !checker.isVisited(55, visited)) &&
!(checker.isVisited(64, visited) && !checker.isVisited(66, visited))) {
skip = true;
}
} if(idx == 13 || idx == 41){ // DECIMAL point
if(word.equals(curr.detail)){
if(!(checker.isVisited(13, visited)) && !(checker.isVisited(41, visited)) && !type.equals("char")){
skip = true;
}
}
// if(!(checker.isVisited(13, visited)) && !(checker.isVisited(41, visited)) && !type.equals("char")){
// skip = true;
// }
} else if(idx == 14 || idx == 42) {
if(word.equals(curr.detail)){
if(type.equals("int") || type.equals("char")){
skip = true;
}
}
} else if(idx == 11 || idx == 39){
if(word.equals(curr.detail)){
if(!type.equals("char")){
skip = true;
}
}
} else if(idx == 46 || idx == 71){ // OPERATORS
int prev = checker.getPrevious(visited.size() - 1, visited);
if(prev == 45){
if(checker.isOperator(word)){
skip = true;
}
} else if(prev == 62){
if(checker.isOperator(word)){
skip = true;
}
}
} else {
if(word.equals(curr.detail)){
skip = true;
}
}
}
if(skip){
visited.add(curr.index);
s_queue = (ArrayList<Integer>)curr.next.clone();
System.out.println(s_queue);
if(i == end.index){
break;
} if(i < end.index){
++i;
}
}
}
// if(word != null && word.equals(";")){
// if(curr.next.contains(9)){
// result.validity = Result.VALID;
// }
// } else if(word != null && word.equals(")")){
// if(curr.next.contains(9)){
// result.validity = Result.VALID;
// result.type = Result.FUNCN;
// }
// }
//file_handler.writeResults(result.getResult() + "\n");
System.out.println(result.getResult());
if(result.validity.equals(Result.INVALID)){
declared.clear();
visited.clear();
s_queue.clear();
s_queue.add(0);
}
if(s_queue.contains(-1)){
s_queue.clear();
s_queue.add(0);
}
this.s_queue = s_queue;
return result;
}
public static void main(String[] args) {
try {
System.out.print("Enter the input filename (w/ extension): ");
Scanner input = new Scanner(System.in);
String input_filename = input.nextLine();
if(input_filename.isEmpty()){
input_filename = "input.in";
}
System.out.print("Enter the output filename (w/ extension): ");
String output_filename = input.nextLine();
if(output_filename.isEmpty()){
output_filename = "output.out";
}
Parser parser = new Parser(input_filename, output_filename);
parser.run();
input.close();
} catch(Exception e) {
e.printStackTrace();
}
}
}
/**
* A Helper Class that handles the checking
*/
class Checker {
ArrayList<String> reserved;
ArrayList<String> reserved_sym;
ArrayList<String> operators;
public Checker(){
reserved = new ArrayList<>();
reserved_sym = new ArrayList<>();
operators = new ArrayList<>();
init();
}
/**
* Function initializer of ArrayLists with values
*/
private void init(){
/**
* Initializes the reserved ArrayList with the
* reserved keywords
*/
reserved.add("int");
reserved.add("void");
reserved.add("float");
reserved.add("double");
reserved.add("char");
reserved.add("return");
reserved.add("for");
reserved.add("while");
reserved.add("do");
Collections.sort(reserved);
/**
* Initializes the reserved symbols ArrayList
*/
reserved_sym.add(";");
// reserved_sym.add(",");
// reserved_sym.add("(");
// reserved_sym.add(")");
// reserved_sym.add("[");
// reserved_sym.add("]");
// reserved_sym.add("{");
reserved_sym.add("}");
Collections.sort(reserved_sym);
/**
* Initializes the operators ArrayList
*/
operators.add("+");
operators.add("-");
operators.add("/");
operators.add("*");
operators.add("%");
Collections.sort(operators);
}
/**
* Checks if the word is a modifier including void
*/
public boolean isValidVar(String word) {
return isAlpha(word) || isNum(word) || word.equals("_");
}
public boolean isModifier1(String word) {
int index = Collections.binarySearch(reserved, word);
if(index >= 0){
return reserved.get(index).equals(word)
&& !reserved.get(index).equals("return");
}
return false;
}
/**
* Checks if the word is a modifier excluding void
*/
public boolean isModifier2(String word) {
int index = Collections.binarySearch(reserved, word);
if(index >= 0){
if(reserved.get(index).equals(word)){
return !reserved.get(index).equals("void") &&
!reserved.get(index).equals("return");
}
}
return false;
}
/**
* Checks if the word is a return keyword
*/
public boolean isReturn(String word) {
int index = Collections.binarySearch(reserved, word);
if(index >= 0){
if(reserved.get(index).equals(word)){
return reserved.get(index).equals("return");
}
}
return false;
}
public boolean isSymbol(String word){
int index = Collections.binarySearch(reserved_sym, word);
if(index >= 0){
return reserved_sym.get(index).equals(word);
}
return false;
}
public boolean isOperator(String word){
int index = Collections.binarySearch(operators, word);
if(index >= 0){
return operators.get(index).equals(word);
}
return false;
}
/**
* Checks if the character is an alphabet
*/
public boolean isAlpha(String word) {
char ch = word.charAt(0);
System.out.println(ch);
return (ch >= 'A' && ch <= 'Z') ||
(ch >= 'a' && ch <= 'z');
}
/**
* Checks if the character is a number
*/
public boolean isNum(String word) {
char ch = word.charAt(0);
return (ch >= '0' && ch <= '9');
}
public boolean isOpen(String word) {
return word.equals("(") ||
word.equals("{") ||
word.equals("[");
}
public boolean isClose(String word) {
return word.equals(")") ||
word.equals("}") ||
word.equals("]");
}
public boolean isReserved(String word){
int index = Collections.binarySearch(reserved, word);
if(index >= 0){
return reserved.get(index).equals(word);
}
return false;
}
public boolean isDeclared(String word, ArrayList<String> declared){
Collections.sort(declared);
int index = Collections.binarySearch(declared, word);
if(index >= 0){
return declared.get(index).equals(word);
}
return false;
}
public boolean isVisited(int idx, ArrayList<Integer> indeces){
return indeces.contains(idx);
}
public boolean hasOneSize(String word){
return word.length() == 1;
}
public int getPrevious(int idx, ArrayList<Integer> visited){
if(idx >= visited.size()){
return visited.get(idx);
}
return -1;
}
}
/**
* The helper class that handles the file handling which includes reading the contents from the file
* and writing the output to a file. All filenames are entered by the user and all files involved
* are assumed to be text file.
*/
class FileHandler {
String input_filename;
String output_filename;
public String file_contents;
public ArrayList<Stop> stop_words;
/**
* The constructor for the class that accepts the input filename and output filename
* as parameters.
*/
public FileHandler(String input_filename, String output_filename) {
this.input_filename = input_filename;
this.output_filename = output_filename;
file_contents = "";
stop_words = new ArrayList<>();
}
/**
* The function that retrieves the strings by line from the input file with the filename
* stored in the input_filename variable. Afterwards, each line are splitted by space and
* each are appended on an ArrayList of Strings. After reading the file, the ArrayList
* will be returned.
*/
public ArrayList<String> retrieveContents() {
try {
Checker checker = new Checker();
ArrayList<String> contents = new ArrayList<>();
File file = new File(input_filename);
Scanner reader = new Scanner(file);
int i = 0;
while (reader.hasNextLine()){
String line = reader.nextLine();
line = line.replaceAll("\n", " ").replaceAll("\t", " ");
while(line.indexOf(" ") >= 0){
line = line.replace(" ", " ");
}
//System.out.print(line.length() + " --> ")
if(!line.isEmpty() && !line.equals(" ")){
String line_array[] = line.split(" ");
for(String str : line_array) {
//System.out.println(str.equals(" "));
if(!str.equals(" ") && !str.equals("\n")){
if(checker.isModifier1(str)){
Stop stop = new Stop(str, i);
this.stop_words.add(stop);
System.out.println(str);
++i;
contents.add(str);
} else {
String c[] = str.split("");
for(String ch : c){
if(ch.equals(" "));
if(checker.isSymbol(ch)){
Stop stop = new Stop(ch, i);
this.stop_words.add(stop);
System.out.println(ch);
}
contents.add(ch);
++i;
}
}
}
}
file_contents += line;
}
}
System.out.println(contents);
reader.close();
return contents;
} catch(Exception e) {
e.printStackTrace();
}
return null;
}
/**
* The function that write the results to output file in checking the input file
* in which the filename is stored in the output_filename.
* Accepts a string which contains the results.
*/
public void writeResults(String result) {
try {
Writer writer = new FileWriter(output_filename);
writer.write(result);
writer.flush();
writer.close();
} catch(Exception e){
e.printStackTrace();
}
}
/**
* The function that displays the contents of the file input which are stored
* in file_contents variable.
*/
public void displayContents() {
System.out.println(file_contents);
}
}
class Graph {
public ArrayList<State> states;
public Graph(){
states = new ArrayList<>();
construct();
}
private void construct(){
ArrayList<Integer> next = new ArrayList<>();
State state = new State("MODIFIER1", 0);
state.next("1,2");
states.add(state);
state = new State("ALPHA", 1);
state.next("3,1,8,4,10,9,26,2");
states.add(state);
System.out.println(state.next);
state = new State("_", 2);
state.next("2,9,8,4,10,3,26,1");
states.add(state);
state = new State("NUM", 3);
state.next("3,2,1,9,10,4,8,26");
states.add(state);
state = new State("[", 4);
state.next("6,5,7");
states.add(state);
state = new State("DECLARED", 5);
state.next("7,5");
states.add(state);
state = new State("NUM", 6);
state.next("6,7");
states.add(state);
state = new State("]", 7);
state.next("9,10,8");
states.add(state);
state = new State("=", 8);
state.next("12,14,11,23,17,20,21");
states.add(state);
state = new State(";", 9);
state.next("-1");
states.add(state);
state = new State(",", 10);
state.next("12,14,11,1,2");
states.add(state);
state = new State("-", 11);
state.next("12");
states.add(state);
state = new State("NUM", 12);
state.next("13,12,10,18,22,25,9");
states.add(state);
state = new State(".", 13);
state.next("12");
states.add(state);
state = new State("'", 14);
state.next("15");
states.add(state);
state = new State("1L", 15);
state.next("16");
states.add(state);
state = new State("'", 16);
state.next("10,18,22,25,9");
states.add(state);
state = new State("{", 17);
state.next("12,14,11,19");
states.add(state);
state = new State("}", 18);
state.next("9,10");
states.add(state);
state = new State("DECLARED", 19);
state.next("10,18");
states.add(state);
state = new State("(", 20);
state.next("21,12,14,11");
states.add(state);
state = new State("DECLARED", 21);
state.next("10,22,9");
states.add(state);
state = new State(")", 22);
state.next("9,10");
states.add(state);
state = new State("{", 23);
state.next("11,12,14,13,24");
states.add(state);
state = new State("DECLARED", 24);
state.next("25");
states.add(state);
state = new State("}", 25);
state.next("9,10");
states.add(state);
state = new State("(", 26);
state.next("27,34");
states.add(state);
state = new State("MODIFIER2", 27);
state.next("28,29");
states.add(state);
state = new State("ALPHA", 28);
state.next("28,29,31,34,30");
states.add(state);
state = new State("_", 29);
state.next("29,28,31,34,30");
states.add(state);
state = new State("NUM", 30);
state.next("30,34,31,28,29");
states.add(state);
state = new State("[", 31);
state.next("32");
states.add(state);
state = new State("]", 32);
state.next("33,34");
states.add(state);
state = new State(",", 33);
state.next("27");
states.add(state);
state = new State(")", 34);
state.next("35,36");
states.add(state);
state = new State("{", 35);
state.next("75,38,54,49,45,56,35");
states.add(state);
state = new State(";", 36);
state.next("-1");
states.add(state);
state = new State("RETURN", 37);
state.next("54,49,40,42,39,45");
states.add(state);
state = new State("RUNFUNCTION", 38);
state.next("38,75,54,49,45,56,37");
states.add(state);
state = new State("-", 39);
state.next("40");
states.add(state);
state = new State("NUM", 40);
state.next("40,41,46,53,71,72,73");
states.add(state);
state = new State(".", 41);
state.next("40");
states.add(state);
state = new State("'", 42);
state.next("43");
states.add(state);
state = new State("1L", 43);
state.next("44");
states.add(state);
state = new State("'", 44);
state.next("46,53,71,72,73");
states.add(state);
state = new State("DECLARED", 45);
state.next("46,53,47,51,60");
states.add(state);
state = new State("OPERATORS", 46);
state.next("40,42,39,45");
states.add(state);
state = new State("+", 47);
state.next("48");
states.add(state);
state = new State("+", 48);
state.next("46,53");
states.add(state);
state = new State("+", 49);
state.next("50");
states.add(state);
state = new State("+", 50);
state.next("45");
states.add(state);
state = new State("-", 51);
state.next("52");
states.add(state);
state = new State("-", 52);
state.next("46,53");
states.add(state);
state = new State(";", 53);
state.next("54,49,45,56,38,75,37");
states.add(state);
state = new State("-", 54);
state.next("55");
states.add(state);