diff --git a/lab/.idea/.gitignore b/lab/.idea/.gitignore new file mode 100644 index 0000000..6382e52 --- /dev/null +++ b/lab/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/../../../../:\Projects\ANTLR-compiler\.idea/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/lab/.idea/ANTLR-compiler.iml b/lab/.idea/ANTLR-compiler.iml new file mode 100644 index 0000000..78b2cc5 --- /dev/null +++ b/lab/.idea/ANTLR-compiler.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/lab/.idea/compiler.xml b/lab/.idea/compiler.xml new file mode 100644 index 0000000..af6298d --- /dev/null +++ b/lab/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/lab/.idea/jarRepositories.xml b/lab/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/lab/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/lab/.idea/misc.xml b/lab/.idea/misc.xml new file mode 100644 index 0000000..e6ee860 --- /dev/null +++ b/lab/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/lab/.idea/modules.xml b/lab/.idea/modules.xml new file mode 100644 index 0000000..eda5256 --- /dev/null +++ b/lab/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/lab/.idea/uiDesigner.xml b/lab/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/lab/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lab/ANTLR-compiler.iml b/lab/ANTLR-compiler.iml new file mode 100644 index 0000000..78b2cc5 --- /dev/null +++ b/lab/ANTLR-compiler.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/lab/gen/xml.interp b/lab/gen/xml.interp new file mode 100644 index 0000000..cc51c35 --- /dev/null +++ b/lab/gen/xml.interp @@ -0,0 +1,124 @@ +token literal names: +null +',' +null +null +null +null +'document' +'node' +'attribute' +'string' +'int' +'float' +'else' +'if' +'for' +'while' +'in' +'and' +'or' +'new' +null +null +null +null +'(' +')' +'[' +']' +'{' +'}' +';' +'\'' +'"' +'=' +'+=' +'.' +'>' +'<' +'==' +'!=' +'>=' +'<=' +'+' +'-' +'*' +'/' +null + +token symbolic names: +null +null +ARRAY_TYPE +TYPE +ACTION_OPERATOR +BOOL_OPERATOR +DOCUMENT +NODE +ATTRIBUTE +STRING +INT +FLOAT +ELSE +IF +FOR +WHILE +IN +AND +OR +NEW +NAME +NUMBER_LITERAL +STRING_LITERAL +WHITESPACE +OPEN_BRACKET +CLOSE_BRACKET +OPEN_SQUAR_EBRACKET +CLOSE_SQUARE_BRACKET +OPEN_FIGURE_BRACKET +CLOSE_FIGURE_BRACKET +SEMICOLON +QOUTES_ONE +QOUTES_TWO +ASSIGMENT +SUM_ASSIGMENT +DOT +MORE_THAN +LESS_THAN +EQUAL +NOT_EQUAL +MORE_EQUAL +LESS_EQUAL +PlUS +MINUS +MULTIPLICATION +DIVISION +COMMENT + +rule names: +operation +initialise_var +assignment +add_assignment +get_elem +get_array_elem +func_call +params +initialise_func +if_block +else_if_block +else_block +if_statement +for_statement +range_statement +while_statement +condition +type_cast +expression +get_operation +xml + + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 48, 282, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 53, 10, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 4, 66, 10, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 72, 10, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 82, 10, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 98, 10, 6, 3, 6, 7, 6, 101, 10, 6, 12, 6, 14, 6, 104, 11, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 5, 8, 112, 10, 8, 3, 8, 3, 8, 3, 8, 5, 8, 117, 10, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 7, 9, 125, 10, 9, 12, 9, 14, 9, 128, 11, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 7, 10, 138, 10, 10, 12, 10, 14, 10, 141, 11, 10, 5, 10, 143, 10, 10, 3, 10, 3, 10, 3, 10, 7, 10, 148, 10, 10, 12, 10, 14, 10, 151, 11, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 7, 11, 161, 10, 11, 12, 11, 14, 11, 164, 11, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 7, 12, 175, 10, 12, 12, 12, 14, 12, 178, 11, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 7, 13, 185, 10, 13, 12, 13, 14, 13, 188, 11, 13, 3, 13, 3, 13, 3, 14, 3, 14, 7, 14, 194, 10, 14, 12, 14, 14, 14, 197, 11, 14, 3, 14, 5, 14, 200, 10, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 7, 15, 208, 10, 15, 12, 15, 14, 15, 211, 11, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 7, 17, 226, 10, 17, 12, 17, 14, 17, 229, 11, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 7, 18, 238, 10, 18, 12, 18, 14, 18, 241, 11, 18, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 5, 20, 258, 10, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 7, 20, 266, 10, 20, 12, 20, 14, 20, 269, 11, 20, 3, 21, 3, 21, 3, 21, 5, 21, 274, 10, 21, 3, 22, 3, 22, 6, 22, 278, 10, 22, 13, 22, 14, 22, 279, 3, 22, 2, 4, 10, 38, 23, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 2, 4, 3, 2, 4, 5, 3, 2, 22, 24, 2, 296, 2, 52, 3, 2, 2, 2, 4, 54, 3, 2, 2, 2, 6, 65, 3, 2, 2, 2, 8, 77, 3, 2, 2, 2, 10, 87, 3, 2, 2, 2, 12, 105, 3, 2, 2, 2, 14, 111, 3, 2, 2, 2, 16, 121, 3, 2, 2, 2, 18, 129, 3, 2, 2, 2, 20, 154, 3, 2, 2, 2, 22, 167, 3, 2, 2, 2, 24, 181, 3, 2, 2, 2, 26, 191, 3, 2, 2, 2, 28, 201, 3, 2, 2, 2, 30, 214, 3, 2, 2, 2, 32, 219, 3, 2, 2, 2, 34, 232, 3, 2, 2, 2, 36, 242, 3, 2, 2, 2, 38, 257, 3, 2, 2, 2, 40, 273, 3, 2, 2, 2, 42, 277, 3, 2, 2, 2, 44, 53, 5, 40, 21, 2, 45, 53, 5, 4, 3, 2, 46, 53, 5, 6, 4, 2, 47, 53, 5, 8, 5, 2, 48, 53, 5, 26, 14, 2, 49, 53, 5, 28, 15, 2, 50, 53, 5, 32, 17, 2, 51, 53, 5, 36, 19, 2, 52, 44, 3, 2, 2, 2, 52, 45, 3, 2, 2, 2, 52, 46, 3, 2, 2, 2, 52, 47, 3, 2, 2, 2, 52, 48, 3, 2, 2, 2, 52, 49, 3, 2, 2, 2, 52, 50, 3, 2, 2, 2, 52, 51, 3, 2, 2, 2, 53, 3, 3, 2, 2, 2, 54, 55, 7, 5, 2, 2, 55, 56, 7, 22, 2, 2, 56, 57, 7, 35, 2, 2, 57, 58, 7, 21, 2, 2, 58, 59, 7, 5, 2, 2, 59, 60, 7, 26, 2, 2, 60, 61, 5, 38, 20, 2, 61, 62, 7, 27, 2, 2, 62, 63, 7, 32, 2, 2, 63, 5, 3, 2, 2, 2, 64, 66, 9, 2, 2, 2, 65, 64, 3, 2, 2, 2, 65, 66, 3, 2, 2, 2, 66, 67, 3, 2, 2, 2, 67, 71, 7, 22, 2, 2, 68, 69, 7, 26, 2, 2, 69, 70, 7, 23, 2, 2, 70, 72, 7, 27, 2, 2, 71, 68, 3, 2, 2, 2, 71, 72, 3, 2, 2, 2, 72, 73, 3, 2, 2, 2, 73, 74, 7, 35, 2, 2, 74, 75, 5, 38, 20, 2, 75, 76, 7, 32, 2, 2, 76, 7, 3, 2, 2, 2, 77, 81, 7, 22, 2, 2, 78, 79, 7, 26, 2, 2, 79, 80, 7, 23, 2, 2, 80, 82, 7, 27, 2, 2, 81, 78, 3, 2, 2, 2, 81, 82, 3, 2, 2, 2, 82, 83, 3, 2, 2, 2, 83, 84, 7, 36, 2, 2, 84, 85, 5, 38, 20, 2, 85, 86, 7, 32, 2, 2, 86, 9, 3, 2, 2, 2, 87, 88, 8, 6, 1, 2, 88, 89, 7, 22, 2, 2, 89, 90, 7, 37, 2, 2, 90, 91, 7, 22, 2, 2, 91, 102, 3, 2, 2, 2, 92, 93, 12, 5, 2, 2, 93, 101, 7, 32, 2, 2, 94, 95, 12, 4, 2, 2, 95, 97, 7, 26, 2, 2, 96, 98, 5, 16, 9, 2, 97, 96, 3, 2, 2, 2, 97, 98, 3, 2, 2, 2, 98, 99, 3, 2, 2, 2, 99, 101, 7, 27, 2, 2, 100, 92, 3, 2, 2, 2, 100, 94, 3, 2, 2, 2, 101, 104, 3, 2, 2, 2, 102, 100, 3, 2, 2, 2, 102, 103, 3, 2, 2, 2, 103, 11, 3, 2, 2, 2, 104, 102, 3, 2, 2, 2, 105, 106, 7, 22, 2, 2, 106, 107, 7, 28, 2, 2, 107, 108, 7, 23, 2, 2, 108, 109, 7, 29, 2, 2, 109, 13, 3, 2, 2, 2, 110, 112, 9, 2, 2, 2, 111, 110, 3, 2, 2, 2, 111, 112, 3, 2, 2, 2, 112, 113, 3, 2, 2, 2, 113, 114, 7, 22, 2, 2, 114, 116, 7, 26, 2, 2, 115, 117, 5, 16, 9, 2, 116, 115, 3, 2, 2, 2, 116, 117, 3, 2, 2, 2, 117, 118, 3, 2, 2, 2, 118, 119, 7, 27, 2, 2, 119, 120, 7, 32, 2, 2, 120, 15, 3, 2, 2, 2, 121, 126, 5, 38, 20, 2, 122, 123, 7, 3, 2, 2, 123, 125, 5, 38, 20, 2, 124, 122, 3, 2, 2, 2, 125, 128, 3, 2, 2, 2, 126, 124, 3, 2, 2, 2, 126, 127, 3, 2, 2, 2, 127, 17, 3, 2, 2, 2, 128, 126, 3, 2, 2, 2, 129, 130, 9, 2, 2, 2, 130, 131, 7, 22, 2, 2, 131, 142, 7, 26, 2, 2, 132, 133, 9, 2, 2, 2, 133, 139, 7, 22, 2, 2, 134, 135, 7, 3, 2, 2, 135, 136, 9, 2, 2, 2, 136, 138, 7, 22, 2, 2, 137, 134, 3, 2, 2, 2, 138, 141, 3, 2, 2, 2, 139, 137, 3, 2, 2, 2, 139, 140, 3, 2, 2, 2, 140, 143, 3, 2, 2, 2, 141, 139, 3, 2, 2, 2, 142, 132, 3, 2, 2, 2, 142, 143, 3, 2, 2, 2, 143, 144, 3, 2, 2, 2, 144, 145, 7, 27, 2, 2, 145, 149, 7, 30, 2, 2, 146, 148, 5, 2, 2, 2, 147, 146, 3, 2, 2, 2, 148, 151, 3, 2, 2, 2, 149, 147, 3, 2, 2, 2, 149, 150, 3, 2, 2, 2, 150, 152, 3, 2, 2, 2, 151, 149, 3, 2, 2, 2, 152, 153, 7, 31, 2, 2, 153, 19, 3, 2, 2, 2, 154, 155, 7, 15, 2, 2, 155, 156, 7, 26, 2, 2, 156, 157, 5, 34, 18, 2, 157, 158, 7, 27, 2, 2, 158, 162, 7, 30, 2, 2, 159, 161, 5, 2, 2, 2, 160, 159, 3, 2, 2, 2, 161, 164, 3, 2, 2, 2, 162, 160, 3, 2, 2, 2, 162, 163, 3, 2, 2, 2, 163, 165, 3, 2, 2, 2, 164, 162, 3, 2, 2, 2, 165, 166, 7, 31, 2, 2, 166, 21, 3, 2, 2, 2, 167, 168, 7, 14, 2, 2, 168, 169, 7, 15, 2, 2, 169, 170, 7, 26, 2, 2, 170, 171, 5, 34, 18, 2, 171, 172, 7, 27, 2, 2, 172, 176, 7, 30, 2, 2, 173, 175, 5, 2, 2, 2, 174, 173, 3, 2, 2, 2, 175, 178, 3, 2, 2, 2, 176, 174, 3, 2, 2, 2, 176, 177, 3, 2, 2, 2, 177, 179, 3, 2, 2, 2, 178, 176, 3, 2, 2, 2, 179, 180, 7, 31, 2, 2, 180, 23, 3, 2, 2, 2, 181, 182, 7, 14, 2, 2, 182, 186, 7, 30, 2, 2, 183, 185, 5, 2, 2, 2, 184, 183, 3, 2, 2, 2, 185, 188, 3, 2, 2, 2, 186, 184, 3, 2, 2, 2, 186, 187, 3, 2, 2, 2, 187, 189, 3, 2, 2, 2, 188, 186, 3, 2, 2, 2, 189, 190, 7, 31, 2, 2, 190, 25, 3, 2, 2, 2, 191, 195, 5, 20, 11, 2, 192, 194, 5, 22, 12, 2, 193, 192, 3, 2, 2, 2, 194, 197, 3, 2, 2, 2, 195, 193, 3, 2, 2, 2, 195, 196, 3, 2, 2, 2, 196, 199, 3, 2, 2, 2, 197, 195, 3, 2, 2, 2, 198, 200, 5, 24, 13, 2, 199, 198, 3, 2, 2, 2, 199, 200, 3, 2, 2, 2, 200, 27, 3, 2, 2, 2, 201, 202, 7, 16, 2, 2, 202, 203, 7, 26, 2, 2, 203, 204, 5, 30, 16, 2, 204, 205, 7, 27, 2, 2, 205, 209, 7, 30, 2, 2, 206, 208, 5, 2, 2, 2, 207, 206, 3, 2, 2, 2, 208, 211, 3, 2, 2, 2, 209, 207, 3, 2, 2, 2, 209, 210, 3, 2, 2, 2, 210, 212, 3, 2, 2, 2, 211, 209, 3, 2, 2, 2, 212, 213, 7, 31, 2, 2, 213, 29, 3, 2, 2, 2, 214, 215, 9, 2, 2, 2, 215, 216, 7, 22, 2, 2, 216, 217, 7, 18, 2, 2, 217, 218, 7, 22, 2, 2, 218, 31, 3, 2, 2, 2, 219, 220, 7, 17, 2, 2, 220, 221, 7, 26, 2, 2, 221, 222, 5, 34, 18, 2, 222, 223, 7, 27, 2, 2, 223, 227, 7, 30, 2, 2, 224, 226, 5, 2, 2, 2, 225, 224, 3, 2, 2, 2, 226, 229, 3, 2, 2, 2, 227, 225, 3, 2, 2, 2, 227, 228, 3, 2, 2, 2, 228, 230, 3, 2, 2, 2, 229, 227, 3, 2, 2, 2, 230, 231, 7, 31, 2, 2, 231, 33, 3, 2, 2, 2, 232, 239, 5, 38, 20, 2, 233, 234, 7, 19, 2, 2, 234, 238, 5, 38, 20, 2, 235, 236, 7, 20, 2, 2, 236, 238, 5, 38, 20, 2, 237, 233, 3, 2, 2, 2, 237, 235, 3, 2, 2, 2, 238, 241, 3, 2, 2, 2, 239, 237, 3, 2, 2, 2, 239, 240, 3, 2, 2, 2, 240, 35, 3, 2, 2, 2, 241, 239, 3, 2, 2, 2, 242, 243, 7, 22, 2, 2, 243, 244, 7, 35, 2, 2, 244, 245, 7, 26, 2, 2, 245, 246, 7, 5, 2, 2, 246, 247, 7, 27, 2, 2, 247, 248, 7, 22, 2, 2, 248, 249, 7, 32, 2, 2, 249, 37, 3, 2, 2, 2, 250, 251, 8, 20, 1, 2, 251, 252, 7, 26, 2, 2, 252, 253, 5, 38, 20, 2, 253, 254, 7, 27, 2, 2, 254, 258, 3, 2, 2, 2, 255, 258, 5, 40, 21, 2, 256, 258, 9, 3, 2, 2, 257, 250, 3, 2, 2, 2, 257, 255, 3, 2, 2, 2, 257, 256, 3, 2, 2, 2, 258, 267, 3, 2, 2, 2, 259, 260, 12, 6, 2, 2, 260, 261, 7, 6, 2, 2, 261, 266, 5, 38, 20, 7, 262, 263, 12, 5, 2, 2, 263, 264, 7, 7, 2, 2, 264, 266, 5, 38, 20, 6, 265, 259, 3, 2, 2, 2, 265, 262, 3, 2, 2, 2, 266, 269, 3, 2, 2, 2, 267, 265, 3, 2, 2, 2, 267, 268, 3, 2, 2, 2, 268, 39, 3, 2, 2, 2, 269, 267, 3, 2, 2, 2, 270, 274, 5, 10, 6, 2, 271, 274, 5, 14, 8, 2, 272, 274, 5, 12, 7, 2, 273, 270, 3, 2, 2, 2, 273, 271, 3, 2, 2, 2, 273, 272, 3, 2, 2, 2, 274, 41, 3, 2, 2, 2, 275, 278, 5, 2, 2, 2, 276, 278, 5, 18, 10, 2, 277, 275, 3, 2, 2, 2, 277, 276, 3, 2, 2, 2, 278, 279, 3, 2, 2, 2, 279, 277, 3, 2, 2, 2, 279, 280, 3, 2, 2, 2, 280, 43, 3, 2, 2, 2, 30, 52, 65, 71, 81, 97, 100, 102, 111, 116, 126, 139, 142, 149, 162, 176, 186, 195, 199, 209, 227, 237, 239, 257, 265, 267, 273, 277, 279] \ No newline at end of file diff --git a/lab/gen/xml.tokens b/lab/gen/xml.tokens new file mode 100644 index 0000000..2e703d3 --- /dev/null +++ b/lab/gen/xml.tokens @@ -0,0 +1,83 @@ +T__0=1 +ARRAY_TYPE=2 +TYPE=3 +ACTION_OPERATOR=4 +BOOL_OPERATOR=5 +DOCUMENT=6 +NODE=7 +ATTRIBUTE=8 +STRING=9 +INT=10 +FLOAT=11 +ELSE=12 +IF=13 +FOR=14 +WHILE=15 +IN=16 +AND=17 +OR=18 +NEW=19 +NAME=20 +NUMBER_LITERAL=21 +STRING_LITERAL=22 +WHITESPACE=23 +OPEN_BRACKET=24 +CLOSE_BRACKET=25 +OPEN_SQUAR_EBRACKET=26 +CLOSE_SQUARE_BRACKET=27 +OPEN_FIGURE_BRACKET=28 +CLOSE_FIGURE_BRACKET=29 +SEMICOLON=30 +QOUTES_ONE=31 +QOUTES_TWO=32 +ASSIGMENT=33 +SUM_ASSIGMENT=34 +DOT=35 +MORE_THAN=36 +LESS_THAN=37 +EQUAL=38 +NOT_EQUAL=39 +MORE_EQUAL=40 +LESS_EQUAL=41 +PlUS=42 +MINUS=43 +MULTIPLICATION=44 +DIVISION=45 +COMMENT=46 +','=1 +'document'=6 +'node'=7 +'attribute'=8 +'string'=9 +'int'=10 +'float'=11 +'else'=12 +'if'=13 +'for'=14 +'while'=15 +'in'=16 +'and'=17 +'or'=18 +'new'=19 +'('=24 +')'=25 +'['=26 +']'=27 +'{'=28 +'}'=29 +';'=30 +'\''=31 +'"'=32 +'='=33 +'+='=34 +'.'=35 +'>'=36 +'<'=37 +'=='=38 +'!='=39 +'>='=40 +'<='=41 +'+'=42 +'-'=43 +'*'=44 +'/'=45 diff --git a/lab/gen/xmlBaseListener.java b/lab/gen/xmlBaseListener.java new file mode 100644 index 0000000..e7311fc --- /dev/null +++ b/lab/gen/xmlBaseListener.java @@ -0,0 +1,290 @@ +// Generated from D:/Projects/ANTLR-compiler/src/main/antlr4\xml.g4 by ANTLR 4.9.1 + +import org.antlr.v4.runtime.ParserRuleContext; +import org.antlr.v4.runtime.tree.ErrorNode; +import org.antlr.v4.runtime.tree.TerminalNode; + +/** + * This class provides an empty implementation of {@link xmlListener}, + * which can be extended to create a listener which only needs to handle a subset + * of the available methods. + */ +public class xmlBaseListener implements xmlListener { + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterOperation(xmlParser.OperationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitOperation(xmlParser.OperationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInitialise_var(xmlParser.Initialise_varContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInitialise_var(xmlParser.Initialise_varContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAssignment(xmlParser.AssignmentContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAssignment(xmlParser.AssignmentContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAdd_assignment(xmlParser.Add_assignmentContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAdd_assignment(xmlParser.Add_assignmentContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGet_elem(xmlParser.Get_elemContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGet_elem(xmlParser.Get_elemContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGet_array_elem(xmlParser.Get_array_elemContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGet_array_elem(xmlParser.Get_array_elemContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFunc_call(xmlParser.Func_callContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFunc_call(xmlParser.Func_callContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterParams(xmlParser.ParamsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitParams(xmlParser.ParamsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInitialise_func(xmlParser.Initialise_funcContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInitialise_func(xmlParser.Initialise_funcContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterIf_block(xmlParser.If_blockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitIf_block(xmlParser.If_blockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterElse_if_block(xmlParser.Else_if_blockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitElse_if_block(xmlParser.Else_if_blockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterElse_block(xmlParser.Else_blockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitElse_block(xmlParser.Else_blockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterIf_statement(xmlParser.If_statementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitIf_statement(xmlParser.If_statementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFor_statement(xmlParser.For_statementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFor_statement(xmlParser.For_statementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRange_statement(xmlParser.Range_statementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRange_statement(xmlParser.Range_statementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterWhile_statement(xmlParser.While_statementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitWhile_statement(xmlParser.While_statementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCondition(xmlParser.ConditionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCondition(xmlParser.ConditionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterType_cast(xmlParser.Type_castContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitType_cast(xmlParser.Type_castContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterExpression(xmlParser.ExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitExpression(xmlParser.ExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGet_operation(xmlParser.Get_operationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGet_operation(xmlParser.Get_operationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterXml(xmlParser.XmlContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitXml(xmlParser.XmlContext ctx) { } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEveryRule(ParserRuleContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEveryRule(ParserRuleContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void visitTerminal(TerminalNode node) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void visitErrorNode(ErrorNode node) { } +} \ No newline at end of file diff --git a/lab/gen/xmlBaseVisitor.java b/lab/gen/xmlBaseVisitor.java new file mode 100644 index 0000000..c9924a6 --- /dev/null +++ b/lab/gen/xmlBaseVisitor.java @@ -0,0 +1,160 @@ +// Generated from D:/Projects/ANTLR-compiler/src/main/antlr4\xml.g4 by ANTLR 4.9.1 +import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; + +/** + * This class provides an empty implementation of {@link xmlVisitor}, + * which can be extended to create a visitor which only needs to handle a subset + * of the available methods. + * + * @param The return type of the visit operation. Use {@link Void} for + * operations with no return type. + */ +public class xmlBaseVisitor extends AbstractParseTreeVisitor implements xmlVisitor { + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitOperation(xmlParser.OperationContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitInitialise_var(xmlParser.Initialise_varContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAssignment(xmlParser.AssignmentContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAdd_assignment(xmlParser.Add_assignmentContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitGet_elem(xmlParser.Get_elemContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitGet_array_elem(xmlParser.Get_array_elemContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitFunc_call(xmlParser.Func_callContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitParams(xmlParser.ParamsContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitInitialise_func(xmlParser.Initialise_funcContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitIf_block(xmlParser.If_blockContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitElse_if_block(xmlParser.Else_if_blockContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitElse_block(xmlParser.Else_blockContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitIf_statement(xmlParser.If_statementContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitFor_statement(xmlParser.For_statementContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitRange_statement(xmlParser.Range_statementContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitWhile_statement(xmlParser.While_statementContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitCondition(xmlParser.ConditionContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitType_cast(xmlParser.Type_castContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitExpression(xmlParser.ExpressionContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitGet_operation(xmlParser.Get_operationContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitXml(xmlParser.XmlContext ctx) { return visitChildren(ctx); } +} \ No newline at end of file diff --git a/lab/gen/xmlLexer.interp b/lab/gen/xmlLexer.interp new file mode 100644 index 0000000..8e1ad4e --- /dev/null +++ b/lab/gen/xmlLexer.interp @@ -0,0 +1,155 @@ +token literal names: +null +',' +null +null +null +null +'document' +'node' +'attribute' +'string' +'int' +'float' +'else' +'if' +'for' +'while' +'in' +'and' +'or' +'new' +null +null +null +null +'(' +')' +'[' +']' +'{' +'}' +';' +'\'' +'"' +'=' +'+=' +'.' +'>' +'<' +'==' +'!=' +'>=' +'<=' +'+' +'-' +'*' +'/' +null + +token symbolic names: +null +null +ARRAY_TYPE +TYPE +ACTION_OPERATOR +BOOL_OPERATOR +DOCUMENT +NODE +ATTRIBUTE +STRING +INT +FLOAT +ELSE +IF +FOR +WHILE +IN +AND +OR +NEW +NAME +NUMBER_LITERAL +STRING_LITERAL +WHITESPACE +OPEN_BRACKET +CLOSE_BRACKET +OPEN_SQUAR_EBRACKET +CLOSE_SQUARE_BRACKET +OPEN_FIGURE_BRACKET +CLOSE_FIGURE_BRACKET +SEMICOLON +QOUTES_ONE +QOUTES_TWO +ASSIGMENT +SUM_ASSIGMENT +DOT +MORE_THAN +LESS_THAN +EQUAL +NOT_EQUAL +MORE_EQUAL +LESS_EQUAL +PlUS +MINUS +MULTIPLICATION +DIVISION +COMMENT + +rule names: +T__0 +ARRAY_TYPE +TYPE +ACTION_OPERATOR +BOOL_OPERATOR +DOCUMENT +NODE +ATTRIBUTE +STRING +INT +FLOAT +ELSE +IF +FOR +WHILE +IN +AND +OR +NEW +NAME +NUMBER_LITERAL +STRING_LITERAL +WHITESPACE +OPEN_BRACKET +CLOSE_BRACKET +OPEN_SQUAR_EBRACKET +CLOSE_SQUARE_BRACKET +OPEN_FIGURE_BRACKET +CLOSE_FIGURE_BRACKET +SEMICOLON +QOUTES_ONE +QOUTES_TWO +ASSIGMENT +SUM_ASSIGMENT +DOT +MORE_THAN +LESS_THAN +EQUAL +NOT_EQUAL +MORE_EQUAL +LESS_EQUAL +PlUS +MINUS +MULTIPLICATION +DIVISION +COMMENT + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 48, 303, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 108, 10, 4, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 114, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 122, 10, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 21, 6, 21, 198, 10, 21, 13, 21, 14, 21, 199, 3, 22, 6, 22, 203, 10, 22, 13, 22, 14, 22, 204, 3, 22, 3, 22, 6, 22, 209, 10, 22, 13, 22, 14, 22, 210, 5, 22, 213, 10, 22, 3, 23, 3, 23, 7, 23, 217, 10, 23, 12, 23, 14, 23, 220, 11, 23, 3, 23, 3, 23, 3, 23, 3, 23, 7, 23, 226, 10, 23, 12, 23, 14, 23, 229, 11, 23, 3, 23, 3, 23, 5, 23, 233, 10, 23, 3, 24, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 26, 3, 26, 3, 27, 3, 27, 3, 28, 3, 28, 3, 29, 3, 29, 3, 30, 3, 30, 3, 31, 3, 31, 3, 32, 3, 32, 3, 33, 3, 33, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 3, 36, 3, 36, 3, 37, 3, 37, 3, 38, 3, 38, 3, 39, 3, 39, 3, 39, 3, 40, 3, 40, 3, 40, 3, 41, 3, 41, 3, 41, 3, 42, 3, 42, 3, 42, 3, 43, 3, 43, 3, 44, 3, 44, 3, 45, 3, 45, 3, 46, 3, 46, 3, 47, 3, 47, 3, 47, 3, 47, 7, 47, 292, 10, 47, 12, 47, 14, 47, 295, 11, 47, 3, 47, 5, 47, 298, 10, 47, 3, 47, 3, 47, 3, 47, 3, 47, 4, 218, 227, 2, 48, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, 42, 83, 43, 85, 44, 87, 45, 89, 46, 91, 47, 93, 48, 3, 2, 6, 4, 2, 67, 92, 99, 124, 3, 2, 50, 59, 4, 2, 11, 12, 34, 34, 4, 2, 12, 12, 15, 15, 2, 324, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 91, 3, 2, 2, 2, 2, 93, 3, 2, 2, 2, 3, 95, 3, 2, 2, 2, 5, 97, 3, 2, 2, 2, 7, 107, 3, 2, 2, 2, 9, 113, 3, 2, 2, 2, 11, 121, 3, 2, 2, 2, 13, 123, 3, 2, 2, 2, 15, 132, 3, 2, 2, 2, 17, 137, 3, 2, 2, 2, 19, 147, 3, 2, 2, 2, 21, 154, 3, 2, 2, 2, 23, 158, 3, 2, 2, 2, 25, 164, 3, 2, 2, 2, 27, 169, 3, 2, 2, 2, 29, 172, 3, 2, 2, 2, 31, 176, 3, 2, 2, 2, 33, 182, 3, 2, 2, 2, 35, 185, 3, 2, 2, 2, 37, 189, 3, 2, 2, 2, 39, 192, 3, 2, 2, 2, 41, 197, 3, 2, 2, 2, 43, 202, 3, 2, 2, 2, 45, 232, 3, 2, 2, 2, 47, 234, 3, 2, 2, 2, 49, 238, 3, 2, 2, 2, 51, 240, 3, 2, 2, 2, 53, 242, 3, 2, 2, 2, 55, 244, 3, 2, 2, 2, 57, 246, 3, 2, 2, 2, 59, 248, 3, 2, 2, 2, 61, 250, 3, 2, 2, 2, 63, 252, 3, 2, 2, 2, 65, 254, 3, 2, 2, 2, 67, 256, 3, 2, 2, 2, 69, 258, 3, 2, 2, 2, 71, 261, 3, 2, 2, 2, 73, 263, 3, 2, 2, 2, 75, 265, 3, 2, 2, 2, 77, 267, 3, 2, 2, 2, 79, 270, 3, 2, 2, 2, 81, 273, 3, 2, 2, 2, 83, 276, 3, 2, 2, 2, 85, 279, 3, 2, 2, 2, 87, 281, 3, 2, 2, 2, 89, 283, 3, 2, 2, 2, 91, 285, 3, 2, 2, 2, 93, 287, 3, 2, 2, 2, 95, 96, 7, 46, 2, 2, 96, 4, 3, 2, 2, 2, 97, 98, 5, 7, 4, 2, 98, 99, 5, 53, 27, 2, 99, 100, 5, 55, 28, 2, 100, 6, 3, 2, 2, 2, 101, 108, 5, 13, 7, 2, 102, 108, 5, 15, 8, 2, 103, 108, 5, 17, 9, 2, 104, 108, 5, 19, 10, 2, 105, 108, 5, 21, 11, 2, 106, 108, 5, 23, 12, 2, 107, 101, 3, 2, 2, 2, 107, 102, 3, 2, 2, 2, 107, 103, 3, 2, 2, 2, 107, 104, 3, 2, 2, 2, 107, 105, 3, 2, 2, 2, 107, 106, 3, 2, 2, 2, 108, 8, 3, 2, 2, 2, 109, 114, 5, 85, 43, 2, 110, 114, 5, 87, 44, 2, 111, 114, 5, 89, 45, 2, 112, 114, 5, 91, 46, 2, 113, 109, 3, 2, 2, 2, 113, 110, 3, 2, 2, 2, 113, 111, 3, 2, 2, 2, 113, 112, 3, 2, 2, 2, 114, 10, 3, 2, 2, 2, 115, 122, 5, 73, 37, 2, 116, 122, 5, 81, 41, 2, 117, 122, 5, 75, 38, 2, 118, 122, 5, 83, 42, 2, 119, 122, 5, 77, 39, 2, 120, 122, 5, 79, 40, 2, 121, 115, 3, 2, 2, 2, 121, 116, 3, 2, 2, 2, 121, 117, 3, 2, 2, 2, 121, 118, 3, 2, 2, 2, 121, 119, 3, 2, 2, 2, 121, 120, 3, 2, 2, 2, 122, 12, 3, 2, 2, 2, 123, 124, 7, 102, 2, 2, 124, 125, 7, 113, 2, 2, 125, 126, 7, 101, 2, 2, 126, 127, 7, 119, 2, 2, 127, 128, 7, 111, 2, 2, 128, 129, 7, 103, 2, 2, 129, 130, 7, 112, 2, 2, 130, 131, 7, 118, 2, 2, 131, 14, 3, 2, 2, 2, 132, 133, 7, 112, 2, 2, 133, 134, 7, 113, 2, 2, 134, 135, 7, 102, 2, 2, 135, 136, 7, 103, 2, 2, 136, 16, 3, 2, 2, 2, 137, 138, 7, 99, 2, 2, 138, 139, 7, 118, 2, 2, 139, 140, 7, 118, 2, 2, 140, 141, 7, 116, 2, 2, 141, 142, 7, 107, 2, 2, 142, 143, 7, 100, 2, 2, 143, 144, 7, 119, 2, 2, 144, 145, 7, 118, 2, 2, 145, 146, 7, 103, 2, 2, 146, 18, 3, 2, 2, 2, 147, 148, 7, 117, 2, 2, 148, 149, 7, 118, 2, 2, 149, 150, 7, 116, 2, 2, 150, 151, 7, 107, 2, 2, 151, 152, 7, 112, 2, 2, 152, 153, 7, 105, 2, 2, 153, 20, 3, 2, 2, 2, 154, 155, 7, 107, 2, 2, 155, 156, 7, 112, 2, 2, 156, 157, 7, 118, 2, 2, 157, 22, 3, 2, 2, 2, 158, 159, 7, 104, 2, 2, 159, 160, 7, 110, 2, 2, 160, 161, 7, 113, 2, 2, 161, 162, 7, 99, 2, 2, 162, 163, 7, 118, 2, 2, 163, 24, 3, 2, 2, 2, 164, 165, 7, 103, 2, 2, 165, 166, 7, 110, 2, 2, 166, 167, 7, 117, 2, 2, 167, 168, 7, 103, 2, 2, 168, 26, 3, 2, 2, 2, 169, 170, 7, 107, 2, 2, 170, 171, 7, 104, 2, 2, 171, 28, 3, 2, 2, 2, 172, 173, 7, 104, 2, 2, 173, 174, 7, 113, 2, 2, 174, 175, 7, 116, 2, 2, 175, 30, 3, 2, 2, 2, 176, 177, 7, 121, 2, 2, 177, 178, 7, 106, 2, 2, 178, 179, 7, 107, 2, 2, 179, 180, 7, 110, 2, 2, 180, 181, 7, 103, 2, 2, 181, 32, 3, 2, 2, 2, 182, 183, 7, 107, 2, 2, 183, 184, 7, 112, 2, 2, 184, 34, 3, 2, 2, 2, 185, 186, 7, 99, 2, 2, 186, 187, 7, 112, 2, 2, 187, 188, 7, 102, 2, 2, 188, 36, 3, 2, 2, 2, 189, 190, 7, 113, 2, 2, 190, 191, 7, 116, 2, 2, 191, 38, 3, 2, 2, 2, 192, 193, 7, 112, 2, 2, 193, 194, 7, 103, 2, 2, 194, 195, 7, 121, 2, 2, 195, 40, 3, 2, 2, 2, 196, 198, 9, 2, 2, 2, 197, 196, 3, 2, 2, 2, 198, 199, 3, 2, 2, 2, 199, 197, 3, 2, 2, 2, 199, 200, 3, 2, 2, 2, 200, 42, 3, 2, 2, 2, 201, 203, 9, 3, 2, 2, 202, 201, 3, 2, 2, 2, 203, 204, 3, 2, 2, 2, 204, 202, 3, 2, 2, 2, 204, 205, 3, 2, 2, 2, 205, 212, 3, 2, 2, 2, 206, 208, 7, 48, 2, 2, 207, 209, 9, 3, 2, 2, 208, 207, 3, 2, 2, 2, 209, 210, 3, 2, 2, 2, 210, 208, 3, 2, 2, 2, 210, 211, 3, 2, 2, 2, 211, 213, 3, 2, 2, 2, 212, 206, 3, 2, 2, 2, 212, 213, 3, 2, 2, 2, 213, 44, 3, 2, 2, 2, 214, 218, 5, 63, 32, 2, 215, 217, 11, 2, 2, 2, 216, 215, 3, 2, 2, 2, 217, 220, 3, 2, 2, 2, 218, 219, 3, 2, 2, 2, 218, 216, 3, 2, 2, 2, 219, 221, 3, 2, 2, 2, 220, 218, 3, 2, 2, 2, 221, 222, 5, 63, 32, 2, 222, 233, 3, 2, 2, 2, 223, 227, 5, 65, 33, 2, 224, 226, 11, 2, 2, 2, 225, 224, 3, 2, 2, 2, 226, 229, 3, 2, 2, 2, 227, 228, 3, 2, 2, 2, 227, 225, 3, 2, 2, 2, 228, 230, 3, 2, 2, 2, 229, 227, 3, 2, 2, 2, 230, 231, 5, 65, 33, 2, 231, 233, 3, 2, 2, 2, 232, 214, 3, 2, 2, 2, 232, 223, 3, 2, 2, 2, 233, 46, 3, 2, 2, 2, 234, 235, 9, 4, 2, 2, 235, 236, 3, 2, 2, 2, 236, 237, 8, 24, 2, 2, 237, 48, 3, 2, 2, 2, 238, 239, 7, 42, 2, 2, 239, 50, 3, 2, 2, 2, 240, 241, 7, 43, 2, 2, 241, 52, 3, 2, 2, 2, 242, 243, 7, 93, 2, 2, 243, 54, 3, 2, 2, 2, 244, 245, 7, 95, 2, 2, 245, 56, 3, 2, 2, 2, 246, 247, 7, 125, 2, 2, 247, 58, 3, 2, 2, 2, 248, 249, 7, 127, 2, 2, 249, 60, 3, 2, 2, 2, 250, 251, 7, 61, 2, 2, 251, 62, 3, 2, 2, 2, 252, 253, 7, 41, 2, 2, 253, 64, 3, 2, 2, 2, 254, 255, 7, 36, 2, 2, 255, 66, 3, 2, 2, 2, 256, 257, 7, 63, 2, 2, 257, 68, 3, 2, 2, 2, 258, 259, 7, 45, 2, 2, 259, 260, 7, 63, 2, 2, 260, 70, 3, 2, 2, 2, 261, 262, 7, 48, 2, 2, 262, 72, 3, 2, 2, 2, 263, 264, 7, 64, 2, 2, 264, 74, 3, 2, 2, 2, 265, 266, 7, 62, 2, 2, 266, 76, 3, 2, 2, 2, 267, 268, 7, 63, 2, 2, 268, 269, 7, 63, 2, 2, 269, 78, 3, 2, 2, 2, 270, 271, 7, 35, 2, 2, 271, 272, 7, 63, 2, 2, 272, 80, 3, 2, 2, 2, 273, 274, 7, 64, 2, 2, 274, 275, 7, 63, 2, 2, 275, 82, 3, 2, 2, 2, 276, 277, 7, 62, 2, 2, 277, 278, 7, 63, 2, 2, 278, 84, 3, 2, 2, 2, 279, 280, 7, 45, 2, 2, 280, 86, 3, 2, 2, 2, 281, 282, 7, 47, 2, 2, 282, 88, 3, 2, 2, 2, 283, 284, 7, 44, 2, 2, 284, 90, 3, 2, 2, 2, 285, 286, 7, 49, 2, 2, 286, 92, 3, 2, 2, 2, 287, 288, 7, 49, 2, 2, 288, 289, 7, 49, 2, 2, 289, 293, 3, 2, 2, 2, 290, 292, 10, 5, 2, 2, 291, 290, 3, 2, 2, 2, 292, 295, 3, 2, 2, 2, 293, 291, 3, 2, 2, 2, 293, 294, 3, 2, 2, 2, 294, 297, 3, 2, 2, 2, 295, 293, 3, 2, 2, 2, 296, 298, 7, 15, 2, 2, 297, 296, 3, 2, 2, 2, 297, 298, 3, 2, 2, 2, 298, 299, 3, 2, 2, 2, 299, 300, 7, 12, 2, 2, 300, 301, 3, 2, 2, 2, 301, 302, 8, 47, 2, 2, 302, 94, 3, 2, 2, 2, 15, 2, 107, 113, 121, 199, 204, 210, 212, 218, 227, 232, 293, 297, 3, 8, 2, 2] \ No newline at end of file diff --git a/lab/gen/xmlLexer.java b/lab/gen/xmlLexer.java new file mode 100644 index 0000000..43a3994 --- /dev/null +++ b/lab/gen/xmlLexer.java @@ -0,0 +1,236 @@ +// Generated from D:/Projects/ANTLR-compiler/src/main/antlr4\xml.g4 by ANTLR 4.9.1 +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +public class xmlLexer extends Lexer { + static { RuntimeMetaData.checkVersion("4.9.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + T__0=1, ARRAY_TYPE=2, TYPE=3, ACTION_OPERATOR=4, BOOL_OPERATOR=5, DOCUMENT=6, + NODE=7, ATTRIBUTE=8, STRING=9, INT=10, FLOAT=11, ELSE=12, IF=13, FOR=14, + WHILE=15, IN=16, AND=17, OR=18, NEW=19, NAME=20, NUMBER_LITERAL=21, STRING_LITERAL=22, + WHITESPACE=23, OPEN_BRACKET=24, CLOSE_BRACKET=25, OPEN_SQUAR_EBRACKET=26, + CLOSE_SQUARE_BRACKET=27, OPEN_FIGURE_BRACKET=28, CLOSE_FIGURE_BRACKET=29, + SEMICOLON=30, QOUTES_ONE=31, QOUTES_TWO=32, ASSIGMENT=33, SUM_ASSIGMENT=34, + DOT=35, MORE_THAN=36, LESS_THAN=37, EQUAL=38, NOT_EQUAL=39, MORE_EQUAL=40, + LESS_EQUAL=41, PlUS=42, MINUS=43, MULTIPLICATION=44, DIVISION=45, COMMENT=46; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + private static String[] makeRuleNames() { + return new String[] { + "T__0", "ARRAY_TYPE", "TYPE", "ACTION_OPERATOR", "BOOL_OPERATOR", "DOCUMENT", + "NODE", "ATTRIBUTE", "STRING", "INT", "FLOAT", "ELSE", "IF", "FOR", "WHILE", + "IN", "AND", "OR", "NEW", "NAME", "NUMBER_LITERAL", "STRING_LITERAL", + "WHITESPACE", "OPEN_BRACKET", "CLOSE_BRACKET", "OPEN_SQUAR_EBRACKET", + "CLOSE_SQUARE_BRACKET", "OPEN_FIGURE_BRACKET", "CLOSE_FIGURE_BRACKET", + "SEMICOLON", "QOUTES_ONE", "QOUTES_TWO", "ASSIGMENT", "SUM_ASSIGMENT", + "DOT", "MORE_THAN", "LESS_THAN", "EQUAL", "NOT_EQUAL", "MORE_EQUAL", + "LESS_EQUAL", "PlUS", "MINUS", "MULTIPLICATION", "DIVISION", "COMMENT" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, "','", null, null, null, null, "'document'", "'node'", "'attribute'", + "'string'", "'int'", "'float'", "'else'", "'if'", "'for'", "'while'", + "'in'", "'and'", "'or'", "'new'", null, null, null, null, "'('", "')'", + "'['", "']'", "'{'", "'}'", "';'", "'''", "'\"'", "'='", "'+='", "'.'", + "'>'", "'<'", "'=='", "'!='", "'>='", "'<='", "'+'", "'-'", "'*'", "'/'" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, null, "ARRAY_TYPE", "TYPE", "ACTION_OPERATOR", "BOOL_OPERATOR", + "DOCUMENT", "NODE", "ATTRIBUTE", "STRING", "INT", "FLOAT", "ELSE", "IF", + "FOR", "WHILE", "IN", "AND", "OR", "NEW", "NAME", "NUMBER_LITERAL", "STRING_LITERAL", + "WHITESPACE", "OPEN_BRACKET", "CLOSE_BRACKET", "OPEN_SQUAR_EBRACKET", + "CLOSE_SQUARE_BRACKET", "OPEN_FIGURE_BRACKET", "CLOSE_FIGURE_BRACKET", + "SEMICOLON", "QOUTES_ONE", "QOUTES_TWO", "ASSIGMENT", "SUM_ASSIGMENT", + "DOT", "MORE_THAN", "LESS_THAN", "EQUAL", "NOT_EQUAL", "MORE_EQUAL", + "LESS_EQUAL", "PlUS", "MINUS", "MULTIPLICATION", "DIVISION", "COMMENT" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + + public xmlLexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @Override + public String getGrammarFileName() { return "xml.g4"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public String[] getChannelNames() { return channelNames; } + + @Override + public String[] getModeNames() { return modeNames; } + + @Override + public ATN getATN() { return _ATN; } + + public static final String _serializedATN = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\60\u012f\b\1\4\2"+ + "\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4"+ + "\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22"+ + "\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31"+ + "\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t"+ + " \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t"+ + "+\4,\t,\4-\t-\4.\t.\4/\t/\3\2\3\2\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4"+ + "\3\4\5\4l\n\4\3\5\3\5\3\5\3\5\5\5r\n\5\3\6\3\6\3\6\3\6\3\6\3\6\5\6z\n"+ + "\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\b\3\b\3\b\3\b\3\b\3\t\3\t\3\t"+ + "\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13"+ + "\3\13\3\f\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\16\3\16\3\16\3\17"+ + "\3\17\3\17\3\17\3\20\3\20\3\20\3\20\3\20\3\20\3\21\3\21\3\21\3\22\3\22"+ + "\3\22\3\22\3\23\3\23\3\23\3\24\3\24\3\24\3\24\3\25\6\25\u00c6\n\25\r\25"+ + "\16\25\u00c7\3\26\6\26\u00cb\n\26\r\26\16\26\u00cc\3\26\3\26\6\26\u00d1"+ + "\n\26\r\26\16\26\u00d2\5\26\u00d5\n\26\3\27\3\27\7\27\u00d9\n\27\f\27"+ + "\16\27\u00dc\13\27\3\27\3\27\3\27\3\27\7\27\u00e2\n\27\f\27\16\27\u00e5"+ + "\13\27\3\27\3\27\5\27\u00e9\n\27\3\30\3\30\3\30\3\30\3\31\3\31\3\32\3"+ + "\32\3\33\3\33\3\34\3\34\3\35\3\35\3\36\3\36\3\37\3\37\3 \3 \3!\3!\3\""+ + "\3\"\3#\3#\3#\3$\3$\3%\3%\3&\3&\3\'\3\'\3\'\3(\3(\3(\3)\3)\3)\3*\3*\3"+ + "*\3+\3+\3,\3,\3-\3-\3.\3.\3/\3/\3/\3/\7/\u0124\n/\f/\16/\u0127\13/\3/"+ + "\5/\u012a\n/\3/\3/\3/\3/\4\u00da\u00e3\2\60\3\3\5\4\7\5\t\6\13\7\r\b\17"+ + "\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20\37\21!\22#\23%\24\'\25)\26+"+ + "\27-\30/\31\61\32\63\33\65\34\67\359\36;\37= ?!A\"C#E$G%I&K\'M(O)Q*S+"+ + "U,W-Y.[/]\60\3\2\6\4\2C\\c|\3\2\62;\4\2\13\f\"\"\4\2\f\f\17\17\2\u0144"+ + "\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2"+ + "\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2"+ + "\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2"+ + "\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2"+ + "\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3"+ + "\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2"+ + "\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2"+ + "U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2\3_\3\2\2\2\5a\3"+ + "\2\2\2\7k\3\2\2\2\tq\3\2\2\2\13y\3\2\2\2\r{\3\2\2\2\17\u0084\3\2\2\2\21"+ + "\u0089\3\2\2\2\23\u0093\3\2\2\2\25\u009a\3\2\2\2\27\u009e\3\2\2\2\31\u00a4"+ + "\3\2\2\2\33\u00a9\3\2\2\2\35\u00ac\3\2\2\2\37\u00b0\3\2\2\2!\u00b6\3\2"+ + "\2\2#\u00b9\3\2\2\2%\u00bd\3\2\2\2\'\u00c0\3\2\2\2)\u00c5\3\2\2\2+\u00ca"+ + "\3\2\2\2-\u00e8\3\2\2\2/\u00ea\3\2\2\2\61\u00ee\3\2\2\2\63\u00f0\3\2\2"+ + "\2\65\u00f2\3\2\2\2\67\u00f4\3\2\2\29\u00f6\3\2\2\2;\u00f8\3\2\2\2=\u00fa"+ + "\3\2\2\2?\u00fc\3\2\2\2A\u00fe\3\2\2\2C\u0100\3\2\2\2E\u0102\3\2\2\2G"+ + "\u0105\3\2\2\2I\u0107\3\2\2\2K\u0109\3\2\2\2M\u010b\3\2\2\2O\u010e\3\2"+ + "\2\2Q\u0111\3\2\2\2S\u0114\3\2\2\2U\u0117\3\2\2\2W\u0119\3\2\2\2Y\u011b"+ + "\3\2\2\2[\u011d\3\2\2\2]\u011f\3\2\2\2_`\7.\2\2`\4\3\2\2\2ab\5\7\4\2b"+ + "c\5\65\33\2cd\5\67\34\2d\6\3\2\2\2el\5\r\7\2fl\5\17\b\2gl\5\21\t\2hl\5"+ + "\23\n\2il\5\25\13\2jl\5\27\f\2ke\3\2\2\2kf\3\2\2\2kg\3\2\2\2kh\3\2\2\2"+ + "ki\3\2\2\2kj\3\2\2\2l\b\3\2\2\2mr\5U+\2nr\5W,\2or\5Y-\2pr\5[.\2qm\3\2"+ + "\2\2qn\3\2\2\2qo\3\2\2\2qp\3\2\2\2r\n\3\2\2\2sz\5I%\2tz\5Q)\2uz\5K&\2"+ + "vz\5S*\2wz\5M\'\2xz\5O(\2ys\3\2\2\2yt\3\2\2\2yu\3\2\2\2yv\3\2\2\2yw\3"+ + "\2\2\2yx\3\2\2\2z\f\3\2\2\2{|\7f\2\2|}\7q\2\2}~\7e\2\2~\177\7w\2\2\177"+ + "\u0080\7o\2\2\u0080\u0081\7g\2\2\u0081\u0082\7p\2\2\u0082\u0083\7v\2\2"+ + "\u0083\16\3\2\2\2\u0084\u0085\7p\2\2\u0085\u0086\7q\2\2\u0086\u0087\7"+ + "f\2\2\u0087\u0088\7g\2\2\u0088\20\3\2\2\2\u0089\u008a\7c\2\2\u008a\u008b"+ + "\7v\2\2\u008b\u008c\7v\2\2\u008c\u008d\7t\2\2\u008d\u008e\7k\2\2\u008e"+ + "\u008f\7d\2\2\u008f\u0090\7w\2\2\u0090\u0091\7v\2\2\u0091\u0092\7g\2\2"+ + "\u0092\22\3\2\2\2\u0093\u0094\7u\2\2\u0094\u0095\7v\2\2\u0095\u0096\7"+ + "t\2\2\u0096\u0097\7k\2\2\u0097\u0098\7p\2\2\u0098\u0099\7i\2\2\u0099\24"+ + "\3\2\2\2\u009a\u009b\7k\2\2\u009b\u009c\7p\2\2\u009c\u009d\7v\2\2\u009d"+ + "\26\3\2\2\2\u009e\u009f\7h\2\2\u009f\u00a0\7n\2\2\u00a0\u00a1\7q\2\2\u00a1"+ + "\u00a2\7c\2\2\u00a2\u00a3\7v\2\2\u00a3\30\3\2\2\2\u00a4\u00a5\7g\2\2\u00a5"+ + "\u00a6\7n\2\2\u00a6\u00a7\7u\2\2\u00a7\u00a8\7g\2\2\u00a8\32\3\2\2\2\u00a9"+ + "\u00aa\7k\2\2\u00aa\u00ab\7h\2\2\u00ab\34\3\2\2\2\u00ac\u00ad\7h\2\2\u00ad"+ + "\u00ae\7q\2\2\u00ae\u00af\7t\2\2\u00af\36\3\2\2\2\u00b0\u00b1\7y\2\2\u00b1"+ + "\u00b2\7j\2\2\u00b2\u00b3\7k\2\2\u00b3\u00b4\7n\2\2\u00b4\u00b5\7g\2\2"+ + "\u00b5 \3\2\2\2\u00b6\u00b7\7k\2\2\u00b7\u00b8\7p\2\2\u00b8\"\3\2\2\2"+ + "\u00b9\u00ba\7c\2\2\u00ba\u00bb\7p\2\2\u00bb\u00bc\7f\2\2\u00bc$\3\2\2"+ + "\2\u00bd\u00be\7q\2\2\u00be\u00bf\7t\2\2\u00bf&\3\2\2\2\u00c0\u00c1\7"+ + "p\2\2\u00c1\u00c2\7g\2\2\u00c2\u00c3\7y\2\2\u00c3(\3\2\2\2\u00c4\u00c6"+ + "\t\2\2\2\u00c5\u00c4\3\2\2\2\u00c6\u00c7\3\2\2\2\u00c7\u00c5\3\2\2\2\u00c7"+ + "\u00c8\3\2\2\2\u00c8*\3\2\2\2\u00c9\u00cb\t\3\2\2\u00ca\u00c9\3\2\2\2"+ + "\u00cb\u00cc\3\2\2\2\u00cc\u00ca\3\2\2\2\u00cc\u00cd\3\2\2\2\u00cd\u00d4"+ + "\3\2\2\2\u00ce\u00d0\7\60\2\2\u00cf\u00d1\t\3\2\2\u00d0\u00cf\3\2\2\2"+ + "\u00d1\u00d2\3\2\2\2\u00d2\u00d0\3\2\2\2\u00d2\u00d3\3\2\2\2\u00d3\u00d5"+ + "\3\2\2\2\u00d4\u00ce\3\2\2\2\u00d4\u00d5\3\2\2\2\u00d5,\3\2\2\2\u00d6"+ + "\u00da\5? \2\u00d7\u00d9\13\2\2\2\u00d8\u00d7\3\2\2\2\u00d9\u00dc\3\2"+ + "\2\2\u00da\u00db\3\2\2\2\u00da\u00d8\3\2\2\2\u00db\u00dd\3\2\2\2\u00dc"+ + "\u00da\3\2\2\2\u00dd\u00de\5? \2\u00de\u00e9\3\2\2\2\u00df\u00e3\5A!\2"+ + "\u00e0\u00e2\13\2\2\2\u00e1\u00e0\3\2\2\2\u00e2\u00e5\3\2\2\2\u00e3\u00e4"+ + "\3\2\2\2\u00e3\u00e1\3\2\2\2\u00e4\u00e6\3\2\2\2\u00e5\u00e3\3\2\2\2\u00e6"+ + "\u00e7\5A!\2\u00e7\u00e9\3\2\2\2\u00e8\u00d6\3\2\2\2\u00e8\u00df\3\2\2"+ + "\2\u00e9.\3\2\2\2\u00ea\u00eb\t\4\2\2\u00eb\u00ec\3\2\2\2\u00ec\u00ed"+ + "\b\30\2\2\u00ed\60\3\2\2\2\u00ee\u00ef\7*\2\2\u00ef\62\3\2\2\2\u00f0\u00f1"+ + "\7+\2\2\u00f1\64\3\2\2\2\u00f2\u00f3\7]\2\2\u00f3\66\3\2\2\2\u00f4\u00f5"+ + "\7_\2\2\u00f58\3\2\2\2\u00f6\u00f7\7}\2\2\u00f7:\3\2\2\2\u00f8\u00f9\7"+ + "\177\2\2\u00f9<\3\2\2\2\u00fa\u00fb\7=\2\2\u00fb>\3\2\2\2\u00fc\u00fd"+ + "\7)\2\2\u00fd@\3\2\2\2\u00fe\u00ff\7$\2\2\u00ffB\3\2\2\2\u0100\u0101\7"+ + "?\2\2\u0101D\3\2\2\2\u0102\u0103\7-\2\2\u0103\u0104\7?\2\2\u0104F\3\2"+ + "\2\2\u0105\u0106\7\60\2\2\u0106H\3\2\2\2\u0107\u0108\7@\2\2\u0108J\3\2"+ + "\2\2\u0109\u010a\7>\2\2\u010aL\3\2\2\2\u010b\u010c\7?\2\2\u010c\u010d"+ + "\7?\2\2\u010dN\3\2\2\2\u010e\u010f\7#\2\2\u010f\u0110\7?\2\2\u0110P\3"+ + "\2\2\2\u0111\u0112\7@\2\2\u0112\u0113\7?\2\2\u0113R\3\2\2\2\u0114\u0115"+ + "\7>\2\2\u0115\u0116\7?\2\2\u0116T\3\2\2\2\u0117\u0118\7-\2\2\u0118V\3"+ + "\2\2\2\u0119\u011a\7/\2\2\u011aX\3\2\2\2\u011b\u011c\7,\2\2\u011cZ\3\2"+ + "\2\2\u011d\u011e\7\61\2\2\u011e\\\3\2\2\2\u011f\u0120\7\61\2\2\u0120\u0121"+ + "\7\61\2\2\u0121\u0125\3\2\2\2\u0122\u0124\n\5\2\2\u0123\u0122\3\2\2\2"+ + "\u0124\u0127\3\2\2\2\u0125\u0123\3\2\2\2\u0125\u0126\3\2\2\2\u0126\u0129"+ + "\3\2\2\2\u0127\u0125\3\2\2\2\u0128\u012a\7\17\2\2\u0129\u0128\3\2\2\2"+ + "\u0129\u012a\3\2\2\2\u012a\u012b\3\2\2\2\u012b\u012c\7\f\2\2\u012c\u012d"+ + "\3\2\2\2\u012d\u012e\b/\2\2\u012e^\3\2\2\2\17\2kqy\u00c7\u00cc\u00d2\u00d4"+ + "\u00da\u00e3\u00e8\u0125\u0129\3\b\2\2"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} \ No newline at end of file diff --git a/lab/gen/xmlLexer.tokens b/lab/gen/xmlLexer.tokens new file mode 100644 index 0000000..2e703d3 --- /dev/null +++ b/lab/gen/xmlLexer.tokens @@ -0,0 +1,83 @@ +T__0=1 +ARRAY_TYPE=2 +TYPE=3 +ACTION_OPERATOR=4 +BOOL_OPERATOR=5 +DOCUMENT=6 +NODE=7 +ATTRIBUTE=8 +STRING=9 +INT=10 +FLOAT=11 +ELSE=12 +IF=13 +FOR=14 +WHILE=15 +IN=16 +AND=17 +OR=18 +NEW=19 +NAME=20 +NUMBER_LITERAL=21 +STRING_LITERAL=22 +WHITESPACE=23 +OPEN_BRACKET=24 +CLOSE_BRACKET=25 +OPEN_SQUAR_EBRACKET=26 +CLOSE_SQUARE_BRACKET=27 +OPEN_FIGURE_BRACKET=28 +CLOSE_FIGURE_BRACKET=29 +SEMICOLON=30 +QOUTES_ONE=31 +QOUTES_TWO=32 +ASSIGMENT=33 +SUM_ASSIGMENT=34 +DOT=35 +MORE_THAN=36 +LESS_THAN=37 +EQUAL=38 +NOT_EQUAL=39 +MORE_EQUAL=40 +LESS_EQUAL=41 +PlUS=42 +MINUS=43 +MULTIPLICATION=44 +DIVISION=45 +COMMENT=46 +','=1 +'document'=6 +'node'=7 +'attribute'=8 +'string'=9 +'int'=10 +'float'=11 +'else'=12 +'if'=13 +'for'=14 +'while'=15 +'in'=16 +'and'=17 +'or'=18 +'new'=19 +'('=24 +')'=25 +'['=26 +']'=27 +'{'=28 +'}'=29 +';'=30 +'\''=31 +'"'=32 +'='=33 +'+='=34 +'.'=35 +'>'=36 +'<'=37 +'=='=38 +'!='=39 +'>='=40 +'<='=41 +'+'=42 +'-'=43 +'*'=44 +'/'=45 diff --git a/lab/gen/xmlListener.java b/lab/gen/xmlListener.java new file mode 100644 index 0000000..d5f6f2c --- /dev/null +++ b/lab/gen/xmlListener.java @@ -0,0 +1,219 @@ +// Generated from D:/Projects/ANTLR-compiler/src/main/antlr4\xml.g4 by ANTLR 4.9.1 +import org.antlr.v4.runtime.tree.ParseTreeListener; + +/** + * This interface defines a complete listener for a parse tree produced by + * {@link xmlParser}. + */ +public interface xmlListener extends ParseTreeListener { + /** + * Enter a parse tree produced by {@link xmlParser#operation}. + * @param ctx the parse tree + */ + void enterOperation(xmlParser.OperationContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#operation}. + * @param ctx the parse tree + */ + void exitOperation(xmlParser.OperationContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#initialise_var}. + * @param ctx the parse tree + */ + void enterInitialise_var(xmlParser.Initialise_varContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#initialise_var}. + * @param ctx the parse tree + */ + void exitInitialise_var(xmlParser.Initialise_varContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#assignment}. + * @param ctx the parse tree + */ + void enterAssignment(xmlParser.AssignmentContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#assignment}. + * @param ctx the parse tree + */ + void exitAssignment(xmlParser.AssignmentContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#add_assignment}. + * @param ctx the parse tree + */ + void enterAdd_assignment(xmlParser.Add_assignmentContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#add_assignment}. + * @param ctx the parse tree + */ + void exitAdd_assignment(xmlParser.Add_assignmentContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#get_elem}. + * @param ctx the parse tree + */ + void enterGet_elem(xmlParser.Get_elemContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#get_elem}. + * @param ctx the parse tree + */ + void exitGet_elem(xmlParser.Get_elemContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#get_array_elem}. + * @param ctx the parse tree + */ + void enterGet_array_elem(xmlParser.Get_array_elemContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#get_array_elem}. + * @param ctx the parse tree + */ + void exitGet_array_elem(xmlParser.Get_array_elemContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#func_call}. + * @param ctx the parse tree + */ + void enterFunc_call(xmlParser.Func_callContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#func_call}. + * @param ctx the parse tree + */ + void exitFunc_call(xmlParser.Func_callContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#params}. + * @param ctx the parse tree + */ + void enterParams(xmlParser.ParamsContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#params}. + * @param ctx the parse tree + */ + void exitParams(xmlParser.ParamsContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#initialise_func}. + * @param ctx the parse tree + */ + void enterInitialise_func(xmlParser.Initialise_funcContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#initialise_func}. + * @param ctx the parse tree + */ + void exitInitialise_func(xmlParser.Initialise_funcContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#if_block}. + * @param ctx the parse tree + */ + void enterIf_block(xmlParser.If_blockContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#if_block}. + * @param ctx the parse tree + */ + void exitIf_block(xmlParser.If_blockContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#else_if_block}. + * @param ctx the parse tree + */ + void enterElse_if_block(xmlParser.Else_if_blockContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#else_if_block}. + * @param ctx the parse tree + */ + void exitElse_if_block(xmlParser.Else_if_blockContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#else_block}. + * @param ctx the parse tree + */ + void enterElse_block(xmlParser.Else_blockContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#else_block}. + * @param ctx the parse tree + */ + void exitElse_block(xmlParser.Else_blockContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#if_statement}. + * @param ctx the parse tree + */ + void enterIf_statement(xmlParser.If_statementContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#if_statement}. + * @param ctx the parse tree + */ + void exitIf_statement(xmlParser.If_statementContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#for_statement}. + * @param ctx the parse tree + */ + void enterFor_statement(xmlParser.For_statementContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#for_statement}. + * @param ctx the parse tree + */ + void exitFor_statement(xmlParser.For_statementContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#range_statement}. + * @param ctx the parse tree + */ + void enterRange_statement(xmlParser.Range_statementContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#range_statement}. + * @param ctx the parse tree + */ + void exitRange_statement(xmlParser.Range_statementContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#while_statement}. + * @param ctx the parse tree + */ + void enterWhile_statement(xmlParser.While_statementContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#while_statement}. + * @param ctx the parse tree + */ + void exitWhile_statement(xmlParser.While_statementContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#condition}. + * @param ctx the parse tree + */ + void enterCondition(xmlParser.ConditionContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#condition}. + * @param ctx the parse tree + */ + void exitCondition(xmlParser.ConditionContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#type_cast}. + * @param ctx the parse tree + */ + void enterType_cast(xmlParser.Type_castContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#type_cast}. + * @param ctx the parse tree + */ + void exitType_cast(xmlParser.Type_castContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#expression}. + * @param ctx the parse tree + */ + void enterExpression(xmlParser.ExpressionContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#expression}. + * @param ctx the parse tree + */ + void exitExpression(xmlParser.ExpressionContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#get_operation}. + * @param ctx the parse tree + */ + void enterGet_operation(xmlParser.Get_operationContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#get_operation}. + * @param ctx the parse tree + */ + void exitGet_operation(xmlParser.Get_operationContext ctx); + /** + * Enter a parse tree produced by {@link xmlParser#xml}. + * @param ctx the parse tree + */ + void enterXml(xmlParser.XmlContext ctx); + /** + * Exit a parse tree produced by {@link xmlParser#xml}. + * @param ctx the parse tree + */ + void exitXml(xmlParser.XmlContext ctx); +} \ No newline at end of file diff --git a/lab/gen/xmlParser.java b/lab/gen/xmlParser.java new file mode 100644 index 0000000..cd7a5d7 --- /dev/null +++ b/lab/gen/xmlParser.java @@ -0,0 +1,2041 @@ +// Generated from D:/Projects/ANTLR-compiler/src/main/antlr4\xml.g4 by ANTLR 4.9.1 +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.misc.*; +import org.antlr.v4.runtime.tree.*; +import java.util.List; +import java.util.Iterator; +import java.util.ArrayList; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +public class xmlParser extends Parser { + static { RuntimeMetaData.checkVersion("4.9.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + T__0=1, ARRAY_TYPE=2, TYPE=3, ACTION_OPERATOR=4, BOOL_OPERATOR=5, DOCUMENT=6, + NODE=7, ATTRIBUTE=8, STRING=9, INT=10, FLOAT=11, ELSE=12, IF=13, FOR=14, + WHILE=15, IN=16, AND=17, OR=18, NEW=19, NAME=20, NUMBER_LITERAL=21, STRING_LITERAL=22, + WHITESPACE=23, OPEN_BRACKET=24, CLOSE_BRACKET=25, OPEN_SQUAR_EBRACKET=26, + CLOSE_SQUARE_BRACKET=27, OPEN_FIGURE_BRACKET=28, CLOSE_FIGURE_BRACKET=29, + SEMICOLON=30, QOUTES_ONE=31, QOUTES_TWO=32, ASSIGMENT=33, SUM_ASSIGMENT=34, + DOT=35, MORE_THAN=36, LESS_THAN=37, EQUAL=38, NOT_EQUAL=39, MORE_EQUAL=40, + LESS_EQUAL=41, PlUS=42, MINUS=43, MULTIPLICATION=44, DIVISION=45, COMMENT=46; + public static final int + RULE_operation = 0, RULE_initialise_var = 1, RULE_assignment = 2, RULE_add_assignment = 3, + RULE_get_elem = 4, RULE_get_array_elem = 5, RULE_func_call = 6, RULE_params = 7, + RULE_initialise_func = 8, RULE_if_block = 9, RULE_else_if_block = 10, + RULE_else_block = 11, RULE_if_statement = 12, RULE_for_statement = 13, + RULE_range_statement = 14, RULE_while_statement = 15, RULE_condition = 16, + RULE_type_cast = 17, RULE_expression = 18, RULE_get_operation = 19, RULE_xml = 20; + private static String[] makeRuleNames() { + return new String[] { + "operation", "initialise_var", "assignment", "add_assignment", "get_elem", + "get_array_elem", "func_call", "params", "initialise_func", "if_block", + "else_if_block", "else_block", "if_statement", "for_statement", "range_statement", + "while_statement", "condition", "type_cast", "expression", "get_operation", + "xml" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, "','", null, null, null, null, "'document'", "'node'", "'attribute'", + "'string'", "'int'", "'float'", "'else'", "'if'", "'for'", "'while'", + "'in'", "'and'", "'or'", "'new'", null, null, null, null, "'('", "')'", + "'['", "']'", "'{'", "'}'", "';'", "'''", "'\"'", "'='", "'+='", "'.'", + "'>'", "'<'", "'=='", "'!='", "'>='", "'<='", "'+'", "'-'", "'*'", "'/'" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, null, "ARRAY_TYPE", "TYPE", "ACTION_OPERATOR", "BOOL_OPERATOR", + "DOCUMENT", "NODE", "ATTRIBUTE", "STRING", "INT", "FLOAT", "ELSE", "IF", + "FOR", "WHILE", "IN", "AND", "OR", "NEW", "NAME", "NUMBER_LITERAL", "STRING_LITERAL", + "WHITESPACE", "OPEN_BRACKET", "CLOSE_BRACKET", "OPEN_SQUAR_EBRACKET", + "CLOSE_SQUARE_BRACKET", "OPEN_FIGURE_BRACKET", "CLOSE_FIGURE_BRACKET", + "SEMICOLON", "QOUTES_ONE", "QOUTES_TWO", "ASSIGMENT", "SUM_ASSIGMENT", + "DOT", "MORE_THAN", "LESS_THAN", "EQUAL", "NOT_EQUAL", "MORE_EQUAL", + "LESS_EQUAL", "PlUS", "MINUS", "MULTIPLICATION", "DIVISION", "COMMENT" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + @Override + public String getGrammarFileName() { return "xml.g4"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public ATN getATN() { return _ATN; } + + public xmlParser(TokenStream input) { + super(input); + _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + public static class OperationContext extends ParserRuleContext { + public Get_operationContext get_operation() { + return getRuleContext(Get_operationContext.class,0); + } + public Initialise_varContext initialise_var() { + return getRuleContext(Initialise_varContext.class,0); + } + public AssignmentContext assignment() { + return getRuleContext(AssignmentContext.class,0); + } + public Add_assignmentContext add_assignment() { + return getRuleContext(Add_assignmentContext.class,0); + } + public If_statementContext if_statement() { + return getRuleContext(If_statementContext.class,0); + } + public For_statementContext for_statement() { + return getRuleContext(For_statementContext.class,0); + } + public While_statementContext while_statement() { + return getRuleContext(While_statementContext.class,0); + } + public Type_castContext type_cast() { + return getRuleContext(Type_castContext.class,0); + } + public OperationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_operation; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterOperation(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitOperation(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitOperation(this); + else return visitor.visitChildren(this); + } + } + + public final OperationContext operation() throws RecognitionException { + OperationContext _localctx = new OperationContext(_ctx, getState()); + enterRule(_localctx, 0, RULE_operation); + try { + setState(50); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,0,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(42); + get_operation(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(43); + initialise_var(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(44); + assignment(); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(45); + add_assignment(); + } + break; + case 5: + enterOuterAlt(_localctx, 5); + { + setState(46); + if_statement(); + } + break; + case 6: + enterOuterAlt(_localctx, 6); + { + setState(47); + for_statement(); + } + break; + case 7: + enterOuterAlt(_localctx, 7); + { + setState(48); + while_statement(); + } + break; + case 8: + enterOuterAlt(_localctx, 8); + { + setState(49); + type_cast(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class Initialise_varContext extends ParserRuleContext { + public List TYPE() { return getTokens(xmlParser.TYPE); } + public TerminalNode TYPE(int i) { + return getToken(xmlParser.TYPE, i); + } + public TerminalNode NAME() { return getToken(xmlParser.NAME, 0); } + public TerminalNode ASSIGMENT() { return getToken(xmlParser.ASSIGMENT, 0); } + public TerminalNode NEW() { return getToken(xmlParser.NEW, 0); } + public TerminalNode OPEN_BRACKET() { return getToken(xmlParser.OPEN_BRACKET, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode CLOSE_BRACKET() { return getToken(xmlParser.CLOSE_BRACKET, 0); } + public TerminalNode SEMICOLON() { return getToken(xmlParser.SEMICOLON, 0); } + public Initialise_varContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_initialise_var; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterInitialise_var(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitInitialise_var(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitInitialise_var(this); + else return visitor.visitChildren(this); + } + } + + public final Initialise_varContext initialise_var() throws RecognitionException { + Initialise_varContext _localctx = new Initialise_varContext(_ctx, getState()); + enterRule(_localctx, 2, RULE_initialise_var); + try { + enterOuterAlt(_localctx, 1); + { + setState(52); + match(TYPE); + setState(53); + match(NAME); + setState(54); + match(ASSIGMENT); + setState(55); + match(NEW); + setState(56); + match(TYPE); + setState(57); + match(OPEN_BRACKET); + setState(58); + expression(0); + setState(59); + match(CLOSE_BRACKET); + setState(60); + match(SEMICOLON); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class AssignmentContext extends ParserRuleContext { + public TerminalNode NAME() { return getToken(xmlParser.NAME, 0); } + public TerminalNode ASSIGMENT() { return getToken(xmlParser.ASSIGMENT, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode SEMICOLON() { return getToken(xmlParser.SEMICOLON, 0); } + public TerminalNode OPEN_BRACKET() { return getToken(xmlParser.OPEN_BRACKET, 0); } + public TerminalNode NUMBER_LITERAL() { return getToken(xmlParser.NUMBER_LITERAL, 0); } + public TerminalNode CLOSE_BRACKET() { return getToken(xmlParser.CLOSE_BRACKET, 0); } + public TerminalNode TYPE() { return getToken(xmlParser.TYPE, 0); } + public TerminalNode ARRAY_TYPE() { return getToken(xmlParser.ARRAY_TYPE, 0); } + public AssignmentContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_assignment; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterAssignment(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitAssignment(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitAssignment(this); + else return visitor.visitChildren(this); + } + } + + public final AssignmentContext assignment() throws RecognitionException { + AssignmentContext _localctx = new AssignmentContext(_ctx, getState()); + enterRule(_localctx, 4, RULE_assignment); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(63); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==ARRAY_TYPE || _la==TYPE) { + { + setState(62); + _la = _input.LA(1); + if ( !(_la==ARRAY_TYPE || _la==TYPE) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + + setState(65); + match(NAME); + setState(69); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==OPEN_BRACKET) { + { + setState(66); + match(OPEN_BRACKET); + setState(67); + match(NUMBER_LITERAL); + setState(68); + match(CLOSE_BRACKET); + } + } + + setState(71); + match(ASSIGMENT); + setState(72); + expression(0); + setState(73); + match(SEMICOLON); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class Add_assignmentContext extends ParserRuleContext { + public TerminalNode NAME() { return getToken(xmlParser.NAME, 0); } + public TerminalNode SUM_ASSIGMENT() { return getToken(xmlParser.SUM_ASSIGMENT, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode SEMICOLON() { return getToken(xmlParser.SEMICOLON, 0); } + public TerminalNode OPEN_BRACKET() { return getToken(xmlParser.OPEN_BRACKET, 0); } + public TerminalNode NUMBER_LITERAL() { return getToken(xmlParser.NUMBER_LITERAL, 0); } + public TerminalNode CLOSE_BRACKET() { return getToken(xmlParser.CLOSE_BRACKET, 0); } + public Add_assignmentContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_add_assignment; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterAdd_assignment(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitAdd_assignment(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitAdd_assignment(this); + else return visitor.visitChildren(this); + } + } + + public final Add_assignmentContext add_assignment() throws RecognitionException { + Add_assignmentContext _localctx = new Add_assignmentContext(_ctx, getState()); + enterRule(_localctx, 6, RULE_add_assignment); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(75); + match(NAME); + setState(79); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==OPEN_BRACKET) { + { + setState(76); + match(OPEN_BRACKET); + setState(77); + match(NUMBER_LITERAL); + setState(78); + match(CLOSE_BRACKET); + } + } + + setState(81); + match(SUM_ASSIGMENT); + setState(82); + expression(0); + setState(83); + match(SEMICOLON); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class Get_elemContext extends ParserRuleContext { + public List NAME() { return getTokens(xmlParser.NAME); } + public TerminalNode NAME(int i) { + return getToken(xmlParser.NAME, i); + } + public TerminalNode DOT() { return getToken(xmlParser.DOT, 0); } + public Get_elemContext get_elem() { + return getRuleContext(Get_elemContext.class,0); + } + public TerminalNode SEMICOLON() { return getToken(xmlParser.SEMICOLON, 0); } + public TerminalNode OPEN_BRACKET() { return getToken(xmlParser.OPEN_BRACKET, 0); } + public TerminalNode CLOSE_BRACKET() { return getToken(xmlParser.CLOSE_BRACKET, 0); } + public ParamsContext params() { + return getRuleContext(ParamsContext.class,0); + } + public Get_elemContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_get_elem; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterGet_elem(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitGet_elem(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitGet_elem(this); + else return visitor.visitChildren(this); + } + } + + public final Get_elemContext get_elem() throws RecognitionException { + return get_elem(0); + } + + private Get_elemContext get_elem(int _p) throws RecognitionException { + ParserRuleContext _parentctx = _ctx; + int _parentState = getState(); + Get_elemContext _localctx = new Get_elemContext(_ctx, _parentState); + Get_elemContext _prevctx = _localctx; + int _startState = 8; + enterRecursionRule(_localctx, 8, RULE_get_elem, _p); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + { + setState(86); + match(NAME); + setState(87); + match(DOT); + setState(88); + match(NAME); + } + _ctx.stop = _input.LT(-1); + setState(100); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,6,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + if ( _parseListeners!=null ) triggerExitRuleEvent(); + _prevctx = _localctx; + { + setState(98); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) { + case 1: + { + _localctx = new Get_elemContext(_parentctx, _parentState); + pushNewRecursionContext(_localctx, _startState, RULE_get_elem); + setState(90); + if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)"); + setState(91); + match(SEMICOLON); + } + break; + case 2: + { + _localctx = new Get_elemContext(_parentctx, _parentState); + pushNewRecursionContext(_localctx, _startState, RULE_get_elem); + setState(92); + if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); + setState(93); + match(OPEN_BRACKET); + setState(95); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ARRAY_TYPE) | (1L << TYPE) | (1L << NAME) | (1L << NUMBER_LITERAL) | (1L << STRING_LITERAL) | (1L << OPEN_BRACKET))) != 0)) { + { + setState(94); + params(); + } + } + + setState(97); + match(CLOSE_BRACKET); + } + break; + } + } + } + setState(102); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,6,_ctx); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + unrollRecursionContexts(_parentctx); + } + return _localctx; + } + + public static class Get_array_elemContext extends ParserRuleContext { + public TerminalNode NAME() { return getToken(xmlParser.NAME, 0); } + public TerminalNode OPEN_SQUAR_EBRACKET() { return getToken(xmlParser.OPEN_SQUAR_EBRACKET, 0); } + public TerminalNode NUMBER_LITERAL() { return getToken(xmlParser.NUMBER_LITERAL, 0); } + public TerminalNode CLOSE_SQUARE_BRACKET() { return getToken(xmlParser.CLOSE_SQUARE_BRACKET, 0); } + public Get_array_elemContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_get_array_elem; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterGet_array_elem(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitGet_array_elem(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitGet_array_elem(this); + else return visitor.visitChildren(this); + } + } + + public final Get_array_elemContext get_array_elem() throws RecognitionException { + Get_array_elemContext _localctx = new Get_array_elemContext(_ctx, getState()); + enterRule(_localctx, 10, RULE_get_array_elem); + try { + enterOuterAlt(_localctx, 1); + { + setState(103); + match(NAME); + setState(104); + match(OPEN_SQUAR_EBRACKET); + setState(105); + match(NUMBER_LITERAL); + setState(106); + match(CLOSE_SQUARE_BRACKET); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class Func_callContext extends ParserRuleContext { + public TerminalNode NAME() { return getToken(xmlParser.NAME, 0); } + public TerminalNode OPEN_BRACKET() { return getToken(xmlParser.OPEN_BRACKET, 0); } + public TerminalNode CLOSE_BRACKET() { return getToken(xmlParser.CLOSE_BRACKET, 0); } + public TerminalNode SEMICOLON() { return getToken(xmlParser.SEMICOLON, 0); } + public ParamsContext params() { + return getRuleContext(ParamsContext.class,0); + } + public TerminalNode TYPE() { return getToken(xmlParser.TYPE, 0); } + public TerminalNode ARRAY_TYPE() { return getToken(xmlParser.ARRAY_TYPE, 0); } + public Func_callContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_func_call; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterFunc_call(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitFunc_call(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitFunc_call(this); + else return visitor.visitChildren(this); + } + } + + public final Func_callContext func_call() throws RecognitionException { + Func_callContext _localctx = new Func_callContext(_ctx, getState()); + enterRule(_localctx, 12, RULE_func_call); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(109); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==ARRAY_TYPE || _la==TYPE) { + { + setState(108); + _la = _input.LA(1); + if ( !(_la==ARRAY_TYPE || _la==TYPE) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + + setState(111); + match(NAME); + setState(112); + match(OPEN_BRACKET); + setState(114); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ARRAY_TYPE) | (1L << TYPE) | (1L << NAME) | (1L << NUMBER_LITERAL) | (1L << STRING_LITERAL) | (1L << OPEN_BRACKET))) != 0)) { + { + setState(113); + params(); + } + } + + setState(116); + match(CLOSE_BRACKET); + setState(117); + match(SEMICOLON); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class ParamsContext extends ParserRuleContext { + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public ParamsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_params; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterParams(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitParams(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitParams(this); + else return visitor.visitChildren(this); + } + } + + public final ParamsContext params() throws RecognitionException { + ParamsContext _localctx = new ParamsContext(_ctx, getState()); + enterRule(_localctx, 14, RULE_params); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(119); + expression(0); + setState(124); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==T__0) { + { + { + setState(120); + match(T__0); + setState(121); + expression(0); + } + } + setState(126); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class Initialise_funcContext extends ParserRuleContext { + public List NAME() { return getTokens(xmlParser.NAME); } + public TerminalNode NAME(int i) { + return getToken(xmlParser.NAME, i); + } + public TerminalNode OPEN_BRACKET() { return getToken(xmlParser.OPEN_BRACKET, 0); } + public TerminalNode CLOSE_BRACKET() { return getToken(xmlParser.CLOSE_BRACKET, 0); } + public TerminalNode OPEN_FIGURE_BRACKET() { return getToken(xmlParser.OPEN_FIGURE_BRACKET, 0); } + public TerminalNode CLOSE_FIGURE_BRACKET() { return getToken(xmlParser.CLOSE_FIGURE_BRACKET, 0); } + public List TYPE() { return getTokens(xmlParser.TYPE); } + public TerminalNode TYPE(int i) { + return getToken(xmlParser.TYPE, i); + } + public List ARRAY_TYPE() { return getTokens(xmlParser.ARRAY_TYPE); } + public TerminalNode ARRAY_TYPE(int i) { + return getToken(xmlParser.ARRAY_TYPE, i); + } + public List operation() { + return getRuleContexts(OperationContext.class); + } + public OperationContext operation(int i) { + return getRuleContext(OperationContext.class,i); + } + public Initialise_funcContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_initialise_func; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterInitialise_func(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitInitialise_func(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitInitialise_func(this); + else return visitor.visitChildren(this); + } + } + + public final Initialise_funcContext initialise_func() throws RecognitionException { + Initialise_funcContext _localctx = new Initialise_funcContext(_ctx, getState()); + enterRule(_localctx, 16, RULE_initialise_func); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(127); + _la = _input.LA(1); + if ( !(_la==ARRAY_TYPE || _la==TYPE) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(128); + match(NAME); + setState(129); + match(OPEN_BRACKET); + setState(140); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==ARRAY_TYPE || _la==TYPE) { + { + setState(130); + _la = _input.LA(1); + if ( !(_la==ARRAY_TYPE || _la==TYPE) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(131); + match(NAME); + setState(137); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==T__0) { + { + { + setState(132); + match(T__0); + setState(133); + _la = _input.LA(1); + if ( !(_la==ARRAY_TYPE || _la==TYPE) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(134); + match(NAME); + } + } + setState(139); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + + setState(142); + match(CLOSE_BRACKET); + setState(143); + match(OPEN_FIGURE_BRACKET); + setState(147); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ARRAY_TYPE) | (1L << TYPE) | (1L << IF) | (1L << FOR) | (1L << WHILE) | (1L << NAME))) != 0)) { + { + { + setState(144); + operation(); + } + } + setState(149); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(150); + match(CLOSE_FIGURE_BRACKET); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class If_blockContext extends ParserRuleContext { + public TerminalNode IF() { return getToken(xmlParser.IF, 0); } + public TerminalNode OPEN_BRACKET() { return getToken(xmlParser.OPEN_BRACKET, 0); } + public ConditionContext condition() { + return getRuleContext(ConditionContext.class,0); + } + public TerminalNode CLOSE_BRACKET() { return getToken(xmlParser.CLOSE_BRACKET, 0); } + public TerminalNode OPEN_FIGURE_BRACKET() { return getToken(xmlParser.OPEN_FIGURE_BRACKET, 0); } + public TerminalNode CLOSE_FIGURE_BRACKET() { return getToken(xmlParser.CLOSE_FIGURE_BRACKET, 0); } + public List operation() { + return getRuleContexts(OperationContext.class); + } + public OperationContext operation(int i) { + return getRuleContext(OperationContext.class,i); + } + public If_blockContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_if_block; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterIf_block(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitIf_block(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitIf_block(this); + else return visitor.visitChildren(this); + } + } + + public final If_blockContext if_block() throws RecognitionException { + If_blockContext _localctx = new If_blockContext(_ctx, getState()); + enterRule(_localctx, 18, RULE_if_block); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(152); + match(IF); + setState(153); + match(OPEN_BRACKET); + setState(154); + condition(); + setState(155); + match(CLOSE_BRACKET); + setState(156); + match(OPEN_FIGURE_BRACKET); + setState(160); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ARRAY_TYPE) | (1L << TYPE) | (1L << IF) | (1L << FOR) | (1L << WHILE) | (1L << NAME))) != 0)) { + { + { + setState(157); + operation(); + } + } + setState(162); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(163); + match(CLOSE_FIGURE_BRACKET); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class Else_if_blockContext extends ParserRuleContext { + public TerminalNode ELSE() { return getToken(xmlParser.ELSE, 0); } + public TerminalNode IF() { return getToken(xmlParser.IF, 0); } + public TerminalNode OPEN_BRACKET() { return getToken(xmlParser.OPEN_BRACKET, 0); } + public ConditionContext condition() { + return getRuleContext(ConditionContext.class,0); + } + public TerminalNode CLOSE_BRACKET() { return getToken(xmlParser.CLOSE_BRACKET, 0); } + public TerminalNode OPEN_FIGURE_BRACKET() { return getToken(xmlParser.OPEN_FIGURE_BRACKET, 0); } + public TerminalNode CLOSE_FIGURE_BRACKET() { return getToken(xmlParser.CLOSE_FIGURE_BRACKET, 0); } + public List operation() { + return getRuleContexts(OperationContext.class); + } + public OperationContext operation(int i) { + return getRuleContext(OperationContext.class,i); + } + public Else_if_blockContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_else_if_block; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterElse_if_block(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitElse_if_block(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitElse_if_block(this); + else return visitor.visitChildren(this); + } + } + + public final Else_if_blockContext else_if_block() throws RecognitionException { + Else_if_blockContext _localctx = new Else_if_blockContext(_ctx, getState()); + enterRule(_localctx, 20, RULE_else_if_block); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(165); + match(ELSE); + setState(166); + match(IF); + setState(167); + match(OPEN_BRACKET); + setState(168); + condition(); + setState(169); + match(CLOSE_BRACKET); + setState(170); + match(OPEN_FIGURE_BRACKET); + setState(174); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ARRAY_TYPE) | (1L << TYPE) | (1L << IF) | (1L << FOR) | (1L << WHILE) | (1L << NAME))) != 0)) { + { + { + setState(171); + operation(); + } + } + setState(176); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(177); + match(CLOSE_FIGURE_BRACKET); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class Else_blockContext extends ParserRuleContext { + public TerminalNode ELSE() { return getToken(xmlParser.ELSE, 0); } + public TerminalNode OPEN_FIGURE_BRACKET() { return getToken(xmlParser.OPEN_FIGURE_BRACKET, 0); } + public TerminalNode CLOSE_FIGURE_BRACKET() { return getToken(xmlParser.CLOSE_FIGURE_BRACKET, 0); } + public List operation() { + return getRuleContexts(OperationContext.class); + } + public OperationContext operation(int i) { + return getRuleContext(OperationContext.class,i); + } + public Else_blockContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_else_block; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterElse_block(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitElse_block(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitElse_block(this); + else return visitor.visitChildren(this); + } + } + + public final Else_blockContext else_block() throws RecognitionException { + Else_blockContext _localctx = new Else_blockContext(_ctx, getState()); + enterRule(_localctx, 22, RULE_else_block); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(179); + match(ELSE); + setState(180); + match(OPEN_FIGURE_BRACKET); + setState(184); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ARRAY_TYPE) | (1L << TYPE) | (1L << IF) | (1L << FOR) | (1L << WHILE) | (1L << NAME))) != 0)) { + { + { + setState(181); + operation(); + } + } + setState(186); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(187); + match(CLOSE_FIGURE_BRACKET); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class If_statementContext extends ParserRuleContext { + public If_blockContext if_block() { + return getRuleContext(If_blockContext.class,0); + } + public List else_if_block() { + return getRuleContexts(Else_if_blockContext.class); + } + public Else_if_blockContext else_if_block(int i) { + return getRuleContext(Else_if_blockContext.class,i); + } + public Else_blockContext else_block() { + return getRuleContext(Else_blockContext.class,0); + } + public If_statementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_if_statement; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterIf_statement(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitIf_statement(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitIf_statement(this); + else return visitor.visitChildren(this); + } + } + + public final If_statementContext if_statement() throws RecognitionException { + If_statementContext _localctx = new If_statementContext(_ctx, getState()); + enterRule(_localctx, 24, RULE_if_statement); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(189); + if_block(); + setState(193); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,16,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(190); + else_if_block(); + } + } + } + setState(195); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,16,_ctx); + } + setState(197); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==ELSE) { + { + setState(196); + else_block(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class For_statementContext extends ParserRuleContext { + public TerminalNode FOR() { return getToken(xmlParser.FOR, 0); } + public TerminalNode OPEN_BRACKET() { return getToken(xmlParser.OPEN_BRACKET, 0); } + public Range_statementContext range_statement() { + return getRuleContext(Range_statementContext.class,0); + } + public TerminalNode CLOSE_BRACKET() { return getToken(xmlParser.CLOSE_BRACKET, 0); } + public TerminalNode OPEN_FIGURE_BRACKET() { return getToken(xmlParser.OPEN_FIGURE_BRACKET, 0); } + public TerminalNode CLOSE_FIGURE_BRACKET() { return getToken(xmlParser.CLOSE_FIGURE_BRACKET, 0); } + public List operation() { + return getRuleContexts(OperationContext.class); + } + public OperationContext operation(int i) { + return getRuleContext(OperationContext.class,i); + } + public For_statementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_for_statement; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterFor_statement(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitFor_statement(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitFor_statement(this); + else return visitor.visitChildren(this); + } + } + + public final For_statementContext for_statement() throws RecognitionException { + For_statementContext _localctx = new For_statementContext(_ctx, getState()); + enterRule(_localctx, 26, RULE_for_statement); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(199); + match(FOR); + setState(200); + match(OPEN_BRACKET); + setState(201); + range_statement(); + setState(202); + match(CLOSE_BRACKET); + setState(203); + match(OPEN_FIGURE_BRACKET); + setState(207); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ARRAY_TYPE) | (1L << TYPE) | (1L << IF) | (1L << FOR) | (1L << WHILE) | (1L << NAME))) != 0)) { + { + { + setState(204); + operation(); + } + } + setState(209); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(210); + match(CLOSE_FIGURE_BRACKET); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class Range_statementContext extends ParserRuleContext { + public List NAME() { return getTokens(xmlParser.NAME); } + public TerminalNode NAME(int i) { + return getToken(xmlParser.NAME, i); + } + public TerminalNode IN() { return getToken(xmlParser.IN, 0); } + public TerminalNode TYPE() { return getToken(xmlParser.TYPE, 0); } + public TerminalNode ARRAY_TYPE() { return getToken(xmlParser.ARRAY_TYPE, 0); } + public Range_statementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_range_statement; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterRange_statement(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitRange_statement(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitRange_statement(this); + else return visitor.visitChildren(this); + } + } + + public final Range_statementContext range_statement() throws RecognitionException { + Range_statementContext _localctx = new Range_statementContext(_ctx, getState()); + enterRule(_localctx, 28, RULE_range_statement); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(212); + _la = _input.LA(1); + if ( !(_la==ARRAY_TYPE || _la==TYPE) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(213); + match(NAME); + setState(214); + match(IN); + setState(215); + match(NAME); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class While_statementContext extends ParserRuleContext { + public TerminalNode WHILE() { return getToken(xmlParser.WHILE, 0); } + public TerminalNode OPEN_BRACKET() { return getToken(xmlParser.OPEN_BRACKET, 0); } + public ConditionContext condition() { + return getRuleContext(ConditionContext.class,0); + } + public TerminalNode CLOSE_BRACKET() { return getToken(xmlParser.CLOSE_BRACKET, 0); } + public TerminalNode OPEN_FIGURE_BRACKET() { return getToken(xmlParser.OPEN_FIGURE_BRACKET, 0); } + public TerminalNode CLOSE_FIGURE_BRACKET() { return getToken(xmlParser.CLOSE_FIGURE_BRACKET, 0); } + public List operation() { + return getRuleContexts(OperationContext.class); + } + public OperationContext operation(int i) { + return getRuleContext(OperationContext.class,i); + } + public While_statementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_while_statement; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterWhile_statement(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitWhile_statement(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitWhile_statement(this); + else return visitor.visitChildren(this); + } + } + + public final While_statementContext while_statement() throws RecognitionException { + While_statementContext _localctx = new While_statementContext(_ctx, getState()); + enterRule(_localctx, 30, RULE_while_statement); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(217); + match(WHILE); + setState(218); + match(OPEN_BRACKET); + setState(219); + condition(); + setState(220); + match(CLOSE_BRACKET); + setState(221); + match(OPEN_FIGURE_BRACKET); + setState(225); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ARRAY_TYPE) | (1L << TYPE) | (1L << IF) | (1L << FOR) | (1L << WHILE) | (1L << NAME))) != 0)) { + { + { + setState(222); + operation(); + } + } + setState(227); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(228); + match(CLOSE_FIGURE_BRACKET); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class ConditionContext extends ParserRuleContext { + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public List AND() { return getTokens(xmlParser.AND); } + public TerminalNode AND(int i) { + return getToken(xmlParser.AND, i); + } + public List OR() { return getTokens(xmlParser.OR); } + public TerminalNode OR(int i) { + return getToken(xmlParser.OR, i); + } + public ConditionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_condition; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterCondition(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitCondition(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitCondition(this); + else return visitor.visitChildren(this); + } + } + + public final ConditionContext condition() throws RecognitionException { + ConditionContext _localctx = new ConditionContext(_ctx, getState()); + enterRule(_localctx, 32, RULE_condition); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(230); + expression(0); + setState(237); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==AND || _la==OR) { + { + setState(235); + _errHandler.sync(this); + switch (_input.LA(1)) { + case AND: + { + setState(231); + match(AND); + setState(232); + expression(0); + } + break; + case OR: + { + setState(233); + match(OR); + setState(234); + expression(0); + } + break; + default: + throw new NoViableAltException(this); + } + } + setState(239); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class Type_castContext extends ParserRuleContext { + public List NAME() { return getTokens(xmlParser.NAME); } + public TerminalNode NAME(int i) { + return getToken(xmlParser.NAME, i); + } + public TerminalNode ASSIGMENT() { return getToken(xmlParser.ASSIGMENT, 0); } + public TerminalNode OPEN_BRACKET() { return getToken(xmlParser.OPEN_BRACKET, 0); } + public TerminalNode TYPE() { return getToken(xmlParser.TYPE, 0); } + public TerminalNode CLOSE_BRACKET() { return getToken(xmlParser.CLOSE_BRACKET, 0); } + public TerminalNode SEMICOLON() { return getToken(xmlParser.SEMICOLON, 0); } + public Type_castContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_type_cast; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterType_cast(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitType_cast(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitType_cast(this); + else return visitor.visitChildren(this); + } + } + + public final Type_castContext type_cast() throws RecognitionException { + Type_castContext _localctx = new Type_castContext(_ctx, getState()); + enterRule(_localctx, 34, RULE_type_cast); + try { + enterOuterAlt(_localctx, 1); + { + setState(240); + match(NAME); + setState(241); + match(ASSIGMENT); + setState(242); + match(OPEN_BRACKET); + setState(243); + match(TYPE); + setState(244); + match(CLOSE_BRACKET); + setState(245); + match(NAME); + setState(246); + match(SEMICOLON); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class ExpressionContext extends ParserRuleContext { + public TerminalNode OPEN_BRACKET() { return getToken(xmlParser.OPEN_BRACKET, 0); } + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode CLOSE_BRACKET() { return getToken(xmlParser.CLOSE_BRACKET, 0); } + public Get_operationContext get_operation() { + return getRuleContext(Get_operationContext.class,0); + } + public TerminalNode NUMBER_LITERAL() { return getToken(xmlParser.NUMBER_LITERAL, 0); } + public TerminalNode STRING_LITERAL() { return getToken(xmlParser.STRING_LITERAL, 0); } + public TerminalNode NAME() { return getToken(xmlParser.NAME, 0); } + public TerminalNode ACTION_OPERATOR() { return getToken(xmlParser.ACTION_OPERATOR, 0); } + public TerminalNode BOOL_OPERATOR() { return getToken(xmlParser.BOOL_OPERATOR, 0); } + public ExpressionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_expression; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterExpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitExpression(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitExpression(this); + else return visitor.visitChildren(this); + } + } + + public final ExpressionContext expression() throws RecognitionException { + return expression(0); + } + + private ExpressionContext expression(int _p) throws RecognitionException { + ParserRuleContext _parentctx = _ctx; + int _parentState = getState(); + ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState); + ExpressionContext _prevctx = _localctx; + int _startState = 36; + enterRecursionRule(_localctx, 36, RULE_expression, _p); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(255); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,22,_ctx) ) { + case 1: + { + setState(249); + match(OPEN_BRACKET); + setState(250); + expression(0); + setState(251); + match(CLOSE_BRACKET); + } + break; + case 2: + { + setState(253); + get_operation(); + } + break; + case 3: + { + setState(254); + _la = _input.LA(1); + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << NAME) | (1L << NUMBER_LITERAL) | (1L << STRING_LITERAL))) != 0)) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + break; + } + _ctx.stop = _input.LT(-1); + setState(265); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,24,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + if ( _parseListeners!=null ) triggerExitRuleEvent(); + _prevctx = _localctx; + { + setState(263); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,23,_ctx) ) { + case 1: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(257); + if (!(precpred(_ctx, 4))) throw new FailedPredicateException(this, "precpred(_ctx, 4)"); + setState(258); + match(ACTION_OPERATOR); + setState(259); + expression(5); + } + break; + case 2: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(260); + if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)"); + setState(261); + match(BOOL_OPERATOR); + setState(262); + expression(4); + } + break; + } + } + } + setState(267); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,24,_ctx); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + unrollRecursionContexts(_parentctx); + } + return _localctx; + } + + public static class Get_operationContext extends ParserRuleContext { + public Get_elemContext get_elem() { + return getRuleContext(Get_elemContext.class,0); + } + public Func_callContext func_call() { + return getRuleContext(Func_callContext.class,0); + } + public Get_array_elemContext get_array_elem() { + return getRuleContext(Get_array_elemContext.class,0); + } + public Get_operationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_get_operation; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterGet_operation(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitGet_operation(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitGet_operation(this); + else return visitor.visitChildren(this); + } + } + + public final Get_operationContext get_operation() throws RecognitionException { + Get_operationContext _localctx = new Get_operationContext(_ctx, getState()); + enterRule(_localctx, 38, RULE_get_operation); + try { + setState(271); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,25,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(268); + get_elem(0); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(269); + func_call(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(270); + get_array_elem(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public static class XmlContext extends ParserRuleContext { + public List operation() { + return getRuleContexts(OperationContext.class); + } + public OperationContext operation(int i) { + return getRuleContext(OperationContext.class,i); + } + public List initialise_func() { + return getRuleContexts(Initialise_funcContext.class); + } + public Initialise_funcContext initialise_func(int i) { + return getRuleContext(Initialise_funcContext.class,i); + } + public XmlContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_xml; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).enterXml(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof xmlListener ) ((xmlListener)listener).exitXml(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof xmlVisitor ) return ((xmlVisitor)visitor).visitXml(this); + else return visitor.visitChildren(this); + } + } + + public final XmlContext xml() throws RecognitionException { + XmlContext _localctx = new XmlContext(_ctx, getState()); + enterRule(_localctx, 40, RULE_xml); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(275); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + setState(275); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,26,_ctx) ) { + case 1: + { + setState(273); + operation(); + } + break; + case 2: + { + setState(274); + initialise_func(); + } + break; + } + } + setState(277); + _errHandler.sync(this); + _la = _input.LA(1); + } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ARRAY_TYPE) | (1L << TYPE) | (1L << IF) | (1L << FOR) | (1L << WHILE) | (1L << NAME))) != 0) ); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { + switch (ruleIndex) { + case 4: + return get_elem_sempred((Get_elemContext)_localctx, predIndex); + case 18: + return expression_sempred((ExpressionContext)_localctx, predIndex); + } + return true; + } + private boolean get_elem_sempred(Get_elemContext _localctx, int predIndex) { + switch (predIndex) { + case 0: + return precpred(_ctx, 3); + case 1: + return precpred(_ctx, 2); + } + return true; + } + private boolean expression_sempred(ExpressionContext _localctx, int predIndex) { + switch (predIndex) { + case 2: + return precpred(_ctx, 4); + case 3: + return precpred(_ctx, 3); + } + return true; + } + + public static final String _serializedATN = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\60\u011a\4\2\t\2"+ + "\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+ + "\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+ + "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3"+ + "\2\5\2\65\n\2\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\4\5\4B\n\4\3\4"+ + "\3\4\3\4\3\4\5\4H\n\4\3\4\3\4\3\4\3\4\3\5\3\5\3\5\3\5\5\5R\n\5\3\5\3\5"+ + "\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\5\6b\n\6\3\6\7\6e\n\6"+ + "\f\6\16\6h\13\6\3\7\3\7\3\7\3\7\3\7\3\b\5\bp\n\b\3\b\3\b\3\b\5\bu\n\b"+ + "\3\b\3\b\3\b\3\t\3\t\3\t\7\t}\n\t\f\t\16\t\u0080\13\t\3\n\3\n\3\n\3\n"+ + "\3\n\3\n\3\n\3\n\7\n\u008a\n\n\f\n\16\n\u008d\13\n\5\n\u008f\n\n\3\n\3"+ + "\n\3\n\7\n\u0094\n\n\f\n\16\n\u0097\13\n\3\n\3\n\3\13\3\13\3\13\3\13\3"+ + "\13\3\13\7\13\u00a1\n\13\f\13\16\13\u00a4\13\13\3\13\3\13\3\f\3\f\3\f"+ + "\3\f\3\f\3\f\3\f\7\f\u00af\n\f\f\f\16\f\u00b2\13\f\3\f\3\f\3\r\3\r\3\r"+ + "\7\r\u00b9\n\r\f\r\16\r\u00bc\13\r\3\r\3\r\3\16\3\16\7\16\u00c2\n\16\f"+ + "\16\16\16\u00c5\13\16\3\16\5\16\u00c8\n\16\3\17\3\17\3\17\3\17\3\17\3"+ + "\17\7\17\u00d0\n\17\f\17\16\17\u00d3\13\17\3\17\3\17\3\20\3\20\3\20\3"+ + "\20\3\20\3\21\3\21\3\21\3\21\3\21\3\21\7\21\u00e2\n\21\f\21\16\21\u00e5"+ + "\13\21\3\21\3\21\3\22\3\22\3\22\3\22\3\22\7\22\u00ee\n\22\f\22\16\22\u00f1"+ + "\13\22\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\24\3\24\3\24\3\24\3\24"+ + "\3\24\3\24\5\24\u0102\n\24\3\24\3\24\3\24\3\24\3\24\3\24\7\24\u010a\n"+ + "\24\f\24\16\24\u010d\13\24\3\25\3\25\3\25\5\25\u0112\n\25\3\26\3\26\6"+ + "\26\u0116\n\26\r\26\16\26\u0117\3\26\2\4\n&\27\2\4\6\b\n\f\16\20\22\24"+ + "\26\30\32\34\36 \"$&(*\2\4\3\2\4\5\3\2\26\30\2\u0128\2\64\3\2\2\2\4\66"+ + "\3\2\2\2\6A\3\2\2\2\bM\3\2\2\2\nW\3\2\2\2\fi\3\2\2\2\16o\3\2\2\2\20y\3"+ + "\2\2\2\22\u0081\3\2\2\2\24\u009a\3\2\2\2\26\u00a7\3\2\2\2\30\u00b5\3\2"+ + "\2\2\32\u00bf\3\2\2\2\34\u00c9\3\2\2\2\36\u00d6\3\2\2\2 \u00db\3\2\2\2"+ + "\"\u00e8\3\2\2\2$\u00f2\3\2\2\2&\u0101\3\2\2\2(\u0111\3\2\2\2*\u0115\3"+ + "\2\2\2,\65\5(\25\2-\65\5\4\3\2.\65\5\6\4\2/\65\5\b\5\2\60\65\5\32\16\2"+ + "\61\65\5\34\17\2\62\65\5 \21\2\63\65\5$\23\2\64,\3\2\2\2\64-\3\2\2\2\64"+ + ".\3\2\2\2\64/\3\2\2\2\64\60\3\2\2\2\64\61\3\2\2\2\64\62\3\2\2\2\64\63"+ + "\3\2\2\2\65\3\3\2\2\2\66\67\7\5\2\2\678\7\26\2\289\7#\2\29:\7\25\2\2:"+ + ";\7\5\2\2;<\7\32\2\2<=\5&\24\2=>\7\33\2\2>?\7 \2\2?\5\3\2\2\2@B\t\2\2"+ + "\2A@\3\2\2\2AB\3\2\2\2BC\3\2\2\2CG\7\26\2\2DE\7\32\2\2EF\7\27\2\2FH\7"+ + "\33\2\2GD\3\2\2\2GH\3\2\2\2HI\3\2\2\2IJ\7#\2\2JK\5&\24\2KL\7 \2\2L\7\3"+ + "\2\2\2MQ\7\26\2\2NO\7\32\2\2OP\7\27\2\2PR\7\33\2\2QN\3\2\2\2QR\3\2\2\2"+ + "RS\3\2\2\2ST\7$\2\2TU\5&\24\2UV\7 \2\2V\t\3\2\2\2WX\b\6\1\2XY\7\26\2\2"+ + "YZ\7%\2\2Z[\7\26\2\2[f\3\2\2\2\\]\f\5\2\2]e\7 \2\2^_\f\4\2\2_a\7\32\2"+ + "\2`b\5\20\t\2a`\3\2\2\2ab\3\2\2\2bc\3\2\2\2ce\7\33\2\2d\\\3\2\2\2d^\3"+ + "\2\2\2eh\3\2\2\2fd\3\2\2\2fg\3\2\2\2g\13\3\2\2\2hf\3\2\2\2ij\7\26\2\2"+ + "jk\7\34\2\2kl\7\27\2\2lm\7\35\2\2m\r\3\2\2\2np\t\2\2\2on\3\2\2\2op\3\2"+ + "\2\2pq\3\2\2\2qr\7\26\2\2rt\7\32\2\2su\5\20\t\2ts\3\2\2\2tu\3\2\2\2uv"+ + "\3\2\2\2vw\7\33\2\2wx\7 \2\2x\17\3\2\2\2y~\5&\24\2z{\7\3\2\2{}\5&\24\2"+ + "|z\3\2\2\2}\u0080\3\2\2\2~|\3\2\2\2~\177\3\2\2\2\177\21\3\2\2\2\u0080"+ + "~\3\2\2\2\u0081\u0082\t\2\2\2\u0082\u0083\7\26\2\2\u0083\u008e\7\32\2"+ + "\2\u0084\u0085\t\2\2\2\u0085\u008b\7\26\2\2\u0086\u0087\7\3\2\2\u0087"+ + "\u0088\t\2\2\2\u0088\u008a\7\26\2\2\u0089\u0086\3\2\2\2\u008a\u008d\3"+ + "\2\2\2\u008b\u0089\3\2\2\2\u008b\u008c\3\2\2\2\u008c\u008f\3\2\2\2\u008d"+ + "\u008b\3\2\2\2\u008e\u0084\3\2\2\2\u008e\u008f\3\2\2\2\u008f\u0090\3\2"+ + "\2\2\u0090\u0091\7\33\2\2\u0091\u0095\7\36\2\2\u0092\u0094\5\2\2\2\u0093"+ + "\u0092\3\2\2\2\u0094\u0097\3\2\2\2\u0095\u0093\3\2\2\2\u0095\u0096\3\2"+ + "\2\2\u0096\u0098\3\2\2\2\u0097\u0095\3\2\2\2\u0098\u0099\7\37\2\2\u0099"+ + "\23\3\2\2\2\u009a\u009b\7\17\2\2\u009b\u009c\7\32\2\2\u009c\u009d\5\""+ + "\22\2\u009d\u009e\7\33\2\2\u009e\u00a2\7\36\2\2\u009f\u00a1\5\2\2\2\u00a0"+ + "\u009f\3\2\2\2\u00a1\u00a4\3\2\2\2\u00a2\u00a0\3\2\2\2\u00a2\u00a3\3\2"+ + "\2\2\u00a3\u00a5\3\2\2\2\u00a4\u00a2\3\2\2\2\u00a5\u00a6\7\37\2\2\u00a6"+ + "\25\3\2\2\2\u00a7\u00a8\7\16\2\2\u00a8\u00a9\7\17\2\2\u00a9\u00aa\7\32"+ + "\2\2\u00aa\u00ab\5\"\22\2\u00ab\u00ac\7\33\2\2\u00ac\u00b0\7\36\2\2\u00ad"+ + "\u00af\5\2\2\2\u00ae\u00ad\3\2\2\2\u00af\u00b2\3\2\2\2\u00b0\u00ae\3\2"+ + "\2\2\u00b0\u00b1\3\2\2\2\u00b1\u00b3\3\2\2\2\u00b2\u00b0\3\2\2\2\u00b3"+ + "\u00b4\7\37\2\2\u00b4\27\3\2\2\2\u00b5\u00b6\7\16\2\2\u00b6\u00ba\7\36"+ + "\2\2\u00b7\u00b9\5\2\2\2\u00b8\u00b7\3\2\2\2\u00b9\u00bc\3\2\2\2\u00ba"+ + "\u00b8\3\2\2\2\u00ba\u00bb\3\2\2\2\u00bb\u00bd\3\2\2\2\u00bc\u00ba\3\2"+ + "\2\2\u00bd\u00be\7\37\2\2\u00be\31\3\2\2\2\u00bf\u00c3\5\24\13\2\u00c0"+ + "\u00c2\5\26\f\2\u00c1\u00c0\3\2\2\2\u00c2\u00c5\3\2\2\2\u00c3\u00c1\3"+ + "\2\2\2\u00c3\u00c4\3\2\2\2\u00c4\u00c7\3\2\2\2\u00c5\u00c3\3\2\2\2\u00c6"+ + "\u00c8\5\30\r\2\u00c7\u00c6\3\2\2\2\u00c7\u00c8\3\2\2\2\u00c8\33\3\2\2"+ + "\2\u00c9\u00ca\7\20\2\2\u00ca\u00cb\7\32\2\2\u00cb\u00cc\5\36\20\2\u00cc"+ + "\u00cd\7\33\2\2\u00cd\u00d1\7\36\2\2\u00ce\u00d0\5\2\2\2\u00cf\u00ce\3"+ + "\2\2\2\u00d0\u00d3\3\2\2\2\u00d1\u00cf\3\2\2\2\u00d1\u00d2\3\2\2\2\u00d2"+ + "\u00d4\3\2\2\2\u00d3\u00d1\3\2\2\2\u00d4\u00d5\7\37\2\2\u00d5\35\3\2\2"+ + "\2\u00d6\u00d7\t\2\2\2\u00d7\u00d8\7\26\2\2\u00d8\u00d9\7\22\2\2\u00d9"+ + "\u00da\7\26\2\2\u00da\37\3\2\2\2\u00db\u00dc\7\21\2\2\u00dc\u00dd\7\32"+ + "\2\2\u00dd\u00de\5\"\22\2\u00de\u00df\7\33\2\2\u00df\u00e3\7\36\2\2\u00e0"+ + "\u00e2\5\2\2\2\u00e1\u00e0\3\2\2\2\u00e2\u00e5\3\2\2\2\u00e3\u00e1\3\2"+ + "\2\2\u00e3\u00e4\3\2\2\2\u00e4\u00e6\3\2\2\2\u00e5\u00e3\3\2\2\2\u00e6"+ + "\u00e7\7\37\2\2\u00e7!\3\2\2\2\u00e8\u00ef\5&\24\2\u00e9\u00ea\7\23\2"+ + "\2\u00ea\u00ee\5&\24\2\u00eb\u00ec\7\24\2\2\u00ec\u00ee\5&\24\2\u00ed"+ + "\u00e9\3\2\2\2\u00ed\u00eb\3\2\2\2\u00ee\u00f1\3\2\2\2\u00ef\u00ed\3\2"+ + "\2\2\u00ef\u00f0\3\2\2\2\u00f0#\3\2\2\2\u00f1\u00ef\3\2\2\2\u00f2\u00f3"+ + "\7\26\2\2\u00f3\u00f4\7#\2\2\u00f4\u00f5\7\32\2\2\u00f5\u00f6\7\5\2\2"+ + "\u00f6\u00f7\7\33\2\2\u00f7\u00f8\7\26\2\2\u00f8\u00f9\7 \2\2\u00f9%\3"+ + "\2\2\2\u00fa\u00fb\b\24\1\2\u00fb\u00fc\7\32\2\2\u00fc\u00fd\5&\24\2\u00fd"+ + "\u00fe\7\33\2\2\u00fe\u0102\3\2\2\2\u00ff\u0102\5(\25\2\u0100\u0102\t"+ + "\3\2\2\u0101\u00fa\3\2\2\2\u0101\u00ff\3\2\2\2\u0101\u0100\3\2\2\2\u0102"+ + "\u010b\3\2\2\2\u0103\u0104\f\6\2\2\u0104\u0105\7\6\2\2\u0105\u010a\5&"+ + "\24\7\u0106\u0107\f\5\2\2\u0107\u0108\7\7\2\2\u0108\u010a\5&\24\6\u0109"+ + "\u0103\3\2\2\2\u0109\u0106\3\2\2\2\u010a\u010d\3\2\2\2\u010b\u0109\3\2"+ + "\2\2\u010b\u010c\3\2\2\2\u010c\'\3\2\2\2\u010d\u010b\3\2\2\2\u010e\u0112"+ + "\5\n\6\2\u010f\u0112\5\16\b\2\u0110\u0112\5\f\7\2\u0111\u010e\3\2\2\2"+ + "\u0111\u010f\3\2\2\2\u0111\u0110\3\2\2\2\u0112)\3\2\2\2\u0113\u0116\5"+ + "\2\2\2\u0114\u0116\5\22\n\2\u0115\u0113\3\2\2\2\u0115\u0114\3\2\2\2\u0116"+ + "\u0117\3\2\2\2\u0117\u0115\3\2\2\2\u0117\u0118\3\2\2\2\u0118+\3\2\2\2"+ + "\36\64AGQadfot~\u008b\u008e\u0095\u00a2\u00b0\u00ba\u00c3\u00c7\u00d1"+ + "\u00e3\u00ed\u00ef\u0101\u0109\u010b\u0111\u0115\u0117"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} \ No newline at end of file diff --git a/lab/gen/xmlVisitor.java b/lab/gen/xmlVisitor.java new file mode 100644 index 0000000..eeafa3e --- /dev/null +++ b/lab/gen/xmlVisitor.java @@ -0,0 +1,138 @@ +// Generated from D:/Projects/ANTLR-compiler/src/main/antlr4\xml.g4 by ANTLR 4.9.1 +import org.antlr.v4.runtime.tree.ParseTreeVisitor; + +/** + * This interface defines a complete generic visitor for a parse tree produced + * by {@link xmlParser}. + * + * @param The return type of the visit operation. Use {@link Void} for + * operations with no return type. + */ +public interface xmlVisitor extends ParseTreeVisitor { + /** + * Visit a parse tree produced by {@link xmlParser#operation}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitOperation(xmlParser.OperationContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#initialise_var}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitInitialise_var(xmlParser.Initialise_varContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#assignment}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAssignment(xmlParser.AssignmentContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#add_assignment}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAdd_assignment(xmlParser.Add_assignmentContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#get_elem}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_elem(xmlParser.Get_elemContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#get_array_elem}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_array_elem(xmlParser.Get_array_elemContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#func_call}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitFunc_call(xmlParser.Func_callContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#params}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitParams(xmlParser.ParamsContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#initialise_func}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitInitialise_func(xmlParser.Initialise_funcContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#if_block}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitIf_block(xmlParser.If_blockContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#else_if_block}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitElse_if_block(xmlParser.Else_if_blockContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#else_block}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitElse_block(xmlParser.Else_blockContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#if_statement}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitIf_statement(xmlParser.If_statementContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#for_statement}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitFor_statement(xmlParser.For_statementContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#range_statement}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitRange_statement(xmlParser.Range_statementContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#while_statement}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitWhile_statement(xmlParser.While_statementContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#condition}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitCondition(xmlParser.ConditionContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#type_cast}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitType_cast(xmlParser.Type_castContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#expression}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitExpression(xmlParser.ExpressionContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#get_operation}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitGet_operation(xmlParser.Get_operationContext ctx); + /** + * Visit a parse tree produced by {@link xmlParser#xml}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitXml(xmlParser.XmlContext ctx); +} \ No newline at end of file diff --git a/lab/pom.xml b/lab/pom.xml new file mode 100644 index 0000000..66f392c --- /dev/null +++ b/lab/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + + org.example + ANTLR-compiler + 1.0-SNAPSHOT + jar + antlr4-init + http://maven.apache.org + + + org.antlr + antlr4-runtime + 4.9.2 + + + + + 15 + 15 + + + + + + + + + org.antlr + antlr4-maven-plugin + 4.9.2 + + + + antlr4 + + + + + + + + \ No newline at end of file diff --git a/lab/src/main/antlr4/xml.g4 b/lab/src/main/antlr4/xml.g4 new file mode 100644 index 0000000..93b8d1b --- /dev/null +++ b/lab/src/main/antlr4/xml.g4 @@ -0,0 +1,115 @@ +grammar xml; +/* +* Parser +*/ +operation:get_operation| + initialise_var| + assignment| + add_assignment| + if_statement| + for_statement| + while_statement| + type_cast; + +initialise_var: TYPE NAME ASSIGMENT NEW TYPE OPEN_BRACKET expression CLOSE_BRACKET SEMICOLON; + +assignment: (TYPE|ARRAY_TYPE)? NAME (OPEN_BRACKET NUMBER_LITERAL CLOSE_BRACKET)? ASSIGMENT expression SEMICOLON; + +add_assignment: NAME (OPEN_BRACKET NUMBER_LITERAL CLOSE_BRACKET)? SUM_ASSIGMENT expression SEMICOLON; + +get_elem: get_elem SEMICOLON| + get_elem OPEN_BRACKET params? CLOSE_BRACKET| + NAME DOT NAME; + +get_array_elem: NAME OPEN_SQUAR_EBRACKET NUMBER_LITERAL CLOSE_SQUARE_BRACKET; + +func_call: (TYPE|ARRAY_TYPE)? NAME OPEN_BRACKET params? CLOSE_BRACKET SEMICOLON; + +params: expression (',' expression)*; + +initialise_func: (TYPE|ARRAY_TYPE) NAME OPEN_BRACKET ((TYPE|ARRAY_TYPE) NAME (',' (TYPE|ARRAY_TYPE) NAME)*)? CLOSE_BRACKET OPEN_FIGURE_BRACKET operation* CLOSE_FIGURE_BRACKET; + +if_block: IF OPEN_BRACKET condition CLOSE_BRACKET OPEN_FIGURE_BRACKET operation* CLOSE_FIGURE_BRACKET; +else_if_block:ELSE IF OPEN_BRACKET condition CLOSE_BRACKET OPEN_FIGURE_BRACKET operation* CLOSE_FIGURE_BRACKET; +else_block:ELSE OPEN_FIGURE_BRACKET operation* CLOSE_FIGURE_BRACKET; + +if_statement: if_block else_if_block* else_block?; + +for_statement: FOR OPEN_BRACKET range_statement CLOSE_BRACKET OPEN_FIGURE_BRACKET operation* CLOSE_FIGURE_BRACKET; + +range_statement: (TYPE|ARRAY_TYPE) NAME IN NAME; + +while_statement:WHILE OPEN_BRACKET condition CLOSE_BRACKET OPEN_FIGURE_BRACKET operation* CLOSE_FIGURE_BRACKET; + +condition:expression (AND expression| OR expression)*; + +type_cast:NAME ASSIGMENT OPEN_BRACKET TYPE CLOSE_BRACKET NAME SEMICOLON; + +expression: OPEN_BRACKET expression CLOSE_BRACKET| + expression ACTION_OPERATOR expression| + expression BOOL_OPERATOR expression| + get_operation| + (NUMBER_LITERAL | STRING_LITERAL | NAME); + +get_operation:get_elem|func_call|get_array_elem; + +xml: (operation|initialise_func)+; + +/* +* Lexer +*/ + +ARRAY_TYPE:TYPE OPEN_SQUAR_EBRACKET CLOSE_SQUARE_BRACKET; + +TYPE: DOCUMENT|NODE|ATTRIBUTE|STRING|INT|FLOAT; + +ACTION_OPERATOR: PlUS| MINUS| MULTIPLICATION| DIVISION; +BOOL_OPERATOR: MORE_THAN|MORE_EQUAL|LESS_THAN|LESS_EQUAL|EQUAL|NOT_EQUAL; + +DOCUMENT: 'document'; +NODE: 'node'; +ATTRIBUTE: 'attribute'; +STRING: 'string'; +INT: 'int'; +FLOAT: 'float'; + +ELSE: 'else'; +IF: 'if'; +FOR: 'for'; +WHILE: 'while'; +IN: 'in'; +AND: 'and'; +OR:'or'; +NEW:'new'; + +NAME: [a-zA-Z]+; +NUMBER_LITERAL: [0-9]+('.'[0-9]+)?; +STRING_LITERAL : QOUTES_ONE.*?QOUTES_ONE | QOUTES_TWO.*?QOUTES_TWO; + +WHITESPACE: (' '|'\t'|'\n') -> skip; + +OPEN_BRACKET: '('; +CLOSE_BRACKET: ')'; +OPEN_SQUAR_EBRACKET: '['; +CLOSE_SQUARE_BRACKET: ']'; +OPEN_FIGURE_BRACKET: '{'; +CLOSE_FIGURE_BRACKET: '}'; + +SEMICOLON: ';'; +QOUTES_ONE: '\''; +QOUTES_TWO: '"'; +ASSIGMENT: '='; +SUM_ASSIGMENT: '+='; +DOT: '.'; +MORE_THAN: '>'; +LESS_THAN: '<'; +EQUAL: '=='; +NOT_EQUAL: '!='; +MORE_EQUAL: '>='; +LESS_EQUAL: '<='; +PlUS: '+'; +MINUS: '-'; +MULTIPLICATION: '*'; +DIVISION: '/'; + +COMMENT : '//' ~[\r\n]* '\r'? '\n' -> skip ; diff --git a/lab/src/main/java/Main.java b/lab/src/main/java/Main.java new file mode 100644 index 0000000..7fa105b --- /dev/null +++ b/lab/src/main/java/Main.java @@ -0,0 +1,15 @@ +import org.antlr.v4.runtime.CharStreams; +import org.antlr.v4.runtime.CommonTokenStream; +import org.antlr.v4.runtime.tree.ParseTree; +import org.antlr.v4.runtime.tree.ParseTreeWalker; + +public class Main { + public static void main(String[] args){ + xmlLexer lexer = new xmlLexer(CharStreams.fromString("document doc = new document('darowdarow');")); + CommonTokenStream tokenStream = new CommonTokenStream(lexer); + xmlParser parser = new xmlParser(tokenStream); + ParseTree tree = parser.initialise_var(); + ParseTreeWalker walker = new ParseTreeWalker(); + walker.walk(new xmlWalker(), tree); + } +} diff --git a/lab/src/main/java/xmlWalker.java b/lab/src/main/java/xmlWalker.java new file mode 100644 index 0000000..da82776 --- /dev/null +++ b/lab/src/main/java/xmlWalker.java @@ -0,0 +1,9 @@ +public class xmlWalker extends xmlBaseListener { + public void enterInitialise_var(xmlParser.Initialise_varContext ctx ) { + System.out.println( "Creating var:" + ctx.NAME() + " with type " + ctx.TYPE(0)); + } + + public void exitInitialise_var(xmlParser.Initialise_varContext ctx ) { + System.out.println( "Exiting rule" ); + } +} diff --git a/lab/src/test/java/test1.txt b/lab/src/test/java/test1.txt new file mode 100644 index 0000000..081182a --- /dev/null +++ b/lab/src/test/java/test1.txt @@ -0,0 +1,10 @@ +document doc = new document('doc.xml'); +node[] nd = document.node; +if (nd == null){ + nd = node(‘node_name’); +} +else { + nd[0].name = ‘name’; +} +document.node = nd; +document.close(); diff --git a/lab/src/test/java/test2.txt b/lab/src/test/java/test2.txt new file mode 100644 index 0000000..f5141b2 --- /dev/null +++ b/lab/src/test/java/test2.txt @@ -0,0 +1,12 @@ +document doc = new document('doc.xml'); +node[10] nd = new node()[10]; +attribute[5] attr = new attribute()[5]; +for(node i in root){ + i = new attribute(“attr”+num.toString(), num); +} +for(node i in root){ + i = node(“node”+num.toString()); + i.attribute = attr; +} +doc.node = nd; +doc.close(); diff --git a/lab/src/test/java/test3.txt b/lab/src/test/java/test3.txt new file mode 100644 index 0000000..16c4a8b --- /dev/null +++ b/lab/src/test/java/test3.txt @@ -0,0 +1,11 @@ +node[] nd = new node()[]; +for(i in range(1..10)){ + nd.put(node(("node"+i.toString()), “something”+i, attribute((“sm”+i.toString), “s”))) +} +document doc = (document) nd; +int i = 0; +while(i < node.length()){ + node[i] = null; + i+=1; +} + diff --git a/lab/target/classes/Main.class b/lab/target/classes/Main.class new file mode 100644 index 0000000..561eb79 Binary files /dev/null and b/lab/target/classes/Main.class differ diff --git a/lab/target/classes/main/antlr4/xml.g4 b/lab/target/classes/main/antlr4/xml.g4 new file mode 100644 index 0000000..93b8d1b --- /dev/null +++ b/lab/target/classes/main/antlr4/xml.g4 @@ -0,0 +1,115 @@ +grammar xml; +/* +* Parser +*/ +operation:get_operation| + initialise_var| + assignment| + add_assignment| + if_statement| + for_statement| + while_statement| + type_cast; + +initialise_var: TYPE NAME ASSIGMENT NEW TYPE OPEN_BRACKET expression CLOSE_BRACKET SEMICOLON; + +assignment: (TYPE|ARRAY_TYPE)? NAME (OPEN_BRACKET NUMBER_LITERAL CLOSE_BRACKET)? ASSIGMENT expression SEMICOLON; + +add_assignment: NAME (OPEN_BRACKET NUMBER_LITERAL CLOSE_BRACKET)? SUM_ASSIGMENT expression SEMICOLON; + +get_elem: get_elem SEMICOLON| + get_elem OPEN_BRACKET params? CLOSE_BRACKET| + NAME DOT NAME; + +get_array_elem: NAME OPEN_SQUAR_EBRACKET NUMBER_LITERAL CLOSE_SQUARE_BRACKET; + +func_call: (TYPE|ARRAY_TYPE)? NAME OPEN_BRACKET params? CLOSE_BRACKET SEMICOLON; + +params: expression (',' expression)*; + +initialise_func: (TYPE|ARRAY_TYPE) NAME OPEN_BRACKET ((TYPE|ARRAY_TYPE) NAME (',' (TYPE|ARRAY_TYPE) NAME)*)? CLOSE_BRACKET OPEN_FIGURE_BRACKET operation* CLOSE_FIGURE_BRACKET; + +if_block: IF OPEN_BRACKET condition CLOSE_BRACKET OPEN_FIGURE_BRACKET operation* CLOSE_FIGURE_BRACKET; +else_if_block:ELSE IF OPEN_BRACKET condition CLOSE_BRACKET OPEN_FIGURE_BRACKET operation* CLOSE_FIGURE_BRACKET; +else_block:ELSE OPEN_FIGURE_BRACKET operation* CLOSE_FIGURE_BRACKET; + +if_statement: if_block else_if_block* else_block?; + +for_statement: FOR OPEN_BRACKET range_statement CLOSE_BRACKET OPEN_FIGURE_BRACKET operation* CLOSE_FIGURE_BRACKET; + +range_statement: (TYPE|ARRAY_TYPE) NAME IN NAME; + +while_statement:WHILE OPEN_BRACKET condition CLOSE_BRACKET OPEN_FIGURE_BRACKET operation* CLOSE_FIGURE_BRACKET; + +condition:expression (AND expression| OR expression)*; + +type_cast:NAME ASSIGMENT OPEN_BRACKET TYPE CLOSE_BRACKET NAME SEMICOLON; + +expression: OPEN_BRACKET expression CLOSE_BRACKET| + expression ACTION_OPERATOR expression| + expression BOOL_OPERATOR expression| + get_operation| + (NUMBER_LITERAL | STRING_LITERAL | NAME); + +get_operation:get_elem|func_call|get_array_elem; + +xml: (operation|initialise_func)+; + +/* +* Lexer +*/ + +ARRAY_TYPE:TYPE OPEN_SQUAR_EBRACKET CLOSE_SQUARE_BRACKET; + +TYPE: DOCUMENT|NODE|ATTRIBUTE|STRING|INT|FLOAT; + +ACTION_OPERATOR: PlUS| MINUS| MULTIPLICATION| DIVISION; +BOOL_OPERATOR: MORE_THAN|MORE_EQUAL|LESS_THAN|LESS_EQUAL|EQUAL|NOT_EQUAL; + +DOCUMENT: 'document'; +NODE: 'node'; +ATTRIBUTE: 'attribute'; +STRING: 'string'; +INT: 'int'; +FLOAT: 'float'; + +ELSE: 'else'; +IF: 'if'; +FOR: 'for'; +WHILE: 'while'; +IN: 'in'; +AND: 'and'; +OR:'or'; +NEW:'new'; + +NAME: [a-zA-Z]+; +NUMBER_LITERAL: [0-9]+('.'[0-9]+)?; +STRING_LITERAL : QOUTES_ONE.*?QOUTES_ONE | QOUTES_TWO.*?QOUTES_TWO; + +WHITESPACE: (' '|'\t'|'\n') -> skip; + +OPEN_BRACKET: '('; +CLOSE_BRACKET: ')'; +OPEN_SQUAR_EBRACKET: '['; +CLOSE_SQUARE_BRACKET: ']'; +OPEN_FIGURE_BRACKET: '{'; +CLOSE_FIGURE_BRACKET: '}'; + +SEMICOLON: ';'; +QOUTES_ONE: '\''; +QOUTES_TWO: '"'; +ASSIGMENT: '='; +SUM_ASSIGMENT: '+='; +DOT: '.'; +MORE_THAN: '>'; +LESS_THAN: '<'; +EQUAL: '=='; +NOT_EQUAL: '!='; +MORE_EQUAL: '>='; +LESS_EQUAL: '<='; +PlUS: '+'; +MINUS: '-'; +MULTIPLICATION: '*'; +DIVISION: '/'; + +COMMENT : '//' ~[\r\n]* '\r'? '\n' -> skip ; diff --git a/lab/target/classes/test/java/test1.txt b/lab/target/classes/test/java/test1.txt new file mode 100644 index 0000000..081182a --- /dev/null +++ b/lab/target/classes/test/java/test1.txt @@ -0,0 +1,10 @@ +document doc = new document('doc.xml'); +node[] nd = document.node; +if (nd == null){ + nd = node(‘node_name’); +} +else { + nd[0].name = ‘name’; +} +document.node = nd; +document.close(); diff --git a/lab/target/classes/test/java/test2.txt b/lab/target/classes/test/java/test2.txt new file mode 100644 index 0000000..f5141b2 --- /dev/null +++ b/lab/target/classes/test/java/test2.txt @@ -0,0 +1,12 @@ +document doc = new document('doc.xml'); +node[10] nd = new node()[10]; +attribute[5] attr = new attribute()[5]; +for(node i in root){ + i = new attribute(“attr”+num.toString(), num); +} +for(node i in root){ + i = node(“node”+num.toString()); + i.attribute = attr; +} +doc.node = nd; +doc.close(); diff --git a/lab/target/classes/test/java/test3.txt b/lab/target/classes/test/java/test3.txt new file mode 100644 index 0000000..16c4a8b --- /dev/null +++ b/lab/target/classes/test/java/test3.txt @@ -0,0 +1,11 @@ +node[] nd = new node()[]; +for(i in range(1..10)){ + nd.put(node(("node"+i.toString()), “something”+i, attribute((“sm”+i.toString), “s”))) +} +document doc = (document) nd; +int i = 0; +while(i < node.length()){ + node[i] = null; + i+=1; +} + diff --git a/lab/target/classes/xml.interp b/lab/target/classes/xml.interp new file mode 100644 index 0000000..cc51c35 --- /dev/null +++ b/lab/target/classes/xml.interp @@ -0,0 +1,124 @@ +token literal names: +null +',' +null +null +null +null +'document' +'node' +'attribute' +'string' +'int' +'float' +'else' +'if' +'for' +'while' +'in' +'and' +'or' +'new' +null +null +null +null +'(' +')' +'[' +']' +'{' +'}' +';' +'\'' +'"' +'=' +'+=' +'.' +'>' +'<' +'==' +'!=' +'>=' +'<=' +'+' +'-' +'*' +'/' +null + +token symbolic names: +null +null +ARRAY_TYPE +TYPE +ACTION_OPERATOR +BOOL_OPERATOR +DOCUMENT +NODE +ATTRIBUTE +STRING +INT +FLOAT +ELSE +IF +FOR +WHILE +IN +AND +OR +NEW +NAME +NUMBER_LITERAL +STRING_LITERAL +WHITESPACE +OPEN_BRACKET +CLOSE_BRACKET +OPEN_SQUAR_EBRACKET +CLOSE_SQUARE_BRACKET +OPEN_FIGURE_BRACKET +CLOSE_FIGURE_BRACKET +SEMICOLON +QOUTES_ONE +QOUTES_TWO +ASSIGMENT +SUM_ASSIGMENT +DOT +MORE_THAN +LESS_THAN +EQUAL +NOT_EQUAL +MORE_EQUAL +LESS_EQUAL +PlUS +MINUS +MULTIPLICATION +DIVISION +COMMENT + +rule names: +operation +initialise_var +assignment +add_assignment +get_elem +get_array_elem +func_call +params +initialise_func +if_block +else_if_block +else_block +if_statement +for_statement +range_statement +while_statement +condition +type_cast +expression +get_operation +xml + + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 48, 282, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 53, 10, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 4, 66, 10, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 72, 10, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 82, 10, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 98, 10, 6, 3, 6, 7, 6, 101, 10, 6, 12, 6, 14, 6, 104, 11, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 5, 8, 112, 10, 8, 3, 8, 3, 8, 3, 8, 5, 8, 117, 10, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 7, 9, 125, 10, 9, 12, 9, 14, 9, 128, 11, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 7, 10, 138, 10, 10, 12, 10, 14, 10, 141, 11, 10, 5, 10, 143, 10, 10, 3, 10, 3, 10, 3, 10, 7, 10, 148, 10, 10, 12, 10, 14, 10, 151, 11, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 7, 11, 161, 10, 11, 12, 11, 14, 11, 164, 11, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 7, 12, 175, 10, 12, 12, 12, 14, 12, 178, 11, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 7, 13, 185, 10, 13, 12, 13, 14, 13, 188, 11, 13, 3, 13, 3, 13, 3, 14, 3, 14, 7, 14, 194, 10, 14, 12, 14, 14, 14, 197, 11, 14, 3, 14, 5, 14, 200, 10, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 7, 15, 208, 10, 15, 12, 15, 14, 15, 211, 11, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 7, 17, 226, 10, 17, 12, 17, 14, 17, 229, 11, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 7, 18, 238, 10, 18, 12, 18, 14, 18, 241, 11, 18, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 5, 20, 258, 10, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 7, 20, 266, 10, 20, 12, 20, 14, 20, 269, 11, 20, 3, 21, 3, 21, 3, 21, 5, 21, 274, 10, 21, 3, 22, 3, 22, 6, 22, 278, 10, 22, 13, 22, 14, 22, 279, 3, 22, 2, 4, 10, 38, 23, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 2, 4, 3, 2, 4, 5, 3, 2, 22, 24, 2, 296, 2, 52, 3, 2, 2, 2, 4, 54, 3, 2, 2, 2, 6, 65, 3, 2, 2, 2, 8, 77, 3, 2, 2, 2, 10, 87, 3, 2, 2, 2, 12, 105, 3, 2, 2, 2, 14, 111, 3, 2, 2, 2, 16, 121, 3, 2, 2, 2, 18, 129, 3, 2, 2, 2, 20, 154, 3, 2, 2, 2, 22, 167, 3, 2, 2, 2, 24, 181, 3, 2, 2, 2, 26, 191, 3, 2, 2, 2, 28, 201, 3, 2, 2, 2, 30, 214, 3, 2, 2, 2, 32, 219, 3, 2, 2, 2, 34, 232, 3, 2, 2, 2, 36, 242, 3, 2, 2, 2, 38, 257, 3, 2, 2, 2, 40, 273, 3, 2, 2, 2, 42, 277, 3, 2, 2, 2, 44, 53, 5, 40, 21, 2, 45, 53, 5, 4, 3, 2, 46, 53, 5, 6, 4, 2, 47, 53, 5, 8, 5, 2, 48, 53, 5, 26, 14, 2, 49, 53, 5, 28, 15, 2, 50, 53, 5, 32, 17, 2, 51, 53, 5, 36, 19, 2, 52, 44, 3, 2, 2, 2, 52, 45, 3, 2, 2, 2, 52, 46, 3, 2, 2, 2, 52, 47, 3, 2, 2, 2, 52, 48, 3, 2, 2, 2, 52, 49, 3, 2, 2, 2, 52, 50, 3, 2, 2, 2, 52, 51, 3, 2, 2, 2, 53, 3, 3, 2, 2, 2, 54, 55, 7, 5, 2, 2, 55, 56, 7, 22, 2, 2, 56, 57, 7, 35, 2, 2, 57, 58, 7, 21, 2, 2, 58, 59, 7, 5, 2, 2, 59, 60, 7, 26, 2, 2, 60, 61, 5, 38, 20, 2, 61, 62, 7, 27, 2, 2, 62, 63, 7, 32, 2, 2, 63, 5, 3, 2, 2, 2, 64, 66, 9, 2, 2, 2, 65, 64, 3, 2, 2, 2, 65, 66, 3, 2, 2, 2, 66, 67, 3, 2, 2, 2, 67, 71, 7, 22, 2, 2, 68, 69, 7, 26, 2, 2, 69, 70, 7, 23, 2, 2, 70, 72, 7, 27, 2, 2, 71, 68, 3, 2, 2, 2, 71, 72, 3, 2, 2, 2, 72, 73, 3, 2, 2, 2, 73, 74, 7, 35, 2, 2, 74, 75, 5, 38, 20, 2, 75, 76, 7, 32, 2, 2, 76, 7, 3, 2, 2, 2, 77, 81, 7, 22, 2, 2, 78, 79, 7, 26, 2, 2, 79, 80, 7, 23, 2, 2, 80, 82, 7, 27, 2, 2, 81, 78, 3, 2, 2, 2, 81, 82, 3, 2, 2, 2, 82, 83, 3, 2, 2, 2, 83, 84, 7, 36, 2, 2, 84, 85, 5, 38, 20, 2, 85, 86, 7, 32, 2, 2, 86, 9, 3, 2, 2, 2, 87, 88, 8, 6, 1, 2, 88, 89, 7, 22, 2, 2, 89, 90, 7, 37, 2, 2, 90, 91, 7, 22, 2, 2, 91, 102, 3, 2, 2, 2, 92, 93, 12, 5, 2, 2, 93, 101, 7, 32, 2, 2, 94, 95, 12, 4, 2, 2, 95, 97, 7, 26, 2, 2, 96, 98, 5, 16, 9, 2, 97, 96, 3, 2, 2, 2, 97, 98, 3, 2, 2, 2, 98, 99, 3, 2, 2, 2, 99, 101, 7, 27, 2, 2, 100, 92, 3, 2, 2, 2, 100, 94, 3, 2, 2, 2, 101, 104, 3, 2, 2, 2, 102, 100, 3, 2, 2, 2, 102, 103, 3, 2, 2, 2, 103, 11, 3, 2, 2, 2, 104, 102, 3, 2, 2, 2, 105, 106, 7, 22, 2, 2, 106, 107, 7, 28, 2, 2, 107, 108, 7, 23, 2, 2, 108, 109, 7, 29, 2, 2, 109, 13, 3, 2, 2, 2, 110, 112, 9, 2, 2, 2, 111, 110, 3, 2, 2, 2, 111, 112, 3, 2, 2, 2, 112, 113, 3, 2, 2, 2, 113, 114, 7, 22, 2, 2, 114, 116, 7, 26, 2, 2, 115, 117, 5, 16, 9, 2, 116, 115, 3, 2, 2, 2, 116, 117, 3, 2, 2, 2, 117, 118, 3, 2, 2, 2, 118, 119, 7, 27, 2, 2, 119, 120, 7, 32, 2, 2, 120, 15, 3, 2, 2, 2, 121, 126, 5, 38, 20, 2, 122, 123, 7, 3, 2, 2, 123, 125, 5, 38, 20, 2, 124, 122, 3, 2, 2, 2, 125, 128, 3, 2, 2, 2, 126, 124, 3, 2, 2, 2, 126, 127, 3, 2, 2, 2, 127, 17, 3, 2, 2, 2, 128, 126, 3, 2, 2, 2, 129, 130, 9, 2, 2, 2, 130, 131, 7, 22, 2, 2, 131, 142, 7, 26, 2, 2, 132, 133, 9, 2, 2, 2, 133, 139, 7, 22, 2, 2, 134, 135, 7, 3, 2, 2, 135, 136, 9, 2, 2, 2, 136, 138, 7, 22, 2, 2, 137, 134, 3, 2, 2, 2, 138, 141, 3, 2, 2, 2, 139, 137, 3, 2, 2, 2, 139, 140, 3, 2, 2, 2, 140, 143, 3, 2, 2, 2, 141, 139, 3, 2, 2, 2, 142, 132, 3, 2, 2, 2, 142, 143, 3, 2, 2, 2, 143, 144, 3, 2, 2, 2, 144, 145, 7, 27, 2, 2, 145, 149, 7, 30, 2, 2, 146, 148, 5, 2, 2, 2, 147, 146, 3, 2, 2, 2, 148, 151, 3, 2, 2, 2, 149, 147, 3, 2, 2, 2, 149, 150, 3, 2, 2, 2, 150, 152, 3, 2, 2, 2, 151, 149, 3, 2, 2, 2, 152, 153, 7, 31, 2, 2, 153, 19, 3, 2, 2, 2, 154, 155, 7, 15, 2, 2, 155, 156, 7, 26, 2, 2, 156, 157, 5, 34, 18, 2, 157, 158, 7, 27, 2, 2, 158, 162, 7, 30, 2, 2, 159, 161, 5, 2, 2, 2, 160, 159, 3, 2, 2, 2, 161, 164, 3, 2, 2, 2, 162, 160, 3, 2, 2, 2, 162, 163, 3, 2, 2, 2, 163, 165, 3, 2, 2, 2, 164, 162, 3, 2, 2, 2, 165, 166, 7, 31, 2, 2, 166, 21, 3, 2, 2, 2, 167, 168, 7, 14, 2, 2, 168, 169, 7, 15, 2, 2, 169, 170, 7, 26, 2, 2, 170, 171, 5, 34, 18, 2, 171, 172, 7, 27, 2, 2, 172, 176, 7, 30, 2, 2, 173, 175, 5, 2, 2, 2, 174, 173, 3, 2, 2, 2, 175, 178, 3, 2, 2, 2, 176, 174, 3, 2, 2, 2, 176, 177, 3, 2, 2, 2, 177, 179, 3, 2, 2, 2, 178, 176, 3, 2, 2, 2, 179, 180, 7, 31, 2, 2, 180, 23, 3, 2, 2, 2, 181, 182, 7, 14, 2, 2, 182, 186, 7, 30, 2, 2, 183, 185, 5, 2, 2, 2, 184, 183, 3, 2, 2, 2, 185, 188, 3, 2, 2, 2, 186, 184, 3, 2, 2, 2, 186, 187, 3, 2, 2, 2, 187, 189, 3, 2, 2, 2, 188, 186, 3, 2, 2, 2, 189, 190, 7, 31, 2, 2, 190, 25, 3, 2, 2, 2, 191, 195, 5, 20, 11, 2, 192, 194, 5, 22, 12, 2, 193, 192, 3, 2, 2, 2, 194, 197, 3, 2, 2, 2, 195, 193, 3, 2, 2, 2, 195, 196, 3, 2, 2, 2, 196, 199, 3, 2, 2, 2, 197, 195, 3, 2, 2, 2, 198, 200, 5, 24, 13, 2, 199, 198, 3, 2, 2, 2, 199, 200, 3, 2, 2, 2, 200, 27, 3, 2, 2, 2, 201, 202, 7, 16, 2, 2, 202, 203, 7, 26, 2, 2, 203, 204, 5, 30, 16, 2, 204, 205, 7, 27, 2, 2, 205, 209, 7, 30, 2, 2, 206, 208, 5, 2, 2, 2, 207, 206, 3, 2, 2, 2, 208, 211, 3, 2, 2, 2, 209, 207, 3, 2, 2, 2, 209, 210, 3, 2, 2, 2, 210, 212, 3, 2, 2, 2, 211, 209, 3, 2, 2, 2, 212, 213, 7, 31, 2, 2, 213, 29, 3, 2, 2, 2, 214, 215, 9, 2, 2, 2, 215, 216, 7, 22, 2, 2, 216, 217, 7, 18, 2, 2, 217, 218, 7, 22, 2, 2, 218, 31, 3, 2, 2, 2, 219, 220, 7, 17, 2, 2, 220, 221, 7, 26, 2, 2, 221, 222, 5, 34, 18, 2, 222, 223, 7, 27, 2, 2, 223, 227, 7, 30, 2, 2, 224, 226, 5, 2, 2, 2, 225, 224, 3, 2, 2, 2, 226, 229, 3, 2, 2, 2, 227, 225, 3, 2, 2, 2, 227, 228, 3, 2, 2, 2, 228, 230, 3, 2, 2, 2, 229, 227, 3, 2, 2, 2, 230, 231, 7, 31, 2, 2, 231, 33, 3, 2, 2, 2, 232, 239, 5, 38, 20, 2, 233, 234, 7, 19, 2, 2, 234, 238, 5, 38, 20, 2, 235, 236, 7, 20, 2, 2, 236, 238, 5, 38, 20, 2, 237, 233, 3, 2, 2, 2, 237, 235, 3, 2, 2, 2, 238, 241, 3, 2, 2, 2, 239, 237, 3, 2, 2, 2, 239, 240, 3, 2, 2, 2, 240, 35, 3, 2, 2, 2, 241, 239, 3, 2, 2, 2, 242, 243, 7, 22, 2, 2, 243, 244, 7, 35, 2, 2, 244, 245, 7, 26, 2, 2, 245, 246, 7, 5, 2, 2, 246, 247, 7, 27, 2, 2, 247, 248, 7, 22, 2, 2, 248, 249, 7, 32, 2, 2, 249, 37, 3, 2, 2, 2, 250, 251, 8, 20, 1, 2, 251, 252, 7, 26, 2, 2, 252, 253, 5, 38, 20, 2, 253, 254, 7, 27, 2, 2, 254, 258, 3, 2, 2, 2, 255, 258, 5, 40, 21, 2, 256, 258, 9, 3, 2, 2, 257, 250, 3, 2, 2, 2, 257, 255, 3, 2, 2, 2, 257, 256, 3, 2, 2, 2, 258, 267, 3, 2, 2, 2, 259, 260, 12, 6, 2, 2, 260, 261, 7, 6, 2, 2, 261, 266, 5, 38, 20, 7, 262, 263, 12, 5, 2, 2, 263, 264, 7, 7, 2, 2, 264, 266, 5, 38, 20, 6, 265, 259, 3, 2, 2, 2, 265, 262, 3, 2, 2, 2, 266, 269, 3, 2, 2, 2, 267, 265, 3, 2, 2, 2, 267, 268, 3, 2, 2, 2, 268, 39, 3, 2, 2, 2, 269, 267, 3, 2, 2, 2, 270, 274, 5, 10, 6, 2, 271, 274, 5, 14, 8, 2, 272, 274, 5, 12, 7, 2, 273, 270, 3, 2, 2, 2, 273, 271, 3, 2, 2, 2, 273, 272, 3, 2, 2, 2, 274, 41, 3, 2, 2, 2, 275, 278, 5, 2, 2, 2, 276, 278, 5, 18, 10, 2, 277, 275, 3, 2, 2, 2, 277, 276, 3, 2, 2, 2, 278, 279, 3, 2, 2, 2, 279, 277, 3, 2, 2, 2, 279, 280, 3, 2, 2, 2, 280, 43, 3, 2, 2, 2, 30, 52, 65, 71, 81, 97, 100, 102, 111, 116, 126, 139, 142, 149, 162, 176, 186, 195, 199, 209, 227, 237, 239, 257, 265, 267, 273, 277, 279] \ No newline at end of file diff --git a/lab/target/classes/xml.tokens b/lab/target/classes/xml.tokens new file mode 100644 index 0000000..2e703d3 --- /dev/null +++ b/lab/target/classes/xml.tokens @@ -0,0 +1,83 @@ +T__0=1 +ARRAY_TYPE=2 +TYPE=3 +ACTION_OPERATOR=4 +BOOL_OPERATOR=5 +DOCUMENT=6 +NODE=7 +ATTRIBUTE=8 +STRING=9 +INT=10 +FLOAT=11 +ELSE=12 +IF=13 +FOR=14 +WHILE=15 +IN=16 +AND=17 +OR=18 +NEW=19 +NAME=20 +NUMBER_LITERAL=21 +STRING_LITERAL=22 +WHITESPACE=23 +OPEN_BRACKET=24 +CLOSE_BRACKET=25 +OPEN_SQUAR_EBRACKET=26 +CLOSE_SQUARE_BRACKET=27 +OPEN_FIGURE_BRACKET=28 +CLOSE_FIGURE_BRACKET=29 +SEMICOLON=30 +QOUTES_ONE=31 +QOUTES_TWO=32 +ASSIGMENT=33 +SUM_ASSIGMENT=34 +DOT=35 +MORE_THAN=36 +LESS_THAN=37 +EQUAL=38 +NOT_EQUAL=39 +MORE_EQUAL=40 +LESS_EQUAL=41 +PlUS=42 +MINUS=43 +MULTIPLICATION=44 +DIVISION=45 +COMMENT=46 +','=1 +'document'=6 +'node'=7 +'attribute'=8 +'string'=9 +'int'=10 +'float'=11 +'else'=12 +'if'=13 +'for'=14 +'while'=15 +'in'=16 +'and'=17 +'or'=18 +'new'=19 +'('=24 +')'=25 +'['=26 +']'=27 +'{'=28 +'}'=29 +';'=30 +'\''=31 +'"'=32 +'='=33 +'+='=34 +'.'=35 +'>'=36 +'<'=37 +'=='=38 +'!='=39 +'>='=40 +'<='=41 +'+'=42 +'-'=43 +'*'=44 +'/'=45 diff --git a/lab/target/classes/xmlBaseListener.class b/lab/target/classes/xmlBaseListener.class new file mode 100644 index 0000000..62400ca Binary files /dev/null and b/lab/target/classes/xmlBaseListener.class differ diff --git a/lab/target/classes/xmlBaseVisitor.class b/lab/target/classes/xmlBaseVisitor.class new file mode 100644 index 0000000..8c3c34a Binary files /dev/null and b/lab/target/classes/xmlBaseVisitor.class differ diff --git a/lab/target/classes/xmlLexer.class b/lab/target/classes/xmlLexer.class new file mode 100644 index 0000000..054aac5 Binary files /dev/null and b/lab/target/classes/xmlLexer.class differ diff --git a/lab/target/classes/xmlLexer.interp b/lab/target/classes/xmlLexer.interp new file mode 100644 index 0000000..8e1ad4e --- /dev/null +++ b/lab/target/classes/xmlLexer.interp @@ -0,0 +1,155 @@ +token literal names: +null +',' +null +null +null +null +'document' +'node' +'attribute' +'string' +'int' +'float' +'else' +'if' +'for' +'while' +'in' +'and' +'or' +'new' +null +null +null +null +'(' +')' +'[' +']' +'{' +'}' +';' +'\'' +'"' +'=' +'+=' +'.' +'>' +'<' +'==' +'!=' +'>=' +'<=' +'+' +'-' +'*' +'/' +null + +token symbolic names: +null +null +ARRAY_TYPE +TYPE +ACTION_OPERATOR +BOOL_OPERATOR +DOCUMENT +NODE +ATTRIBUTE +STRING +INT +FLOAT +ELSE +IF +FOR +WHILE +IN +AND +OR +NEW +NAME +NUMBER_LITERAL +STRING_LITERAL +WHITESPACE +OPEN_BRACKET +CLOSE_BRACKET +OPEN_SQUAR_EBRACKET +CLOSE_SQUARE_BRACKET +OPEN_FIGURE_BRACKET +CLOSE_FIGURE_BRACKET +SEMICOLON +QOUTES_ONE +QOUTES_TWO +ASSIGMENT +SUM_ASSIGMENT +DOT +MORE_THAN +LESS_THAN +EQUAL +NOT_EQUAL +MORE_EQUAL +LESS_EQUAL +PlUS +MINUS +MULTIPLICATION +DIVISION +COMMENT + +rule names: +T__0 +ARRAY_TYPE +TYPE +ACTION_OPERATOR +BOOL_OPERATOR +DOCUMENT +NODE +ATTRIBUTE +STRING +INT +FLOAT +ELSE +IF +FOR +WHILE +IN +AND +OR +NEW +NAME +NUMBER_LITERAL +STRING_LITERAL +WHITESPACE +OPEN_BRACKET +CLOSE_BRACKET +OPEN_SQUAR_EBRACKET +CLOSE_SQUARE_BRACKET +OPEN_FIGURE_BRACKET +CLOSE_FIGURE_BRACKET +SEMICOLON +QOUTES_ONE +QOUTES_TWO +ASSIGMENT +SUM_ASSIGMENT +DOT +MORE_THAN +LESS_THAN +EQUAL +NOT_EQUAL +MORE_EQUAL +LESS_EQUAL +PlUS +MINUS +MULTIPLICATION +DIVISION +COMMENT + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 48, 303, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 108, 10, 4, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 114, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 122, 10, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 21, 6, 21, 198, 10, 21, 13, 21, 14, 21, 199, 3, 22, 6, 22, 203, 10, 22, 13, 22, 14, 22, 204, 3, 22, 3, 22, 6, 22, 209, 10, 22, 13, 22, 14, 22, 210, 5, 22, 213, 10, 22, 3, 23, 3, 23, 7, 23, 217, 10, 23, 12, 23, 14, 23, 220, 11, 23, 3, 23, 3, 23, 3, 23, 3, 23, 7, 23, 226, 10, 23, 12, 23, 14, 23, 229, 11, 23, 3, 23, 3, 23, 5, 23, 233, 10, 23, 3, 24, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 26, 3, 26, 3, 27, 3, 27, 3, 28, 3, 28, 3, 29, 3, 29, 3, 30, 3, 30, 3, 31, 3, 31, 3, 32, 3, 32, 3, 33, 3, 33, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 3, 36, 3, 36, 3, 37, 3, 37, 3, 38, 3, 38, 3, 39, 3, 39, 3, 39, 3, 40, 3, 40, 3, 40, 3, 41, 3, 41, 3, 41, 3, 42, 3, 42, 3, 42, 3, 43, 3, 43, 3, 44, 3, 44, 3, 45, 3, 45, 3, 46, 3, 46, 3, 47, 3, 47, 3, 47, 3, 47, 7, 47, 292, 10, 47, 12, 47, 14, 47, 295, 11, 47, 3, 47, 5, 47, 298, 10, 47, 3, 47, 3, 47, 3, 47, 3, 47, 4, 218, 227, 2, 48, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, 42, 83, 43, 85, 44, 87, 45, 89, 46, 91, 47, 93, 48, 3, 2, 6, 4, 2, 67, 92, 99, 124, 3, 2, 50, 59, 4, 2, 11, 12, 34, 34, 4, 2, 12, 12, 15, 15, 2, 324, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 91, 3, 2, 2, 2, 2, 93, 3, 2, 2, 2, 3, 95, 3, 2, 2, 2, 5, 97, 3, 2, 2, 2, 7, 107, 3, 2, 2, 2, 9, 113, 3, 2, 2, 2, 11, 121, 3, 2, 2, 2, 13, 123, 3, 2, 2, 2, 15, 132, 3, 2, 2, 2, 17, 137, 3, 2, 2, 2, 19, 147, 3, 2, 2, 2, 21, 154, 3, 2, 2, 2, 23, 158, 3, 2, 2, 2, 25, 164, 3, 2, 2, 2, 27, 169, 3, 2, 2, 2, 29, 172, 3, 2, 2, 2, 31, 176, 3, 2, 2, 2, 33, 182, 3, 2, 2, 2, 35, 185, 3, 2, 2, 2, 37, 189, 3, 2, 2, 2, 39, 192, 3, 2, 2, 2, 41, 197, 3, 2, 2, 2, 43, 202, 3, 2, 2, 2, 45, 232, 3, 2, 2, 2, 47, 234, 3, 2, 2, 2, 49, 238, 3, 2, 2, 2, 51, 240, 3, 2, 2, 2, 53, 242, 3, 2, 2, 2, 55, 244, 3, 2, 2, 2, 57, 246, 3, 2, 2, 2, 59, 248, 3, 2, 2, 2, 61, 250, 3, 2, 2, 2, 63, 252, 3, 2, 2, 2, 65, 254, 3, 2, 2, 2, 67, 256, 3, 2, 2, 2, 69, 258, 3, 2, 2, 2, 71, 261, 3, 2, 2, 2, 73, 263, 3, 2, 2, 2, 75, 265, 3, 2, 2, 2, 77, 267, 3, 2, 2, 2, 79, 270, 3, 2, 2, 2, 81, 273, 3, 2, 2, 2, 83, 276, 3, 2, 2, 2, 85, 279, 3, 2, 2, 2, 87, 281, 3, 2, 2, 2, 89, 283, 3, 2, 2, 2, 91, 285, 3, 2, 2, 2, 93, 287, 3, 2, 2, 2, 95, 96, 7, 46, 2, 2, 96, 4, 3, 2, 2, 2, 97, 98, 5, 7, 4, 2, 98, 99, 5, 53, 27, 2, 99, 100, 5, 55, 28, 2, 100, 6, 3, 2, 2, 2, 101, 108, 5, 13, 7, 2, 102, 108, 5, 15, 8, 2, 103, 108, 5, 17, 9, 2, 104, 108, 5, 19, 10, 2, 105, 108, 5, 21, 11, 2, 106, 108, 5, 23, 12, 2, 107, 101, 3, 2, 2, 2, 107, 102, 3, 2, 2, 2, 107, 103, 3, 2, 2, 2, 107, 104, 3, 2, 2, 2, 107, 105, 3, 2, 2, 2, 107, 106, 3, 2, 2, 2, 108, 8, 3, 2, 2, 2, 109, 114, 5, 85, 43, 2, 110, 114, 5, 87, 44, 2, 111, 114, 5, 89, 45, 2, 112, 114, 5, 91, 46, 2, 113, 109, 3, 2, 2, 2, 113, 110, 3, 2, 2, 2, 113, 111, 3, 2, 2, 2, 113, 112, 3, 2, 2, 2, 114, 10, 3, 2, 2, 2, 115, 122, 5, 73, 37, 2, 116, 122, 5, 81, 41, 2, 117, 122, 5, 75, 38, 2, 118, 122, 5, 83, 42, 2, 119, 122, 5, 77, 39, 2, 120, 122, 5, 79, 40, 2, 121, 115, 3, 2, 2, 2, 121, 116, 3, 2, 2, 2, 121, 117, 3, 2, 2, 2, 121, 118, 3, 2, 2, 2, 121, 119, 3, 2, 2, 2, 121, 120, 3, 2, 2, 2, 122, 12, 3, 2, 2, 2, 123, 124, 7, 102, 2, 2, 124, 125, 7, 113, 2, 2, 125, 126, 7, 101, 2, 2, 126, 127, 7, 119, 2, 2, 127, 128, 7, 111, 2, 2, 128, 129, 7, 103, 2, 2, 129, 130, 7, 112, 2, 2, 130, 131, 7, 118, 2, 2, 131, 14, 3, 2, 2, 2, 132, 133, 7, 112, 2, 2, 133, 134, 7, 113, 2, 2, 134, 135, 7, 102, 2, 2, 135, 136, 7, 103, 2, 2, 136, 16, 3, 2, 2, 2, 137, 138, 7, 99, 2, 2, 138, 139, 7, 118, 2, 2, 139, 140, 7, 118, 2, 2, 140, 141, 7, 116, 2, 2, 141, 142, 7, 107, 2, 2, 142, 143, 7, 100, 2, 2, 143, 144, 7, 119, 2, 2, 144, 145, 7, 118, 2, 2, 145, 146, 7, 103, 2, 2, 146, 18, 3, 2, 2, 2, 147, 148, 7, 117, 2, 2, 148, 149, 7, 118, 2, 2, 149, 150, 7, 116, 2, 2, 150, 151, 7, 107, 2, 2, 151, 152, 7, 112, 2, 2, 152, 153, 7, 105, 2, 2, 153, 20, 3, 2, 2, 2, 154, 155, 7, 107, 2, 2, 155, 156, 7, 112, 2, 2, 156, 157, 7, 118, 2, 2, 157, 22, 3, 2, 2, 2, 158, 159, 7, 104, 2, 2, 159, 160, 7, 110, 2, 2, 160, 161, 7, 113, 2, 2, 161, 162, 7, 99, 2, 2, 162, 163, 7, 118, 2, 2, 163, 24, 3, 2, 2, 2, 164, 165, 7, 103, 2, 2, 165, 166, 7, 110, 2, 2, 166, 167, 7, 117, 2, 2, 167, 168, 7, 103, 2, 2, 168, 26, 3, 2, 2, 2, 169, 170, 7, 107, 2, 2, 170, 171, 7, 104, 2, 2, 171, 28, 3, 2, 2, 2, 172, 173, 7, 104, 2, 2, 173, 174, 7, 113, 2, 2, 174, 175, 7, 116, 2, 2, 175, 30, 3, 2, 2, 2, 176, 177, 7, 121, 2, 2, 177, 178, 7, 106, 2, 2, 178, 179, 7, 107, 2, 2, 179, 180, 7, 110, 2, 2, 180, 181, 7, 103, 2, 2, 181, 32, 3, 2, 2, 2, 182, 183, 7, 107, 2, 2, 183, 184, 7, 112, 2, 2, 184, 34, 3, 2, 2, 2, 185, 186, 7, 99, 2, 2, 186, 187, 7, 112, 2, 2, 187, 188, 7, 102, 2, 2, 188, 36, 3, 2, 2, 2, 189, 190, 7, 113, 2, 2, 190, 191, 7, 116, 2, 2, 191, 38, 3, 2, 2, 2, 192, 193, 7, 112, 2, 2, 193, 194, 7, 103, 2, 2, 194, 195, 7, 121, 2, 2, 195, 40, 3, 2, 2, 2, 196, 198, 9, 2, 2, 2, 197, 196, 3, 2, 2, 2, 198, 199, 3, 2, 2, 2, 199, 197, 3, 2, 2, 2, 199, 200, 3, 2, 2, 2, 200, 42, 3, 2, 2, 2, 201, 203, 9, 3, 2, 2, 202, 201, 3, 2, 2, 2, 203, 204, 3, 2, 2, 2, 204, 202, 3, 2, 2, 2, 204, 205, 3, 2, 2, 2, 205, 212, 3, 2, 2, 2, 206, 208, 7, 48, 2, 2, 207, 209, 9, 3, 2, 2, 208, 207, 3, 2, 2, 2, 209, 210, 3, 2, 2, 2, 210, 208, 3, 2, 2, 2, 210, 211, 3, 2, 2, 2, 211, 213, 3, 2, 2, 2, 212, 206, 3, 2, 2, 2, 212, 213, 3, 2, 2, 2, 213, 44, 3, 2, 2, 2, 214, 218, 5, 63, 32, 2, 215, 217, 11, 2, 2, 2, 216, 215, 3, 2, 2, 2, 217, 220, 3, 2, 2, 2, 218, 219, 3, 2, 2, 2, 218, 216, 3, 2, 2, 2, 219, 221, 3, 2, 2, 2, 220, 218, 3, 2, 2, 2, 221, 222, 5, 63, 32, 2, 222, 233, 3, 2, 2, 2, 223, 227, 5, 65, 33, 2, 224, 226, 11, 2, 2, 2, 225, 224, 3, 2, 2, 2, 226, 229, 3, 2, 2, 2, 227, 228, 3, 2, 2, 2, 227, 225, 3, 2, 2, 2, 228, 230, 3, 2, 2, 2, 229, 227, 3, 2, 2, 2, 230, 231, 5, 65, 33, 2, 231, 233, 3, 2, 2, 2, 232, 214, 3, 2, 2, 2, 232, 223, 3, 2, 2, 2, 233, 46, 3, 2, 2, 2, 234, 235, 9, 4, 2, 2, 235, 236, 3, 2, 2, 2, 236, 237, 8, 24, 2, 2, 237, 48, 3, 2, 2, 2, 238, 239, 7, 42, 2, 2, 239, 50, 3, 2, 2, 2, 240, 241, 7, 43, 2, 2, 241, 52, 3, 2, 2, 2, 242, 243, 7, 93, 2, 2, 243, 54, 3, 2, 2, 2, 244, 245, 7, 95, 2, 2, 245, 56, 3, 2, 2, 2, 246, 247, 7, 125, 2, 2, 247, 58, 3, 2, 2, 2, 248, 249, 7, 127, 2, 2, 249, 60, 3, 2, 2, 2, 250, 251, 7, 61, 2, 2, 251, 62, 3, 2, 2, 2, 252, 253, 7, 41, 2, 2, 253, 64, 3, 2, 2, 2, 254, 255, 7, 36, 2, 2, 255, 66, 3, 2, 2, 2, 256, 257, 7, 63, 2, 2, 257, 68, 3, 2, 2, 2, 258, 259, 7, 45, 2, 2, 259, 260, 7, 63, 2, 2, 260, 70, 3, 2, 2, 2, 261, 262, 7, 48, 2, 2, 262, 72, 3, 2, 2, 2, 263, 264, 7, 64, 2, 2, 264, 74, 3, 2, 2, 2, 265, 266, 7, 62, 2, 2, 266, 76, 3, 2, 2, 2, 267, 268, 7, 63, 2, 2, 268, 269, 7, 63, 2, 2, 269, 78, 3, 2, 2, 2, 270, 271, 7, 35, 2, 2, 271, 272, 7, 63, 2, 2, 272, 80, 3, 2, 2, 2, 273, 274, 7, 64, 2, 2, 274, 275, 7, 63, 2, 2, 275, 82, 3, 2, 2, 2, 276, 277, 7, 62, 2, 2, 277, 278, 7, 63, 2, 2, 278, 84, 3, 2, 2, 2, 279, 280, 7, 45, 2, 2, 280, 86, 3, 2, 2, 2, 281, 282, 7, 47, 2, 2, 282, 88, 3, 2, 2, 2, 283, 284, 7, 44, 2, 2, 284, 90, 3, 2, 2, 2, 285, 286, 7, 49, 2, 2, 286, 92, 3, 2, 2, 2, 287, 288, 7, 49, 2, 2, 288, 289, 7, 49, 2, 2, 289, 293, 3, 2, 2, 2, 290, 292, 10, 5, 2, 2, 291, 290, 3, 2, 2, 2, 292, 295, 3, 2, 2, 2, 293, 291, 3, 2, 2, 2, 293, 294, 3, 2, 2, 2, 294, 297, 3, 2, 2, 2, 295, 293, 3, 2, 2, 2, 296, 298, 7, 15, 2, 2, 297, 296, 3, 2, 2, 2, 297, 298, 3, 2, 2, 2, 298, 299, 3, 2, 2, 2, 299, 300, 7, 12, 2, 2, 300, 301, 3, 2, 2, 2, 301, 302, 8, 47, 2, 2, 302, 94, 3, 2, 2, 2, 15, 2, 107, 113, 121, 199, 204, 210, 212, 218, 227, 232, 293, 297, 3, 8, 2, 2] \ No newline at end of file diff --git a/lab/target/classes/xmlLexer.tokens b/lab/target/classes/xmlLexer.tokens new file mode 100644 index 0000000..2e703d3 --- /dev/null +++ b/lab/target/classes/xmlLexer.tokens @@ -0,0 +1,83 @@ +T__0=1 +ARRAY_TYPE=2 +TYPE=3 +ACTION_OPERATOR=4 +BOOL_OPERATOR=5 +DOCUMENT=6 +NODE=7 +ATTRIBUTE=8 +STRING=9 +INT=10 +FLOAT=11 +ELSE=12 +IF=13 +FOR=14 +WHILE=15 +IN=16 +AND=17 +OR=18 +NEW=19 +NAME=20 +NUMBER_LITERAL=21 +STRING_LITERAL=22 +WHITESPACE=23 +OPEN_BRACKET=24 +CLOSE_BRACKET=25 +OPEN_SQUAR_EBRACKET=26 +CLOSE_SQUARE_BRACKET=27 +OPEN_FIGURE_BRACKET=28 +CLOSE_FIGURE_BRACKET=29 +SEMICOLON=30 +QOUTES_ONE=31 +QOUTES_TWO=32 +ASSIGMENT=33 +SUM_ASSIGMENT=34 +DOT=35 +MORE_THAN=36 +LESS_THAN=37 +EQUAL=38 +NOT_EQUAL=39 +MORE_EQUAL=40 +LESS_EQUAL=41 +PlUS=42 +MINUS=43 +MULTIPLICATION=44 +DIVISION=45 +COMMENT=46 +','=1 +'document'=6 +'node'=7 +'attribute'=8 +'string'=9 +'int'=10 +'float'=11 +'else'=12 +'if'=13 +'for'=14 +'while'=15 +'in'=16 +'and'=17 +'or'=18 +'new'=19 +'('=24 +')'=25 +'['=26 +']'=27 +'{'=28 +'}'=29 +';'=30 +'\''=31 +'"'=32 +'='=33 +'+='=34 +'.'=35 +'>'=36 +'<'=37 +'=='=38 +'!='=39 +'>='=40 +'<='=41 +'+'=42 +'-'=43 +'*'=44 +'/'=45 diff --git a/lab/target/classes/xmlListener.class b/lab/target/classes/xmlListener.class new file mode 100644 index 0000000..fc1b8e6 Binary files /dev/null and b/lab/target/classes/xmlListener.class differ diff --git a/lab/target/classes/xmlParser$Add_assignmentContext.class b/lab/target/classes/xmlParser$Add_assignmentContext.class new file mode 100644 index 0000000..0903019 Binary files /dev/null and b/lab/target/classes/xmlParser$Add_assignmentContext.class differ diff --git a/lab/target/classes/xmlParser$AssignmentContext.class b/lab/target/classes/xmlParser$AssignmentContext.class new file mode 100644 index 0000000..d2dca0e Binary files /dev/null and b/lab/target/classes/xmlParser$AssignmentContext.class differ diff --git a/lab/target/classes/xmlParser$ConditionContext.class b/lab/target/classes/xmlParser$ConditionContext.class new file mode 100644 index 0000000..a37b678 Binary files /dev/null and b/lab/target/classes/xmlParser$ConditionContext.class differ diff --git a/lab/target/classes/xmlParser$Else_blockContext.class b/lab/target/classes/xmlParser$Else_blockContext.class new file mode 100644 index 0000000..7e3de30 Binary files /dev/null and b/lab/target/classes/xmlParser$Else_blockContext.class differ diff --git a/lab/target/classes/xmlParser$Else_if_blockContext.class b/lab/target/classes/xmlParser$Else_if_blockContext.class new file mode 100644 index 0000000..87274b8 Binary files /dev/null and b/lab/target/classes/xmlParser$Else_if_blockContext.class differ diff --git a/lab/target/classes/xmlParser$ExpressionContext.class b/lab/target/classes/xmlParser$ExpressionContext.class new file mode 100644 index 0000000..fc35869 Binary files /dev/null and b/lab/target/classes/xmlParser$ExpressionContext.class differ diff --git a/lab/target/classes/xmlParser$For_statementContext.class b/lab/target/classes/xmlParser$For_statementContext.class new file mode 100644 index 0000000..4150837 Binary files /dev/null and b/lab/target/classes/xmlParser$For_statementContext.class differ diff --git a/lab/target/classes/xmlParser$Func_callContext.class b/lab/target/classes/xmlParser$Func_callContext.class new file mode 100644 index 0000000..807b9be Binary files /dev/null and b/lab/target/classes/xmlParser$Func_callContext.class differ diff --git a/lab/target/classes/xmlParser$Get_array_elemContext.class b/lab/target/classes/xmlParser$Get_array_elemContext.class new file mode 100644 index 0000000..2faa609 Binary files /dev/null and b/lab/target/classes/xmlParser$Get_array_elemContext.class differ diff --git a/lab/target/classes/xmlParser$Get_elemContext.class b/lab/target/classes/xmlParser$Get_elemContext.class new file mode 100644 index 0000000..92d3798 Binary files /dev/null and b/lab/target/classes/xmlParser$Get_elemContext.class differ diff --git a/lab/target/classes/xmlParser$Get_operationContext.class b/lab/target/classes/xmlParser$Get_operationContext.class new file mode 100644 index 0000000..d1db5cd Binary files /dev/null and b/lab/target/classes/xmlParser$Get_operationContext.class differ diff --git a/lab/target/classes/xmlParser$If_blockContext.class b/lab/target/classes/xmlParser$If_blockContext.class new file mode 100644 index 0000000..d2b84c4 Binary files /dev/null and b/lab/target/classes/xmlParser$If_blockContext.class differ diff --git a/lab/target/classes/xmlParser$If_statementContext.class b/lab/target/classes/xmlParser$If_statementContext.class new file mode 100644 index 0000000..3c7be7e Binary files /dev/null and b/lab/target/classes/xmlParser$If_statementContext.class differ diff --git a/lab/target/classes/xmlParser$Initialise_funcContext.class b/lab/target/classes/xmlParser$Initialise_funcContext.class new file mode 100644 index 0000000..4807deb Binary files /dev/null and b/lab/target/classes/xmlParser$Initialise_funcContext.class differ diff --git a/lab/target/classes/xmlParser$Initialise_varContext.class b/lab/target/classes/xmlParser$Initialise_varContext.class new file mode 100644 index 0000000..df05538 Binary files /dev/null and b/lab/target/classes/xmlParser$Initialise_varContext.class differ diff --git a/lab/target/classes/xmlParser$OperationContext.class b/lab/target/classes/xmlParser$OperationContext.class new file mode 100644 index 0000000..1df53d7 Binary files /dev/null and b/lab/target/classes/xmlParser$OperationContext.class differ diff --git a/lab/target/classes/xmlParser$ParamsContext.class b/lab/target/classes/xmlParser$ParamsContext.class new file mode 100644 index 0000000..428c9e3 Binary files /dev/null and b/lab/target/classes/xmlParser$ParamsContext.class differ diff --git a/lab/target/classes/xmlParser$Range_statementContext.class b/lab/target/classes/xmlParser$Range_statementContext.class new file mode 100644 index 0000000..ac8383c Binary files /dev/null and b/lab/target/classes/xmlParser$Range_statementContext.class differ diff --git a/lab/target/classes/xmlParser$Type_castContext.class b/lab/target/classes/xmlParser$Type_castContext.class new file mode 100644 index 0000000..2e5d03d Binary files /dev/null and b/lab/target/classes/xmlParser$Type_castContext.class differ diff --git a/lab/target/classes/xmlParser$While_statementContext.class b/lab/target/classes/xmlParser$While_statementContext.class new file mode 100644 index 0000000..d9740ce Binary files /dev/null and b/lab/target/classes/xmlParser$While_statementContext.class differ diff --git a/lab/target/classes/xmlParser$XmlContext.class b/lab/target/classes/xmlParser$XmlContext.class new file mode 100644 index 0000000..09f5a2e Binary files /dev/null and b/lab/target/classes/xmlParser$XmlContext.class differ diff --git a/lab/target/classes/xmlParser.class b/lab/target/classes/xmlParser.class new file mode 100644 index 0000000..359a857 Binary files /dev/null and b/lab/target/classes/xmlParser.class differ diff --git a/lab/target/classes/xmlVisitor.class b/lab/target/classes/xmlVisitor.class new file mode 100644 index 0000000..1da1b92 Binary files /dev/null and b/lab/target/classes/xmlVisitor.class differ diff --git a/lab/target/classes/xmlWalker.class b/lab/target/classes/xmlWalker.class new file mode 100644 index 0000000..aad89c6 Binary files /dev/null and b/lab/target/classes/xmlWalker.class differ