diff --git a/src/main/antlr/.antlr/VSLLexer.interp b/src/main/antlr/.antlr/VSLLexer.interp index 870071c..a73b4cb 100644 --- a/src/main/antlr/.antlr/VSLLexer.interp +++ b/src/main/antlr/.antlr/VSLLexer.interp @@ -8,6 +8,7 @@ null '<' '>=' '>' +':=' 'IF' 'THEN' 'ELSE' @@ -41,6 +42,7 @@ LE LT GE GT +ASSIGN IF THEN ELSE @@ -73,6 +75,7 @@ LE LT GE GT +ASSIGN IF THEN ELSE @@ -107,4 +110,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 30, 199, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 4, 18, 148, 8, 18, 11, 18, 12, 18, 149, 1, 18, 1, 18, 1, 19, 4, 19, 155, 8, 19, 11, 19, 12, 19, 156, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 5, 27, 175, 8, 27, 10, 27, 12, 27, 178, 9, 27, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 5, 29, 187, 8, 29, 10, 29, 12, 29, 190, 9, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 1, 31, 1, 32, 1, 32, 0, 0, 33, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 0, 63, 0, 65, 0, 1, 0, 5, 2, 0, 65, 90, 97, 122, 5, 0, 45, 45, 48, 57, 65, 90, 95, 95, 97, 122, 2, 0, 9, 10, 32, 32, 1, 0, 10, 10, 2, 0, 10, 10, 34, 34, 199, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 1, 67, 1, 0, 0, 0, 3, 72, 1, 0, 0, 0, 5, 78, 1, 0, 0, 0, 7, 82, 1, 0, 0, 0, 9, 87, 1, 0, 0, 0, 11, 90, 1, 0, 0, 0, 13, 92, 1, 0, 0, 0, 15, 95, 1, 0, 0, 0, 17, 97, 1, 0, 0, 0, 19, 100, 1, 0, 0, 0, 21, 105, 1, 0, 0, 0, 23, 110, 1, 0, 0, 0, 25, 113, 1, 0, 0, 0, 27, 119, 1, 0, 0, 0, 29, 122, 1, 0, 0, 0, 31, 127, 1, 0, 0, 0, 33, 132, 1, 0, 0, 0, 35, 138, 1, 0, 0, 0, 37, 145, 1, 0, 0, 0, 39, 154, 1, 0, 0, 0, 41, 158, 1, 0, 0, 0, 43, 160, 1, 0, 0, 0, 45, 162, 1, 0, 0, 0, 47, 164, 1, 0, 0, 0, 49, 166, 1, 0, 0, 0, 51, 168, 1, 0, 0, 0, 53, 170, 1, 0, 0, 0, 55, 172, 1, 0, 0, 0, 57, 179, 1, 0, 0, 0, 59, 182, 1, 0, 0, 0, 61, 193, 1, 0, 0, 0, 63, 195, 1, 0, 0, 0, 65, 197, 1, 0, 0, 0, 67, 68, 5, 70, 0, 0, 68, 69, 5, 85, 0, 0, 69, 70, 5, 78, 0, 0, 70, 71, 5, 67, 0, 0, 71, 2, 1, 0, 0, 0, 72, 73, 5, 80, 0, 0, 73, 74, 5, 82, 0, 0, 74, 75, 5, 79, 0, 0, 75, 76, 5, 84, 0, 0, 76, 77, 5, 79, 0, 0, 77, 4, 1, 0, 0, 0, 78, 79, 5, 73, 0, 0, 79, 80, 5, 78, 0, 0, 80, 81, 5, 84, 0, 0, 81, 6, 1, 0, 0, 0, 82, 83, 5, 86, 0, 0, 83, 84, 5, 79, 0, 0, 84, 85, 5, 73, 0, 0, 85, 86, 5, 68, 0, 0, 86, 8, 1, 0, 0, 0, 87, 88, 5, 60, 0, 0, 88, 89, 5, 61, 0, 0, 89, 10, 1, 0, 0, 0, 90, 91, 5, 60, 0, 0, 91, 12, 1, 0, 0, 0, 92, 93, 5, 62, 0, 0, 93, 94, 5, 61, 0, 0, 94, 14, 1, 0, 0, 0, 95, 96, 5, 62, 0, 0, 96, 16, 1, 0, 0, 0, 97, 98, 5, 73, 0, 0, 98, 99, 5, 70, 0, 0, 99, 18, 1, 0, 0, 0, 100, 101, 5, 84, 0, 0, 101, 102, 5, 72, 0, 0, 102, 103, 5, 69, 0, 0, 103, 104, 5, 78, 0, 0, 104, 20, 1, 0, 0, 0, 105, 106, 5, 69, 0, 0, 106, 107, 5, 76, 0, 0, 107, 108, 5, 83, 0, 0, 108, 109, 5, 69, 0, 0, 109, 22, 1, 0, 0, 0, 110, 111, 5, 70, 0, 0, 111, 112, 5, 73, 0, 0, 112, 24, 1, 0, 0, 0, 113, 114, 5, 87, 0, 0, 114, 115, 5, 72, 0, 0, 115, 116, 5, 73, 0, 0, 116, 117, 5, 76, 0, 0, 117, 118, 5, 69, 0, 0, 118, 26, 1, 0, 0, 0, 119, 120, 5, 68, 0, 0, 120, 121, 5, 79, 0, 0, 121, 28, 1, 0, 0, 0, 122, 123, 5, 68, 0, 0, 123, 124, 5, 79, 0, 0, 124, 125, 5, 78, 0, 0, 125, 126, 5, 69, 0, 0, 126, 30, 1, 0, 0, 0, 127, 128, 5, 82, 0, 0, 128, 129, 5, 69, 0, 0, 129, 130, 5, 65, 0, 0, 130, 131, 5, 68, 0, 0, 131, 32, 1, 0, 0, 0, 132, 133, 5, 80, 0, 0, 133, 134, 5, 82, 0, 0, 134, 135, 5, 73, 0, 0, 135, 136, 5, 78, 0, 0, 136, 137, 5, 84, 0, 0, 137, 34, 1, 0, 0, 0, 138, 139, 5, 82, 0, 0, 139, 140, 5, 69, 0, 0, 140, 141, 5, 84, 0, 0, 141, 142, 5, 85, 0, 0, 142, 143, 5, 82, 0, 0, 143, 144, 5, 78, 0, 0, 144, 36, 1, 0, 0, 0, 145, 147, 5, 34, 0, 0, 146, 148, 3, 65, 32, 0, 147, 146, 1, 0, 0, 0, 148, 149, 1, 0, 0, 0, 149, 147, 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 152, 5, 34, 0, 0, 152, 38, 1, 0, 0, 0, 153, 155, 3, 63, 31, 0, 154, 153, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156, 154, 1, 0, 0, 0, 156, 157, 1, 0, 0, 0, 157, 40, 1, 0, 0, 0, 158, 159, 5, 40, 0, 0, 159, 42, 1, 0, 0, 0, 160, 161, 5, 41, 0, 0, 161, 44, 1, 0, 0, 0, 162, 163, 5, 43, 0, 0, 163, 46, 1, 0, 0, 0, 164, 165, 5, 45, 0, 0, 165, 48, 1, 0, 0, 0, 166, 167, 5, 47, 0, 0, 167, 50, 1, 0, 0, 0, 168, 169, 5, 42, 0, 0, 169, 52, 1, 0, 0, 0, 170, 171, 5, 37, 0, 0, 171, 54, 1, 0, 0, 0, 172, 176, 7, 0, 0, 0, 173, 175, 7, 1, 0, 0, 174, 173, 1, 0, 0, 0, 175, 178, 1, 0, 0, 0, 176, 174, 1, 0, 0, 0, 176, 177, 1, 0, 0, 0, 177, 56, 1, 0, 0, 0, 178, 176, 1, 0, 0, 0, 179, 180, 7, 2, 0, 0, 180, 181, 6, 28, 0, 0, 181, 58, 1, 0, 0, 0, 182, 183, 5, 47, 0, 0, 183, 184, 5, 47, 0, 0, 184, 188, 1, 0, 0, 0, 185, 187, 8, 3, 0, 0, 186, 185, 1, 0, 0, 0, 187, 190, 1, 0, 0, 0, 188, 186, 1, 0, 0, 0, 188, 189, 1, 0, 0, 0, 189, 191, 1, 0, 0, 0, 190, 188, 1, 0, 0, 0, 191, 192, 6, 29, 1, 0, 192, 60, 1, 0, 0, 0, 193, 194, 2, 97, 122, 0, 194, 62, 1, 0, 0, 0, 195, 196, 2, 48, 57, 0, 196, 64, 1, 0, 0, 0, 197, 198, 8, 4, 0, 0, 198, 66, 1, 0, 0, 0, 5, 0, 149, 156, 176, 188, 2, 1, 28, 0, 1, 29, 1] \ No newline at end of file +[4, 0, 31, 204, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 4, 19, 153, 8, 19, 11, 19, 12, 19, 154, 1, 19, 1, 19, 1, 20, 4, 20, 160, 8, 20, 11, 20, 12, 20, 161, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 5, 28, 180, 8, 28, 10, 28, 12, 28, 183, 9, 28, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 5, 30, 192, 8, 30, 10, 30, 12, 30, 195, 9, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 32, 1, 32, 1, 33, 1, 33, 0, 0, 34, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 0, 65, 0, 67, 0, 1, 0, 5, 2, 0, 65, 90, 97, 122, 5, 0, 45, 45, 48, 57, 65, 90, 95, 95, 97, 122, 2, 0, 9, 10, 32, 32, 1, 0, 10, 10, 2, 0, 10, 10, 34, 34, 204, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 1, 69, 1, 0, 0, 0, 3, 74, 1, 0, 0, 0, 5, 80, 1, 0, 0, 0, 7, 84, 1, 0, 0, 0, 9, 89, 1, 0, 0, 0, 11, 92, 1, 0, 0, 0, 13, 94, 1, 0, 0, 0, 15, 97, 1, 0, 0, 0, 17, 99, 1, 0, 0, 0, 19, 102, 1, 0, 0, 0, 21, 105, 1, 0, 0, 0, 23, 110, 1, 0, 0, 0, 25, 115, 1, 0, 0, 0, 27, 118, 1, 0, 0, 0, 29, 124, 1, 0, 0, 0, 31, 127, 1, 0, 0, 0, 33, 132, 1, 0, 0, 0, 35, 137, 1, 0, 0, 0, 37, 143, 1, 0, 0, 0, 39, 150, 1, 0, 0, 0, 41, 159, 1, 0, 0, 0, 43, 163, 1, 0, 0, 0, 45, 165, 1, 0, 0, 0, 47, 167, 1, 0, 0, 0, 49, 169, 1, 0, 0, 0, 51, 171, 1, 0, 0, 0, 53, 173, 1, 0, 0, 0, 55, 175, 1, 0, 0, 0, 57, 177, 1, 0, 0, 0, 59, 184, 1, 0, 0, 0, 61, 187, 1, 0, 0, 0, 63, 198, 1, 0, 0, 0, 65, 200, 1, 0, 0, 0, 67, 202, 1, 0, 0, 0, 69, 70, 5, 70, 0, 0, 70, 71, 5, 85, 0, 0, 71, 72, 5, 78, 0, 0, 72, 73, 5, 67, 0, 0, 73, 2, 1, 0, 0, 0, 74, 75, 5, 80, 0, 0, 75, 76, 5, 82, 0, 0, 76, 77, 5, 79, 0, 0, 77, 78, 5, 84, 0, 0, 78, 79, 5, 79, 0, 0, 79, 4, 1, 0, 0, 0, 80, 81, 5, 73, 0, 0, 81, 82, 5, 78, 0, 0, 82, 83, 5, 84, 0, 0, 83, 6, 1, 0, 0, 0, 84, 85, 5, 86, 0, 0, 85, 86, 5, 79, 0, 0, 86, 87, 5, 73, 0, 0, 87, 88, 5, 68, 0, 0, 88, 8, 1, 0, 0, 0, 89, 90, 5, 60, 0, 0, 90, 91, 5, 61, 0, 0, 91, 10, 1, 0, 0, 0, 92, 93, 5, 60, 0, 0, 93, 12, 1, 0, 0, 0, 94, 95, 5, 62, 0, 0, 95, 96, 5, 61, 0, 0, 96, 14, 1, 0, 0, 0, 97, 98, 5, 62, 0, 0, 98, 16, 1, 0, 0, 0, 99, 100, 5, 58, 0, 0, 100, 101, 5, 61, 0, 0, 101, 18, 1, 0, 0, 0, 102, 103, 5, 73, 0, 0, 103, 104, 5, 70, 0, 0, 104, 20, 1, 0, 0, 0, 105, 106, 5, 84, 0, 0, 106, 107, 5, 72, 0, 0, 107, 108, 5, 69, 0, 0, 108, 109, 5, 78, 0, 0, 109, 22, 1, 0, 0, 0, 110, 111, 5, 69, 0, 0, 111, 112, 5, 76, 0, 0, 112, 113, 5, 83, 0, 0, 113, 114, 5, 69, 0, 0, 114, 24, 1, 0, 0, 0, 115, 116, 5, 70, 0, 0, 116, 117, 5, 73, 0, 0, 117, 26, 1, 0, 0, 0, 118, 119, 5, 87, 0, 0, 119, 120, 5, 72, 0, 0, 120, 121, 5, 73, 0, 0, 121, 122, 5, 76, 0, 0, 122, 123, 5, 69, 0, 0, 123, 28, 1, 0, 0, 0, 124, 125, 5, 68, 0, 0, 125, 126, 5, 79, 0, 0, 126, 30, 1, 0, 0, 0, 127, 128, 5, 68, 0, 0, 128, 129, 5, 79, 0, 0, 129, 130, 5, 78, 0, 0, 130, 131, 5, 69, 0, 0, 131, 32, 1, 0, 0, 0, 132, 133, 5, 82, 0, 0, 133, 134, 5, 69, 0, 0, 134, 135, 5, 65, 0, 0, 135, 136, 5, 68, 0, 0, 136, 34, 1, 0, 0, 0, 137, 138, 5, 80, 0, 0, 138, 139, 5, 82, 0, 0, 139, 140, 5, 73, 0, 0, 140, 141, 5, 78, 0, 0, 141, 142, 5, 84, 0, 0, 142, 36, 1, 0, 0, 0, 143, 144, 5, 82, 0, 0, 144, 145, 5, 69, 0, 0, 145, 146, 5, 84, 0, 0, 146, 147, 5, 85, 0, 0, 147, 148, 5, 82, 0, 0, 148, 149, 5, 78, 0, 0, 149, 38, 1, 0, 0, 0, 150, 152, 5, 34, 0, 0, 151, 153, 3, 67, 33, 0, 152, 151, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 152, 1, 0, 0, 0, 154, 155, 1, 0, 0, 0, 155, 156, 1, 0, 0, 0, 156, 157, 5, 34, 0, 0, 157, 40, 1, 0, 0, 0, 158, 160, 3, 65, 32, 0, 159, 158, 1, 0, 0, 0, 160, 161, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 42, 1, 0, 0, 0, 163, 164, 5, 40, 0, 0, 164, 44, 1, 0, 0, 0, 165, 166, 5, 41, 0, 0, 166, 46, 1, 0, 0, 0, 167, 168, 5, 43, 0, 0, 168, 48, 1, 0, 0, 0, 169, 170, 5, 45, 0, 0, 170, 50, 1, 0, 0, 0, 171, 172, 5, 47, 0, 0, 172, 52, 1, 0, 0, 0, 173, 174, 5, 42, 0, 0, 174, 54, 1, 0, 0, 0, 175, 176, 5, 37, 0, 0, 176, 56, 1, 0, 0, 0, 177, 181, 7, 0, 0, 0, 178, 180, 7, 1, 0, 0, 179, 178, 1, 0, 0, 0, 180, 183, 1, 0, 0, 0, 181, 179, 1, 0, 0, 0, 181, 182, 1, 0, 0, 0, 182, 58, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 184, 185, 7, 2, 0, 0, 185, 186, 6, 29, 0, 0, 186, 60, 1, 0, 0, 0, 187, 188, 5, 47, 0, 0, 188, 189, 5, 47, 0, 0, 189, 193, 1, 0, 0, 0, 190, 192, 8, 3, 0, 0, 191, 190, 1, 0, 0, 0, 192, 195, 1, 0, 0, 0, 193, 191, 1, 0, 0, 0, 193, 194, 1, 0, 0, 0, 194, 196, 1, 0, 0, 0, 195, 193, 1, 0, 0, 0, 196, 197, 6, 30, 1, 0, 197, 62, 1, 0, 0, 0, 198, 199, 2, 97, 122, 0, 199, 64, 1, 0, 0, 0, 200, 201, 2, 48, 57, 0, 201, 66, 1, 0, 0, 0, 202, 203, 8, 4, 0, 0, 203, 68, 1, 0, 0, 0, 5, 0, 154, 161, 181, 193, 2, 1, 29, 0, 1, 30, 1] \ No newline at end of file diff --git a/src/main/antlr/.antlr/VSLLexer.java b/src/main/antlr/.antlr/VSLLexer.java index b3fe90f..7700158 100644 --- a/src/main/antlr/.antlr/VSLLexer.java +++ b/src/main/antlr/.antlr/VSLLexer.java @@ -20,9 +20,9 @@ public class VSLLexer extends Lexer { new PredictionContextCache(); public static final int FUNCTION=1, PROTOTYPE=2, TYPE_INT=3, TYPE_VOID=4, LE=5, LT=6, GE=7, GT=8, - IF=9, THEN=10, ELSE=11, FIN=12, WHILE=13, DO=14, DONE=15, READ=16, PRINT=17, - RETURN=18, TEXT=19, NUMBER=20, ParO=21, ParF=22, PLUS=23, MINUS=24, DIV=25, - TIMES=26, MOD=27, IDENT=28, WS=29, COMMENT=30; + ASSIGN=9, IF=10, THEN=11, ELSE=12, FIN=13, WHILE=14, DO=15, DONE=16, READ=17, + PRINT=18, RETURN=19, TEXT=20, NUMBER=21, ParO=22, ParF=23, PLUS=24, MINUS=25, + DIV=26, TIMES=27, MOD=28, IDENT=29, WS=30, COMMENT=31; public static String[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" }; @@ -34,9 +34,9 @@ public class VSLLexer extends Lexer { private static String[] makeRuleNames() { return new String[] { "FUNCTION", "PROTOTYPE", "TYPE_INT", "TYPE_VOID", "LE", "LT", "GE", "GT", - "IF", "THEN", "ELSE", "FIN", "WHILE", "DO", "DONE", "READ", "PRINT", - "RETURN", "TEXT", "NUMBER", "ParO", "ParF", "PLUS", "MINUS", "DIV", "TIMES", - "MOD", "IDENT", "WS", "COMMENT", "LETTER", "DIGIT", "ASCII" + "ASSIGN", "IF", "THEN", "ELSE", "FIN", "WHILE", "DO", "DONE", "READ", + "PRINT", "RETURN", "TEXT", "NUMBER", "ParO", "ParF", "PLUS", "MINUS", + "DIV", "TIMES", "MOD", "IDENT", "WS", "COMMENT", "LETTER", "DIGIT", "ASCII" }; } public static final String[] ruleNames = makeRuleNames(); @@ -44,18 +44,18 @@ public class VSLLexer extends Lexer { private static String[] makeLiteralNames() { return new String[] { null, "'FUNC'", "'PROTO'", "'INT'", "'VOID'", "'<='", "'<'", "'>='", - "'>'", "'IF'", "'THEN'", "'ELSE'", "'FI'", "'WHILE'", "'DO'", "'DONE'", - "'READ'", "'PRINT'", "'RETURN'", null, null, "'('", "')'", "'+'", "'-'", - "'/'", "'*'", "'%'" + "'>'", "':='", "'IF'", "'THEN'", "'ELSE'", "'FI'", "'WHILE'", "'DO'", + "'DONE'", "'READ'", "'PRINT'", "'RETURN'", null, null, "'('", "')'", + "'+'", "'-'", "'/'", "'*'", "'%'" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { null, "FUNCTION", "PROTOTYPE", "TYPE_INT", "TYPE_VOID", "LE", "LT", "GE", - "GT", "IF", "THEN", "ELSE", "FIN", "WHILE", "DO", "DONE", "READ", "PRINT", - "RETURN", "TEXT", "NUMBER", "ParO", "ParF", "PLUS", "MINUS", "DIV", "TIMES", - "MOD", "IDENT", "WS", "COMMENT" + "GT", "ASSIGN", "IF", "THEN", "ELSE", "FIN", "WHILE", "DO", "DONE", "READ", + "PRINT", "RETURN", "TEXT", "NUMBER", "ParO", "ParF", "PLUS", "MINUS", + "DIV", "TIMES", "MOD", "IDENT", "WS", "COMMENT" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); @@ -119,10 +119,10 @@ public class VSLLexer extends Lexer { @Override public void action(RuleContext _localctx, int ruleIndex, int actionIndex) { switch (ruleIndex) { - case 28: + case 29: WS_action((RuleContext)_localctx, actionIndex); break; - case 29: + case 30: COMMENT_action((RuleContext)_localctx, actionIndex); break; } @@ -143,7 +143,7 @@ public class VSLLexer extends Lexer { } public static final String _serializedATN = - "\u0004\u0000\u001e\u00c7\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002"+ + "\u0004\u0000\u001f\u00cc\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002"+ "\u0001\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002"+ "\u0004\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002"+ "\u0007\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002"+ @@ -153,117 +153,120 @@ public class VSLLexer extends Lexer { "\u0002\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017"+ "\u0002\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a"+ "\u0002\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d"+ - "\u0002\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0001\u0000"+ - "\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001"+ - "\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002"+ - "\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003"+ - "\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005"+ - "\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001\b\u0001"+ - "\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001"+ - "\n\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\f\u0001\f"+ - "\u0001\f\u0001\f\u0001\f\u0001\f\u0001\r\u0001\r\u0001\r\u0001\u000e\u0001"+ - "\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f\u0001"+ - "\u000f\u0001\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0010\u0001"+ - "\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0011\u0001"+ - "\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0004"+ - "\u0012\u0094\b\u0012\u000b\u0012\f\u0012\u0095\u0001\u0012\u0001\u0012"+ - "\u0001\u0013\u0004\u0013\u009b\b\u0013\u000b\u0013\f\u0013\u009c\u0001"+ - "\u0014\u0001\u0014\u0001\u0015\u0001\u0015\u0001\u0016\u0001\u0016\u0001"+ - "\u0017\u0001\u0017\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001"+ - "\u001a\u0001\u001a\u0001\u001b\u0001\u001b\u0005\u001b\u00af\b\u001b\n"+ - "\u001b\f\u001b\u00b2\t\u001b\u0001\u001c\u0001\u001c\u0001\u001c\u0001"+ - "\u001d\u0001\u001d\u0001\u001d\u0001\u001d\u0005\u001d\u00bb\b\u001d\n"+ - "\u001d\f\u001d\u00be\t\u001d\u0001\u001d\u0001\u001d\u0001\u001e\u0001"+ - "\u001e\u0001\u001f\u0001\u001f\u0001 \u0001 \u0000\u0000!\u0001\u0001"+ - "\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005\u000b\u0006\r\u0007\u000f"+ - "\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019\r\u001b\u000e\u001d\u000f"+ - "\u001f\u0010!\u0011#\u0012%\u0013\'\u0014)\u0015+\u0016-\u0017/\u0018"+ - "1\u00193\u001a5\u001b7\u001c9\u001d;\u001e=\u0000?\u0000A\u0000\u0001"+ - "\u0000\u0005\u0002\u0000AZaz\u0005\u0000--09AZ__az\u0002\u0000\t\n \u0001"+ - "\u0000\n\n\u0002\u0000\n\n\"\"\u00c7\u0000\u0001\u0001\u0000\u0000\u0000"+ - "\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000\u0000"+ - "\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000\u0000"+ - "\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000\u000f"+ - "\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000\u0000\u0000\u0000\u0013"+ - "\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000\u0000\u0000\u0000\u0017"+ - "\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000\u0000\u0000\u0000\u001b"+ - "\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000\u0000\u0000\u0000\u001f"+ - "\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000\u0000\u0000#\u0001\u0000"+ - "\u0000\u0000\u0000%\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000\u0000"+ - "\u0000\u0000)\u0001\u0000\u0000\u0000\u0000+\u0001\u0000\u0000\u0000\u0000"+ - "-\u0001\u0000\u0000\u0000\u0000/\u0001\u0000\u0000\u0000\u00001\u0001"+ - "\u0000\u0000\u0000\u00003\u0001\u0000\u0000\u0000\u00005\u0001\u0000\u0000"+ - "\u0000\u00007\u0001\u0000\u0000\u0000\u00009\u0001\u0000\u0000\u0000\u0000"+ - ";\u0001\u0000\u0000\u0000\u0001C\u0001\u0000\u0000\u0000\u0003H\u0001"+ - "\u0000\u0000\u0000\u0005N\u0001\u0000\u0000\u0000\u0007R\u0001\u0000\u0000"+ - "\u0000\tW\u0001\u0000\u0000\u0000\u000bZ\u0001\u0000\u0000\u0000\r\\\u0001"+ - "\u0000\u0000\u0000\u000f_\u0001\u0000\u0000\u0000\u0011a\u0001\u0000\u0000"+ - "\u0000\u0013d\u0001\u0000\u0000\u0000\u0015i\u0001\u0000\u0000\u0000\u0017"+ - "n\u0001\u0000\u0000\u0000\u0019q\u0001\u0000\u0000\u0000\u001bw\u0001"+ - "\u0000\u0000\u0000\u001dz\u0001\u0000\u0000\u0000\u001f\u007f\u0001\u0000"+ - "\u0000\u0000!\u0084\u0001\u0000\u0000\u0000#\u008a\u0001\u0000\u0000\u0000"+ - "%\u0091\u0001\u0000\u0000\u0000\'\u009a\u0001\u0000\u0000\u0000)\u009e"+ - "\u0001\u0000\u0000\u0000+\u00a0\u0001\u0000\u0000\u0000-\u00a2\u0001\u0000"+ - "\u0000\u0000/\u00a4\u0001\u0000\u0000\u00001\u00a6\u0001\u0000\u0000\u0000"+ - "3\u00a8\u0001\u0000\u0000\u00005\u00aa\u0001\u0000\u0000\u00007\u00ac"+ - "\u0001\u0000\u0000\u00009\u00b3\u0001\u0000\u0000\u0000;\u00b6\u0001\u0000"+ - "\u0000\u0000=\u00c1\u0001\u0000\u0000\u0000?\u00c3\u0001\u0000\u0000\u0000"+ - "A\u00c5\u0001\u0000\u0000\u0000CD\u0005F\u0000\u0000DE\u0005U\u0000\u0000"+ - "EF\u0005N\u0000\u0000FG\u0005C\u0000\u0000G\u0002\u0001\u0000\u0000\u0000"+ - "HI\u0005P\u0000\u0000IJ\u0005R\u0000\u0000JK\u0005O\u0000\u0000KL\u0005"+ - "T\u0000\u0000LM\u0005O\u0000\u0000M\u0004\u0001\u0000\u0000\u0000NO\u0005"+ - "I\u0000\u0000OP\u0005N\u0000\u0000PQ\u0005T\u0000\u0000Q\u0006\u0001\u0000"+ - "\u0000\u0000RS\u0005V\u0000\u0000ST\u0005O\u0000\u0000TU\u0005I\u0000"+ - "\u0000UV\u0005D\u0000\u0000V\b\u0001\u0000\u0000\u0000WX\u0005<\u0000"+ - "\u0000XY\u0005=\u0000\u0000Y\n\u0001\u0000\u0000\u0000Z[\u0005<\u0000"+ - "\u0000[\f\u0001\u0000\u0000\u0000\\]\u0005>\u0000\u0000]^\u0005=\u0000"+ - "\u0000^\u000e\u0001\u0000\u0000\u0000_`\u0005>\u0000\u0000`\u0010\u0001"+ - "\u0000\u0000\u0000ab\u0005I\u0000\u0000bc\u0005F\u0000\u0000c\u0012\u0001"+ - "\u0000\u0000\u0000de\u0005T\u0000\u0000ef\u0005H\u0000\u0000fg\u0005E"+ - "\u0000\u0000gh\u0005N\u0000\u0000h\u0014\u0001\u0000\u0000\u0000ij\u0005"+ - "E\u0000\u0000jk\u0005L\u0000\u0000kl\u0005S\u0000\u0000lm\u0005E\u0000"+ - "\u0000m\u0016\u0001\u0000\u0000\u0000no\u0005F\u0000\u0000op\u0005I\u0000"+ - "\u0000p\u0018\u0001\u0000\u0000\u0000qr\u0005W\u0000\u0000rs\u0005H\u0000"+ - "\u0000st\u0005I\u0000\u0000tu\u0005L\u0000\u0000uv\u0005E\u0000\u0000"+ - "v\u001a\u0001\u0000\u0000\u0000wx\u0005D\u0000\u0000xy\u0005O\u0000\u0000"+ - "y\u001c\u0001\u0000\u0000\u0000z{\u0005D\u0000\u0000{|\u0005O\u0000\u0000"+ - "|}\u0005N\u0000\u0000}~\u0005E\u0000\u0000~\u001e\u0001\u0000\u0000\u0000"+ - "\u007f\u0080\u0005R\u0000\u0000\u0080\u0081\u0005E\u0000\u0000\u0081\u0082"+ - "\u0005A\u0000\u0000\u0082\u0083\u0005D\u0000\u0000\u0083 \u0001\u0000"+ - "\u0000\u0000\u0084\u0085\u0005P\u0000\u0000\u0085\u0086\u0005R\u0000\u0000"+ - "\u0086\u0087\u0005I\u0000\u0000\u0087\u0088\u0005N\u0000\u0000\u0088\u0089"+ - "\u0005T\u0000\u0000\u0089\"\u0001\u0000\u0000\u0000\u008a\u008b\u0005"+ - "R\u0000\u0000\u008b\u008c\u0005E\u0000\u0000\u008c\u008d\u0005T\u0000"+ - "\u0000\u008d\u008e\u0005U\u0000\u0000\u008e\u008f\u0005R\u0000\u0000\u008f"+ - "\u0090\u0005N\u0000\u0000\u0090$\u0001\u0000\u0000\u0000\u0091\u0093\u0005"+ - "\"\u0000\u0000\u0092\u0094\u0003A \u0000\u0093\u0092\u0001\u0000\u0000"+ - "\u0000\u0094\u0095\u0001\u0000\u0000\u0000\u0095\u0093\u0001\u0000\u0000"+ - "\u0000\u0095\u0096\u0001\u0000\u0000\u0000\u0096\u0097\u0001\u0000\u0000"+ - "\u0000\u0097\u0098\u0005\"\u0000\u0000\u0098&\u0001\u0000\u0000\u0000"+ - "\u0099\u009b\u0003?\u001f\u0000\u009a\u0099\u0001\u0000\u0000\u0000\u009b"+ - "\u009c\u0001\u0000\u0000\u0000\u009c\u009a\u0001\u0000\u0000\u0000\u009c"+ - "\u009d\u0001\u0000\u0000\u0000\u009d(\u0001\u0000\u0000\u0000\u009e\u009f"+ - "\u0005(\u0000\u0000\u009f*\u0001\u0000\u0000\u0000\u00a0\u00a1\u0005)"+ - "\u0000\u0000\u00a1,\u0001\u0000\u0000\u0000\u00a2\u00a3\u0005+\u0000\u0000"+ - "\u00a3.\u0001\u0000\u0000\u0000\u00a4\u00a5\u0005-\u0000\u0000\u00a50"+ - "\u0001\u0000\u0000\u0000\u00a6\u00a7\u0005/\u0000\u0000\u00a72\u0001\u0000"+ - "\u0000\u0000\u00a8\u00a9\u0005*\u0000\u0000\u00a94\u0001\u0000\u0000\u0000"+ - "\u00aa\u00ab\u0005%\u0000\u0000\u00ab6\u0001\u0000\u0000\u0000\u00ac\u00b0"+ - "\u0007\u0000\u0000\u0000\u00ad\u00af\u0007\u0001\u0000\u0000\u00ae\u00ad"+ - "\u0001\u0000\u0000\u0000\u00af\u00b2\u0001\u0000\u0000\u0000\u00b0\u00ae"+ - "\u0001\u0000\u0000\u0000\u00b0\u00b1\u0001\u0000\u0000\u0000\u00b18\u0001"+ - "\u0000\u0000\u0000\u00b2\u00b0\u0001\u0000\u0000\u0000\u00b3\u00b4\u0007"+ - "\u0002\u0000\u0000\u00b4\u00b5\u0006\u001c\u0000\u0000\u00b5:\u0001\u0000"+ - "\u0000\u0000\u00b6\u00b7\u0005/\u0000\u0000\u00b7\u00b8\u0005/\u0000\u0000"+ - "\u00b8\u00bc\u0001\u0000\u0000\u0000\u00b9\u00bb\b\u0003\u0000\u0000\u00ba"+ - "\u00b9\u0001\u0000\u0000\u0000\u00bb\u00be\u0001\u0000\u0000\u0000\u00bc"+ - "\u00ba\u0001\u0000\u0000\u0000\u00bc\u00bd\u0001\u0000\u0000\u0000\u00bd"+ - "\u00bf\u0001\u0000\u0000\u0000\u00be\u00bc\u0001\u0000\u0000\u0000\u00bf"+ - "\u00c0\u0006\u001d\u0001\u0000\u00c0<\u0001\u0000\u0000\u0000\u00c1\u00c2"+ - "\u0002az\u0000\u00c2>\u0001\u0000\u0000\u0000\u00c3\u00c4\u000209\u0000"+ - "\u00c4@\u0001\u0000\u0000\u0000\u00c5\u00c6\b\u0004\u0000\u0000\u00c6"+ - "B\u0001\u0000\u0000\u0000\u0005\u0000\u0095\u009c\u00b0\u00bc\u0002\u0001"+ - "\u001c\u0000\u0001\u001d\u0001"; + "\u0002\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!"+ + "\u0007!\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001"+ + "\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001"+ + "\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001"+ + "\u0003\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0004\u0001"+ + "\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0007\u0001"+ + "\u0007\u0001\b\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001\n\u0001\n"+ + "\u0001\n\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b"+ + "\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001\r\u0001\r\u0001\r\u0001\r\u0001"+ + "\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f"+ + "\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0010"+ + "\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011"+ + "\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012"+ + "\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0013\u0001\u0013\u0004\u0013"+ + "\u0099\b\u0013\u000b\u0013\f\u0013\u009a\u0001\u0013\u0001\u0013\u0001"+ + "\u0014\u0004\u0014\u00a0\b\u0014\u000b\u0014\f\u0014\u00a1\u0001\u0015"+ + "\u0001\u0015\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017\u0001\u0018"+ + "\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u001a\u0001\u001a\u0001\u001b"+ + "\u0001\u001b\u0001\u001c\u0001\u001c\u0005\u001c\u00b4\b\u001c\n\u001c"+ + "\f\u001c\u00b7\t\u001c\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001e"+ + "\u0001\u001e\u0001\u001e\u0001\u001e\u0005\u001e\u00c0\b\u001e\n\u001e"+ + "\f\u001e\u00c3\t\u001e\u0001\u001e\u0001\u001e\u0001\u001f\u0001\u001f"+ + "\u0001 \u0001 \u0001!\u0001!\u0000\u0000\"\u0001\u0001\u0003\u0002\u0005"+ + "\u0003\u0007\u0004\t\u0005\u000b\u0006\r\u0007\u000f\b\u0011\t\u0013\n"+ + "\u0015\u000b\u0017\f\u0019\r\u001b\u000e\u001d\u000f\u001f\u0010!\u0011"+ + "#\u0012%\u0013\'\u0014)\u0015+\u0016-\u0017/\u00181\u00193\u001a5\u001b"+ + "7\u001c9\u001d;\u001e=\u001f?\u0000A\u0000C\u0000\u0001\u0000\u0005\u0002"+ + "\u0000AZaz\u0005\u0000--09AZ__az\u0002\u0000\t\n \u0001\u0000\n\n\u0002"+ + "\u0000\n\n\"\"\u00cc\u0000\u0001\u0001\u0000\u0000\u0000\u0000\u0003\u0001"+ + "\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000\u0000\u0000\u0007\u0001"+ + "\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000\u0000\u000b\u0001\u0000"+ + "\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000\u000f\u0001\u0000\u0000"+ + "\u0000\u0000\u0011\u0001\u0000\u0000\u0000\u0000\u0013\u0001\u0000\u0000"+ + "\u0000\u0000\u0015\u0001\u0000\u0000\u0000\u0000\u0017\u0001\u0000\u0000"+ + "\u0000\u0000\u0019\u0001\u0000\u0000\u0000\u0000\u001b\u0001\u0000\u0000"+ + "\u0000\u0000\u001d\u0001\u0000\u0000\u0000\u0000\u001f\u0001\u0000\u0000"+ + "\u0000\u0000!\u0001\u0000\u0000\u0000\u0000#\u0001\u0000\u0000\u0000\u0000"+ + "%\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000\u0000\u0000\u0000)\u0001"+ + "\u0000\u0000\u0000\u0000+\u0001\u0000\u0000\u0000\u0000-\u0001\u0000\u0000"+ + "\u0000\u0000/\u0001\u0000\u0000\u0000\u00001\u0001\u0000\u0000\u0000\u0000"+ + "3\u0001\u0000\u0000\u0000\u00005\u0001\u0000\u0000\u0000\u00007\u0001"+ + "\u0000\u0000\u0000\u00009\u0001\u0000\u0000\u0000\u0000;\u0001\u0000\u0000"+ + "\u0000\u0000=\u0001\u0000\u0000\u0000\u0001E\u0001\u0000\u0000\u0000\u0003"+ + "J\u0001\u0000\u0000\u0000\u0005P\u0001\u0000\u0000\u0000\u0007T\u0001"+ + "\u0000\u0000\u0000\tY\u0001\u0000\u0000\u0000\u000b\\\u0001\u0000\u0000"+ + "\u0000\r^\u0001\u0000\u0000\u0000\u000fa\u0001\u0000\u0000\u0000\u0011"+ + "c\u0001\u0000\u0000\u0000\u0013f\u0001\u0000\u0000\u0000\u0015i\u0001"+ + "\u0000\u0000\u0000\u0017n\u0001\u0000\u0000\u0000\u0019s\u0001\u0000\u0000"+ + "\u0000\u001bv\u0001\u0000\u0000\u0000\u001d|\u0001\u0000\u0000\u0000\u001f"+ + "\u007f\u0001\u0000\u0000\u0000!\u0084\u0001\u0000\u0000\u0000#\u0089\u0001"+ + "\u0000\u0000\u0000%\u008f\u0001\u0000\u0000\u0000\'\u0096\u0001\u0000"+ + "\u0000\u0000)\u009f\u0001\u0000\u0000\u0000+\u00a3\u0001\u0000\u0000\u0000"+ + "-\u00a5\u0001\u0000\u0000\u0000/\u00a7\u0001\u0000\u0000\u00001\u00a9"+ + "\u0001\u0000\u0000\u00003\u00ab\u0001\u0000\u0000\u00005\u00ad\u0001\u0000"+ + "\u0000\u00007\u00af\u0001\u0000\u0000\u00009\u00b1\u0001\u0000\u0000\u0000"+ + ";\u00b8\u0001\u0000\u0000\u0000=\u00bb\u0001\u0000\u0000\u0000?\u00c6"+ + "\u0001\u0000\u0000\u0000A\u00c8\u0001\u0000\u0000\u0000C\u00ca\u0001\u0000"+ + "\u0000\u0000EF\u0005F\u0000\u0000FG\u0005U\u0000\u0000GH\u0005N\u0000"+ + "\u0000HI\u0005C\u0000\u0000I\u0002\u0001\u0000\u0000\u0000JK\u0005P\u0000"+ + "\u0000KL\u0005R\u0000\u0000LM\u0005O\u0000\u0000MN\u0005T\u0000\u0000"+ + "NO\u0005O\u0000\u0000O\u0004\u0001\u0000\u0000\u0000PQ\u0005I\u0000\u0000"+ + "QR\u0005N\u0000\u0000RS\u0005T\u0000\u0000S\u0006\u0001\u0000\u0000\u0000"+ + "TU\u0005V\u0000\u0000UV\u0005O\u0000\u0000VW\u0005I\u0000\u0000WX\u0005"+ + "D\u0000\u0000X\b\u0001\u0000\u0000\u0000YZ\u0005<\u0000\u0000Z[\u0005"+ + "=\u0000\u0000[\n\u0001\u0000\u0000\u0000\\]\u0005<\u0000\u0000]\f\u0001"+ + "\u0000\u0000\u0000^_\u0005>\u0000\u0000_`\u0005=\u0000\u0000`\u000e\u0001"+ + "\u0000\u0000\u0000ab\u0005>\u0000\u0000b\u0010\u0001\u0000\u0000\u0000"+ + "cd\u0005:\u0000\u0000de\u0005=\u0000\u0000e\u0012\u0001\u0000\u0000\u0000"+ + "fg\u0005I\u0000\u0000gh\u0005F\u0000\u0000h\u0014\u0001\u0000\u0000\u0000"+ + "ij\u0005T\u0000\u0000jk\u0005H\u0000\u0000kl\u0005E\u0000\u0000lm\u0005"+ + "N\u0000\u0000m\u0016\u0001\u0000\u0000\u0000no\u0005E\u0000\u0000op\u0005"+ + "L\u0000\u0000pq\u0005S\u0000\u0000qr\u0005E\u0000\u0000r\u0018\u0001\u0000"+ + "\u0000\u0000st\u0005F\u0000\u0000tu\u0005I\u0000\u0000u\u001a\u0001\u0000"+ + "\u0000\u0000vw\u0005W\u0000\u0000wx\u0005H\u0000\u0000xy\u0005I\u0000"+ + "\u0000yz\u0005L\u0000\u0000z{\u0005E\u0000\u0000{\u001c\u0001\u0000\u0000"+ + "\u0000|}\u0005D\u0000\u0000}~\u0005O\u0000\u0000~\u001e\u0001\u0000\u0000"+ + "\u0000\u007f\u0080\u0005D\u0000\u0000\u0080\u0081\u0005O\u0000\u0000\u0081"+ + "\u0082\u0005N\u0000\u0000\u0082\u0083\u0005E\u0000\u0000\u0083 \u0001"+ + "\u0000\u0000\u0000\u0084\u0085\u0005R\u0000\u0000\u0085\u0086\u0005E\u0000"+ + "\u0000\u0086\u0087\u0005A\u0000\u0000\u0087\u0088\u0005D\u0000\u0000\u0088"+ + "\"\u0001\u0000\u0000\u0000\u0089\u008a\u0005P\u0000\u0000\u008a\u008b"+ + "\u0005R\u0000\u0000\u008b\u008c\u0005I\u0000\u0000\u008c\u008d\u0005N"+ + "\u0000\u0000\u008d\u008e\u0005T\u0000\u0000\u008e$\u0001\u0000\u0000\u0000"+ + "\u008f\u0090\u0005R\u0000\u0000\u0090\u0091\u0005E\u0000\u0000\u0091\u0092"+ + "\u0005T\u0000\u0000\u0092\u0093\u0005U\u0000\u0000\u0093\u0094\u0005R"+ + "\u0000\u0000\u0094\u0095\u0005N\u0000\u0000\u0095&\u0001\u0000\u0000\u0000"+ + "\u0096\u0098\u0005\"\u0000\u0000\u0097\u0099\u0003C!\u0000\u0098\u0097"+ + "\u0001\u0000\u0000\u0000\u0099\u009a\u0001\u0000\u0000\u0000\u009a\u0098"+ + "\u0001\u0000\u0000\u0000\u009a\u009b\u0001\u0000\u0000\u0000\u009b\u009c"+ + "\u0001\u0000\u0000\u0000\u009c\u009d\u0005\"\u0000\u0000\u009d(\u0001"+ + "\u0000\u0000\u0000\u009e\u00a0\u0003A \u0000\u009f\u009e\u0001\u0000\u0000"+ + "\u0000\u00a0\u00a1\u0001\u0000\u0000\u0000\u00a1\u009f\u0001\u0000\u0000"+ + "\u0000\u00a1\u00a2\u0001\u0000\u0000\u0000\u00a2*\u0001\u0000\u0000\u0000"+ + "\u00a3\u00a4\u0005(\u0000\u0000\u00a4,\u0001\u0000\u0000\u0000\u00a5\u00a6"+ + "\u0005)\u0000\u0000\u00a6.\u0001\u0000\u0000\u0000\u00a7\u00a8\u0005+"+ + "\u0000\u0000\u00a80\u0001\u0000\u0000\u0000\u00a9\u00aa\u0005-\u0000\u0000"+ + "\u00aa2\u0001\u0000\u0000\u0000\u00ab\u00ac\u0005/\u0000\u0000\u00ac4"+ + "\u0001\u0000\u0000\u0000\u00ad\u00ae\u0005*\u0000\u0000\u00ae6\u0001\u0000"+ + "\u0000\u0000\u00af\u00b0\u0005%\u0000\u0000\u00b08\u0001\u0000\u0000\u0000"+ + "\u00b1\u00b5\u0007\u0000\u0000\u0000\u00b2\u00b4\u0007\u0001\u0000\u0000"+ + "\u00b3\u00b2\u0001\u0000\u0000\u0000\u00b4\u00b7\u0001\u0000\u0000\u0000"+ + "\u00b5\u00b3\u0001\u0000\u0000\u0000\u00b5\u00b6\u0001\u0000\u0000\u0000"+ + "\u00b6:\u0001\u0000\u0000\u0000\u00b7\u00b5\u0001\u0000\u0000\u0000\u00b8"+ + "\u00b9\u0007\u0002\u0000\u0000\u00b9\u00ba\u0006\u001d\u0000\u0000\u00ba"+ + "<\u0001\u0000\u0000\u0000\u00bb\u00bc\u0005/\u0000\u0000\u00bc\u00bd\u0005"+ + "/\u0000\u0000\u00bd\u00c1\u0001\u0000\u0000\u0000\u00be\u00c0\b\u0003"+ + "\u0000\u0000\u00bf\u00be\u0001\u0000\u0000\u0000\u00c0\u00c3\u0001\u0000"+ + "\u0000\u0000\u00c1\u00bf\u0001\u0000\u0000\u0000\u00c1\u00c2\u0001\u0000"+ + "\u0000\u0000\u00c2\u00c4\u0001\u0000\u0000\u0000\u00c3\u00c1\u0001\u0000"+ + "\u0000\u0000\u00c4\u00c5\u0006\u001e\u0001\u0000\u00c5>\u0001\u0000\u0000"+ + "\u0000\u00c6\u00c7\u0002az\u0000\u00c7@\u0001\u0000\u0000\u0000\u00c8"+ + "\u00c9\u000209\u0000\u00c9B\u0001\u0000\u0000\u0000\u00ca\u00cb\b\u0004"+ + "\u0000\u0000\u00cbD\u0001\u0000\u0000\u0000\u0005\u0000\u009a\u00a1\u00b5"+ + "\u00c1\u0002\u0001\u001d\u0000\u0001\u001e\u0001"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/src/main/antlr/.antlr/VSLLexer.tokens b/src/main/antlr/.antlr/VSLLexer.tokens index 14ac99b..69a58ba 100644 --- a/src/main/antlr/.antlr/VSLLexer.tokens +++ b/src/main/antlr/.antlr/VSLLexer.tokens @@ -6,28 +6,29 @@ LE=5 LT=6 GE=7 GT=8 -IF=9 -THEN=10 -ELSE=11 -FIN=12 -WHILE=13 -DO=14 -DONE=15 -READ=16 -PRINT=17 -RETURN=18 -TEXT=19 -NUMBER=20 -ParO=21 -ParF=22 -PLUS=23 -MINUS=24 -DIV=25 -TIMES=26 -MOD=27 -IDENT=28 -WS=29 -COMMENT=30 +ASSIGN=9 +IF=10 +THEN=11 +ELSE=12 +FIN=13 +WHILE=14 +DO=15 +DONE=16 +READ=17 +PRINT=18 +RETURN=19 +TEXT=20 +NUMBER=21 +ParO=22 +ParF=23 +PLUS=24 +MINUS=25 +DIV=26 +TIMES=27 +MOD=28 +IDENT=29 +WS=30 +COMMENT=31 'FUNC'=1 'PROTO'=2 'INT'=3 @@ -36,20 +37,21 @@ COMMENT=30 '<'=6 '>='=7 '>'=8 -'IF'=9 -'THEN'=10 -'ELSE'=11 -'FI'=12 -'WHILE'=13 -'DO'=14 -'DONE'=15 -'READ'=16 -'PRINT'=17 -'RETURN'=18 -'('=21 -')'=22 -'+'=23 -'-'=24 -'/'=25 -'*'=26 -'%'=27 +':='=9 +'IF'=10 +'THEN'=11 +'ELSE'=12 +'FI'=13 +'WHILE'=14 +'DO'=15 +'DONE'=16 +'READ'=17 +'PRINT'=18 +'RETURN'=19 +'('=22 +')'=23 +'+'=24 +'-'=25 +'/'=26 +'*'=27 +'%'=28 diff --git a/src/main/antlr/.antlr/VSLParser.interp b/src/main/antlr/.antlr/VSLParser.interp index c406e4e..06d088f 100644 --- a/src/main/antlr/.antlr/VSLParser.interp +++ b/src/main/antlr/.antlr/VSLParser.interp @@ -8,6 +8,7 @@ null '<' '>=' '>' +':=' 'IF' 'THEN' 'ELSE' @@ -41,6 +42,7 @@ LE LT GE GT +ASSIGN IF THEN ELSE @@ -78,4 +80,4 @@ type atn: -[4, 1, 30, 80, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 4, 3, 38, 8, 3, 11, 3, 12, 3, 39, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 52, 8, 5, 10, 5, 12, 5, 55, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 63, 8, 6, 10, 6, 12, 6, 66, 9, 6, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 78, 8, 9, 1, 9, 0, 0, 10, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 2, 1, 0, 23, 24, 1, 0, 25, 26, 73, 0, 20, 1, 0, 0, 0, 2, 24, 1, 0, 0, 0, 4, 32, 1, 0, 0, 0, 6, 37, 1, 0, 0, 0, 8, 41, 1, 0, 0, 0, 10, 45, 1, 0, 0, 0, 12, 56, 1, 0, 0, 0, 14, 67, 1, 0, 0, 0, 16, 70, 1, 0, 0, 0, 18, 77, 1, 0, 0, 0, 20, 21, 3, 2, 1, 0, 21, 22, 5, 0, 0, 1, 22, 23, 6, 0, -1, 0, 23, 1, 1, 0, 0, 0, 24, 25, 5, 1, 0, 0, 25, 26, 3, 18, 9, 0, 26, 27, 3, 16, 8, 0, 27, 28, 5, 21, 0, 0, 28, 29, 5, 22, 0, 0, 29, 30, 3, 6, 3, 0, 30, 31, 6, 1, -1, 0, 31, 3, 1, 0, 0, 0, 32, 33, 1, 0, 0, 0, 33, 5, 1, 0, 0, 0, 34, 35, 3, 8, 4, 0, 35, 36, 6, 3, -1, 0, 36, 38, 1, 0, 0, 0, 37, 34, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 7, 1, 0, 0, 0, 41, 42, 5, 18, 0, 0, 42, 43, 3, 10, 5, 0, 43, 44, 6, 4, -1, 0, 44, 9, 1, 0, 0, 0, 45, 46, 3, 12, 6, 0, 46, 53, 6, 5, -1, 0, 47, 48, 7, 0, 0, 0, 48, 49, 3, 12, 6, 0, 49, 50, 6, 5, -1, 0, 50, 52, 1, 0, 0, 0, 51, 47, 1, 0, 0, 0, 52, 55, 1, 0, 0, 0, 53, 51, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 11, 1, 0, 0, 0, 55, 53, 1, 0, 0, 0, 56, 57, 3, 14, 7, 0, 57, 64, 6, 6, -1, 0, 58, 59, 7, 1, 0, 0, 59, 60, 3, 14, 7, 0, 60, 61, 6, 6, -1, 0, 61, 63, 1, 0, 0, 0, 62, 58, 1, 0, 0, 0, 63, 66, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 13, 1, 0, 0, 0, 66, 64, 1, 0, 0, 0, 67, 68, 5, 20, 0, 0, 68, 69, 6, 7, -1, 0, 69, 15, 1, 0, 0, 0, 70, 71, 5, 28, 0, 0, 71, 72, 6, 8, -1, 0, 72, 17, 1, 0, 0, 0, 73, 74, 5, 3, 0, 0, 74, 78, 6, 9, -1, 0, 75, 76, 5, 4, 0, 0, 76, 78, 6, 9, -1, 0, 77, 73, 1, 0, 0, 0, 77, 75, 1, 0, 0, 0, 78, 19, 1, 0, 0, 0, 4, 39, 53, 64, 77] \ No newline at end of file +[4, 1, 31, 91, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 33, 8, 1, 10, 1, 12, 1, 36, 9, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 4, 3, 43, 8, 3, 11, 3, 12, 3, 44, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 57, 8, 5, 10, 5, 12, 5, 60, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 68, 8, 6, 10, 6, 12, 6, 71, 9, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 80, 8, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 89, 8, 9, 1, 9, 0, 0, 10, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 2, 1, 0, 24, 25, 1, 0, 26, 28, 86, 0, 20, 1, 0, 0, 0, 2, 34, 1, 0, 0, 0, 4, 37, 1, 0, 0, 0, 6, 42, 1, 0, 0, 0, 8, 46, 1, 0, 0, 0, 10, 50, 1, 0, 0, 0, 12, 61, 1, 0, 0, 0, 14, 79, 1, 0, 0, 0, 16, 81, 1, 0, 0, 0, 18, 88, 1, 0, 0, 0, 20, 21, 3, 2, 1, 0, 21, 22, 5, 0, 0, 1, 22, 23, 6, 0, -1, 0, 23, 1, 1, 0, 0, 0, 24, 25, 5, 1, 0, 0, 25, 26, 3, 18, 9, 0, 26, 27, 3, 16, 8, 0, 27, 28, 5, 22, 0, 0, 28, 29, 5, 23, 0, 0, 29, 30, 3, 6, 3, 0, 30, 31, 6, 1, -1, 0, 31, 33, 1, 0, 0, 0, 32, 24, 1, 0, 0, 0, 33, 36, 1, 0, 0, 0, 34, 32, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 3, 1, 0, 0, 0, 36, 34, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 5, 1, 0, 0, 0, 39, 40, 3, 8, 4, 0, 40, 41, 6, 3, -1, 0, 41, 43, 1, 0, 0, 0, 42, 39, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 44, 45, 1, 0, 0, 0, 45, 7, 1, 0, 0, 0, 46, 47, 5, 19, 0, 0, 47, 48, 3, 10, 5, 0, 48, 49, 6, 4, -1, 0, 49, 9, 1, 0, 0, 0, 50, 51, 3, 12, 6, 0, 51, 58, 6, 5, -1, 0, 52, 53, 7, 0, 0, 0, 53, 54, 3, 12, 6, 0, 54, 55, 6, 5, -1, 0, 55, 57, 1, 0, 0, 0, 56, 52, 1, 0, 0, 0, 57, 60, 1, 0, 0, 0, 58, 56, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 11, 1, 0, 0, 0, 60, 58, 1, 0, 0, 0, 61, 62, 3, 14, 7, 0, 62, 69, 6, 6, -1, 0, 63, 64, 7, 1, 0, 0, 64, 65, 3, 14, 7, 0, 65, 66, 6, 6, -1, 0, 66, 68, 1, 0, 0, 0, 67, 63, 1, 0, 0, 0, 68, 71, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 13, 1, 0, 0, 0, 71, 69, 1, 0, 0, 0, 72, 73, 5, 21, 0, 0, 73, 80, 6, 7, -1, 0, 74, 75, 5, 22, 0, 0, 75, 76, 3, 10, 5, 0, 76, 77, 5, 23, 0, 0, 77, 78, 6, 7, -1, 0, 78, 80, 1, 0, 0, 0, 79, 72, 1, 0, 0, 0, 79, 74, 1, 0, 0, 0, 80, 15, 1, 0, 0, 0, 81, 82, 5, 29, 0, 0, 82, 83, 6, 8, -1, 0, 83, 17, 1, 0, 0, 0, 84, 85, 5, 3, 0, 0, 85, 89, 6, 9, -1, 0, 86, 87, 5, 4, 0, 0, 87, 89, 6, 9, -1, 0, 88, 84, 1, 0, 0, 0, 88, 86, 1, 0, 0, 0, 89, 19, 1, 0, 0, 0, 6, 34, 44, 58, 69, 79, 88] \ No newline at end of file diff --git a/src/main/antlr/.antlr/VSLParser.java b/src/main/antlr/.antlr/VSLParser.java index 2217beb..fbbe861 100644 --- a/src/main/antlr/.antlr/VSLParser.java +++ b/src/main/antlr/.antlr/VSLParser.java @@ -24,9 +24,9 @@ public class VSLParser extends Parser { new PredictionContextCache(); public static final int FUNCTION=1, PROTOTYPE=2, TYPE_INT=3, TYPE_VOID=4, LE=5, LT=6, GE=7, GT=8, - IF=9, THEN=10, ELSE=11, FIN=12, WHILE=13, DO=14, DONE=15, READ=16, PRINT=17, - RETURN=18, TEXT=19, NUMBER=20, ParO=21, ParF=22, PLUS=23, MINUS=24, DIV=25, - TIMES=26, MOD=27, IDENT=28, WS=29, COMMENT=30; + ASSIGN=9, IF=10, THEN=11, ELSE=12, FIN=13, WHILE=14, DO=15, DONE=16, READ=17, + PRINT=18, RETURN=19, TEXT=20, NUMBER=21, ParO=22, ParF=23, PLUS=24, MINUS=25, + DIV=26, TIMES=27, MOD=28, IDENT=29, WS=30, COMMENT=31; public static final int RULE_program = 0, RULE_function = 1, RULE_prototype = 2, RULE_list_instr = 3, RULE_instruction = 4, RULE_expression = 5, RULE_td_expression = 6, RULE_lit = 7, @@ -42,18 +42,18 @@ public class VSLParser extends Parser { private static String[] makeLiteralNames() { return new String[] { null, "'FUNC'", "'PROTO'", "'INT'", "'VOID'", "'<='", "'<'", "'>='", - "'>'", "'IF'", "'THEN'", "'ELSE'", "'FI'", "'WHILE'", "'DO'", "'DONE'", - "'READ'", "'PRINT'", "'RETURN'", null, null, "'('", "')'", "'+'", "'-'", - "'/'", "'*'", "'%'" + "'>'", "':='", "'IF'", "'THEN'", "'ELSE'", "'FI'", "'WHILE'", "'DO'", + "'DONE'", "'READ'", "'PRINT'", "'RETURN'", null, null, "'('", "')'", + "'+'", "'-'", "'/'", "'*'", "'%'" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { null, "FUNCTION", "PROTOTYPE", "TYPE_INT", "TYPE_VOID", "LE", "LT", "GE", - "GT", "IF", "THEN", "ELSE", "FIN", "WHILE", "DO", "DONE", "READ", "PRINT", - "RETURN", "TEXT", "NUMBER", "ParO", "ParF", "PLUS", "MINUS", "DIV", "TIMES", - "MOD", "IDENT", "WS", "COMMENT" + "GT", "ASSIGN", "IF", "THEN", "ELSE", "FIN", "WHILE", "DO", "DONE", "READ", + "PRINT", "RETURN", "TEXT", "NUMBER", "ParO", "ParF", "PLUS", "MINUS", + "DIV", "TIMES", "MOD", "IDENT", "WS", "COMMENT" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); @@ -151,17 +151,35 @@ public class VSLParser extends Parser { public TypeContext t; public IdentContext i; public List_instrContext instrs; - public TerminalNode FUNCTION() { return getToken(VSLParser.FUNCTION, 0); } - public TerminalNode ParO() { return getToken(VSLParser.ParO, 0); } - public TerminalNode ParF() { return getToken(VSLParser.ParF, 0); } - public TypeContext type() { - return getRuleContext(TypeContext.class,0); + public List FUNCTION() { return getTokens(VSLParser.FUNCTION); } + public TerminalNode FUNCTION(int i) { + return getToken(VSLParser.FUNCTION, i); } - public IdentContext ident() { - return getRuleContext(IdentContext.class,0); + public List ParO() { return getTokens(VSLParser.ParO); } + public TerminalNode ParO(int i) { + return getToken(VSLParser.ParO, i); } - public List_instrContext list_instr() { - return getRuleContext(List_instrContext.class,0); + public List ParF() { return getTokens(VSLParser.ParF); } + public TerminalNode ParF(int i) { + return getToken(VSLParser.ParF, i); + } + public List type() { + return getRuleContexts(TypeContext.class); + } + public TypeContext type(int i) { + return getRuleContext(TypeContext.class,i); + } + public List ident() { + return getRuleContexts(IdentContext.class); + } + public IdentContext ident(int i) { + return getRuleContext(IdentContext.class,i); + } + public List list_instr() { + return getRuleContexts(List_instrContext.class); + } + public List_instrContext list_instr(int i) { + return getRuleContext(List_instrContext.class,i); } public FunctionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); @@ -176,24 +194,37 @@ public class VSLParser extends Parser { SymTable sym_table = new SymTable(); ((FunctionContext)_localctx).out = new ArrayList(); + int _la; try { enterOuterAlt(_localctx, 1); { - setState(24); - match(FUNCTION); - setState(25); - ((FunctionContext)_localctx).t = type(); - setState(26); - ((FunctionContext)_localctx).i = ident(); - setState(27); - match(ParO); - setState(28); - match(ParF); - setState(29); - ((FunctionContext)_localctx).instrs = list_instr(sym_table); + setState(34); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==FUNCTION) { + { + { + setState(24); + match(FUNCTION); + setState(25); + ((FunctionContext)_localctx).t = type(); + setState(26); + ((FunctionContext)_localctx).i = ident(); + setState(27); + match(ParO); + setState(28); + match(ParF); + setState(29); + ((FunctionContext)_localctx).instrs = list_instr(sym_table); - _localctx.out.add(new FunctionImp(((FunctionContext)_localctx).t.return_type, ((FunctionContext)_localctx).i.out, ((FunctionContext)_localctx).instrs.out)); - + _localctx.out.add(new FunctionImp(((FunctionContext)_localctx).t.return_type, ((FunctionContext)_localctx).i.out, ((FunctionContext)_localctx).instrs.out)); + + } + } + setState(36); + _errHandler.sync(this); + _la = _input.LA(1); + } } } catch (RecognitionException re) { @@ -264,20 +295,20 @@ public class VSLParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(37); + setState(42); _errHandler.sync(this); _la = _input.LA(1); do { { { - setState(34); + setState(39); ((List_instrContext)_localctx).instruction = instruction(table); _localctx.out.add(((List_instrContext)_localctx).instruction.out); } } - setState(39); + setState(44); _errHandler.sync(this); _la = _input.LA(1); } while ( _la==RETURN ); @@ -317,9 +348,9 @@ public class VSLParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(41); + setState(46); match(RETURN); - setState(42); + setState(47); ((InstructionContext)_localctx).e = expression(table); ((InstructionContext)_localctx).out = new Return_instrImp(((InstructionContext)_localctx).e.out); @@ -373,19 +404,19 @@ public class VSLParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(45); + setState(50); ((ExpressionContext)_localctx).left = td_expression(table); ((ExpressionContext)_localctx).out = ((ExpressionContext)_localctx).left.out; ((ExpressionContext)_localctx).return_Type = ((ExpressionContext)_localctx).left.return_Type; - setState(53); + setState(58); _errHandler.sync(this); _la = _input.LA(1); while (_la==PLUS || _la==MINUS) { { { - setState(47); + setState(52); ((ExpressionContext)_localctx).op = _input.LT(1); _la = _input.LA(1); if ( !(_la==PLUS || _la==MINUS) ) { @@ -396,7 +427,7 @@ public class VSLParser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(48); + setState(53); ((ExpressionContext)_localctx).right = td_expression(table); ((ExpressionContext)_localctx).out = new BinopExpressionImp( @@ -405,14 +436,14 @@ public class VSLParser extends Parser { case MINUS -> Op.MINUS; default -> throw new IllegalArgumentException("Unknown operator"); }, - ((ExpressionContext)_localctx).left.out, + _localctx.out, ((ExpressionContext)_localctx).right.out ); - ((ExpressionContext)_localctx).return_Type = ((ExpressionContext)_localctx).right.return_Type; + ((ExpressionContext)_localctx).return_Type = ((ExpressionContext)_localctx).left.return_Type; } } - setState(55); + setState(60); _errHandler.sync(this); _la = _input.LA(1); } @@ -451,6 +482,10 @@ public class VSLParser extends Parser { public TerminalNode DIV(int i) { return getToken(VSLParser.DIV, i); } + public List MOD() { return getTokens(VSLParser.MOD); } + public TerminalNode MOD(int i) { + return getToken(VSLParser.MOD, i); + } public Td_expressionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } public Td_expressionContext(ParserRuleContext parent, int invokingState, SymTable table) { super(parent, invokingState); @@ -466,22 +501,22 @@ public class VSLParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(56); - ((Td_expressionContext)_localctx).left = lit(); + setState(61); + ((Td_expressionContext)_localctx).left = lit(table); ((Td_expressionContext)_localctx).out = ((Td_expressionContext)_localctx).left.out; ((Td_expressionContext)_localctx).return_Type = ((Td_expressionContext)_localctx).left.return_Type; - setState(64); + setState(69); _errHandler.sync(this); _la = _input.LA(1); - while (_la==DIV || _la==TIMES) { + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 469762048L) != 0)) { { { - setState(58); + setState(63); ((Td_expressionContext)_localctx).op = _input.LT(1); _la = _input.LA(1); - if ( !(_la==DIV || _la==TIMES) ) { + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 469762048L) != 0)) ) { ((Td_expressionContext)_localctx).op = (Token)_errHandler.recoverInline(this); } else { @@ -489,8 +524,8 @@ public class VSLParser extends Parser { _errHandler.reportMatch(this); consume(); } - setState(59); - ((Td_expressionContext)_localctx).right = lit(); + setState(64); + ((Td_expressionContext)_localctx).right = lit(table); ((Td_expressionContext)_localctx).out = new Program.BinopExpressionImp( switch(((Td_expressionContext)_localctx).op.getType()) { @@ -499,14 +534,14 @@ public class VSLParser extends Parser { case MOD -> Op.MOD; default -> throw new IllegalArgumentException("Unknown operator"); }, - ((Td_expressionContext)_localctx).left.out, + _localctx.out, ((Td_expressionContext)_localctx).right.out ); - ((Td_expressionContext)_localctx).return_Type = ((Td_expressionContext)_localctx).right.return_Type; + ((Td_expressionContext)_localctx).return_Type = ((Td_expressionContext)_localctx).left.return_Type; } } - setState(66); + setState(71); _errHandler.sync(this); _la = _input.LA(1); } @@ -525,28 +560,60 @@ public class VSLParser extends Parser { @SuppressWarnings("CheckReturnValue") public static class LitContext extends ParserRuleContext { + public SymTable table; public Expression out; public Type return_Type; public Token NUMBER; + public ExpressionContext e; public TerminalNode NUMBER() { return getToken(VSLParser.NUMBER, 0); } - public LitContext(ParserRuleContext parent, int invokingState) { + public TerminalNode ParO() { return getToken(VSLParser.ParO, 0); } + public TerminalNode ParF() { return getToken(VSLParser.ParF, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public LitContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } + public LitContext(ParserRuleContext parent, int invokingState, SymTable table) { super(parent, invokingState); + this.table = table; } @Override public int getRuleIndex() { return RULE_lit; } } - public final LitContext lit() throws RecognitionException { - LitContext _localctx = new LitContext(_ctx, getState()); + public final LitContext lit(SymTable table) throws RecognitionException { + LitContext _localctx = new LitContext(_ctx, getState(), table); enterRule(_localctx, 14, RULE_lit); try { - enterOuterAlt(_localctx, 1); - { - setState(67); - ((LitContext)_localctx).NUMBER = match(NUMBER); + setState(79); + _errHandler.sync(this); + switch (_input.LA(1)) { + case NUMBER: + enterOuterAlt(_localctx, 1); + { + setState(72); + ((LitContext)_localctx).NUMBER = match(NUMBER); - ((LitContext)_localctx).return_Type = new Type_intImp(); - ((LitContext)_localctx).out = new ConstImp((((LitContext)_localctx).NUMBER!=null?Integer.valueOf(((LitContext)_localctx).NUMBER.getText()):0)); - + ((LitContext)_localctx).return_Type = new Type_intImp(); + ((LitContext)_localctx).out = new ConstImp((((LitContext)_localctx).NUMBER!=null?Integer.valueOf(((LitContext)_localctx).NUMBER.getText()):0)); + + } + break; + case ParO: + enterOuterAlt(_localctx, 2); + { + setState(74); + match(ParO); + setState(75); + ((LitContext)_localctx).e = expression(table); + setState(76); + match(ParF); + + ((LitContext)_localctx).out = ((LitContext)_localctx).e.out; + ((LitContext)_localctx).return_Type = ((LitContext)_localctx).e.return_Type; + + } + break; + default: + throw new NoViableAltException(this); } } catch (RecognitionException re) { @@ -577,7 +644,7 @@ public class VSLParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(70); + setState(81); ((IdentContext)_localctx).IDENT = match(IDENT); ((IdentContext)_localctx).out = ((IdentContext)_localctx).IDENT.getText(); } @@ -608,13 +675,13 @@ public class VSLParser extends Parser { TypeContext _localctx = new TypeContext(_ctx, getState()); enterRule(_localctx, 18, RULE_type); try { - setState(77); + setState(88); _errHandler.sync(this); switch (_input.LA(1)) { case TYPE_INT: enterOuterAlt(_localctx, 1); { - setState(73); + setState(84); match(TYPE_INT); ((TypeContext)_localctx).return_type = new Type_intImp(); } @@ -622,7 +689,7 @@ public class VSLParser extends Parser { case TYPE_VOID: enterOuterAlt(_localctx, 2); { - setState(75); + setState(86); match(TYPE_VOID); ((TypeContext)_localctx).return_type = new Type_voidImp(); } @@ -643,50 +710,57 @@ public class VSLParser extends Parser { } public static final String _serializedATN = - "\u0004\u0001\u001eP\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+ + "\u0004\u0001\u001f[\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+ "\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002"+ "\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0002"+ "\b\u0007\b\u0002\t\u0007\t\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000"+ "\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001"+ - "\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003"+ - "\u0001\u0003\u0004\u0003&\b\u0003\u000b\u0003\f\u0003\'\u0001\u0004\u0001"+ - "\u0004\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005\u0001\u0005\u0001"+ - "\u0005\u0001\u0005\u0001\u0005\u0005\u00054\b\u0005\n\u0005\f\u00057\t"+ - "\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001"+ - "\u0006\u0005\u0006?\b\u0006\n\u0006\f\u0006B\t\u0006\u0001\u0007\u0001"+ - "\u0007\u0001\u0007\u0001\b\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001"+ - "\t\u0003\tN\b\t\u0001\t\u0000\u0000\n\u0000\u0002\u0004\u0006\b\n\f\u000e"+ - "\u0010\u0012\u0000\u0002\u0001\u0000\u0017\u0018\u0001\u0000\u0019\u001a"+ - "I\u0000\u0014\u0001\u0000\u0000\u0000\u0002\u0018\u0001\u0000\u0000\u0000"+ - "\u0004 \u0001\u0000\u0000\u0000\u0006%\u0001\u0000\u0000\u0000\b)\u0001"+ - "\u0000\u0000\u0000\n-\u0001\u0000\u0000\u0000\f8\u0001\u0000\u0000\u0000"+ - "\u000eC\u0001\u0000\u0000\u0000\u0010F\u0001\u0000\u0000\u0000\u0012M"+ - "\u0001\u0000\u0000\u0000\u0014\u0015\u0003\u0002\u0001\u0000\u0015\u0016"+ - "\u0005\u0000\u0000\u0001\u0016\u0017\u0006\u0000\uffff\uffff\u0000\u0017"+ - "\u0001\u0001\u0000\u0000\u0000\u0018\u0019\u0005\u0001\u0000\u0000\u0019"+ - "\u001a\u0003\u0012\t\u0000\u001a\u001b\u0003\u0010\b\u0000\u001b\u001c"+ - "\u0005\u0015\u0000\u0000\u001c\u001d\u0005\u0016\u0000\u0000\u001d\u001e"+ - "\u0003\u0006\u0003\u0000\u001e\u001f\u0006\u0001\uffff\uffff\u0000\u001f"+ - "\u0003\u0001\u0000\u0000\u0000 !\u0001\u0000\u0000\u0000!\u0005\u0001"+ - "\u0000\u0000\u0000\"#\u0003\b\u0004\u0000#$\u0006\u0003\uffff\uffff\u0000"+ - "$&\u0001\u0000\u0000\u0000%\"\u0001\u0000\u0000\u0000&\'\u0001\u0000\u0000"+ - "\u0000\'%\u0001\u0000\u0000\u0000\'(\u0001\u0000\u0000\u0000(\u0007\u0001"+ - "\u0000\u0000\u0000)*\u0005\u0012\u0000\u0000*+\u0003\n\u0005\u0000+,\u0006"+ - "\u0004\uffff\uffff\u0000,\t\u0001\u0000\u0000\u0000-.\u0003\f\u0006\u0000"+ - ".5\u0006\u0005\uffff\uffff\u0000/0\u0007\u0000\u0000\u000001\u0003\f\u0006"+ - "\u000012\u0006\u0005\uffff\uffff\u000024\u0001\u0000\u0000\u00003/\u0001"+ - "\u0000\u0000\u000047\u0001\u0000\u0000\u000053\u0001\u0000\u0000\u0000"+ - "56\u0001\u0000\u0000\u00006\u000b\u0001\u0000\u0000\u000075\u0001\u0000"+ - "\u0000\u000089\u0003\u000e\u0007\u00009@\u0006\u0006\uffff\uffff\u0000"+ - ":;\u0007\u0001\u0000\u0000;<\u0003\u000e\u0007\u0000<=\u0006\u0006\uffff"+ - "\uffff\u0000=?\u0001\u0000\u0000\u0000>:\u0001\u0000\u0000\u0000?B\u0001"+ - "\u0000\u0000\u0000@>\u0001\u0000\u0000\u0000@A\u0001\u0000\u0000\u0000"+ - "A\r\u0001\u0000\u0000\u0000B@\u0001\u0000\u0000\u0000CD\u0005\u0014\u0000"+ - "\u0000DE\u0006\u0007\uffff\uffff\u0000E\u000f\u0001\u0000\u0000\u0000"+ - "FG\u0005\u001c\u0000\u0000GH\u0006\b\uffff\uffff\u0000H\u0011\u0001\u0000"+ - "\u0000\u0000IJ\u0005\u0003\u0000\u0000JN\u0006\t\uffff\uffff\u0000KL\u0005"+ - "\u0004\u0000\u0000LN\u0006\t\uffff\uffff\u0000MI\u0001\u0000\u0000\u0000"+ - "MK\u0001\u0000\u0000\u0000N\u0013\u0001\u0000\u0000\u0000\u0004\'5@M"; + "\u0001\u0001\u0001\u0001\u0005\u0001!\b\u0001\n\u0001\f\u0001$\t\u0001"+ + "\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0003\u0004\u0003"+ + "+\b\u0003\u000b\u0003\f\u0003,\u0001\u0004\u0001\u0004\u0001\u0004\u0001"+ + "\u0004\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001"+ + "\u0005\u0005\u00059\b\u0005\n\u0005\f\u0005<\t\u0005\u0001\u0006\u0001"+ + "\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0005\u0006D\b"+ + "\u0006\n\u0006\f\u0006G\t\u0006\u0001\u0007\u0001\u0007\u0001\u0007\u0001"+ + "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0003\u0007P\b\u0007\u0001"+ + "\b\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001\t\u0003\tY\b\t\u0001"+ + "\t\u0000\u0000\n\u0000\u0002\u0004\u0006\b\n\f\u000e\u0010\u0012\u0000"+ + "\u0002\u0001\u0000\u0018\u0019\u0001\u0000\u001a\u001cV\u0000\u0014\u0001"+ + "\u0000\u0000\u0000\u0002\"\u0001\u0000\u0000\u0000\u0004%\u0001\u0000"+ + "\u0000\u0000\u0006*\u0001\u0000\u0000\u0000\b.\u0001\u0000\u0000\u0000"+ + "\n2\u0001\u0000\u0000\u0000\f=\u0001\u0000\u0000\u0000\u000eO\u0001\u0000"+ + "\u0000\u0000\u0010Q\u0001\u0000\u0000\u0000\u0012X\u0001\u0000\u0000\u0000"+ + "\u0014\u0015\u0003\u0002\u0001\u0000\u0015\u0016\u0005\u0000\u0000\u0001"+ + "\u0016\u0017\u0006\u0000\uffff\uffff\u0000\u0017\u0001\u0001\u0000\u0000"+ + "\u0000\u0018\u0019\u0005\u0001\u0000\u0000\u0019\u001a\u0003\u0012\t\u0000"+ + "\u001a\u001b\u0003\u0010\b\u0000\u001b\u001c\u0005\u0016\u0000\u0000\u001c"+ + "\u001d\u0005\u0017\u0000\u0000\u001d\u001e\u0003\u0006\u0003\u0000\u001e"+ + "\u001f\u0006\u0001\uffff\uffff\u0000\u001f!\u0001\u0000\u0000\u0000 \u0018"+ + "\u0001\u0000\u0000\u0000!$\u0001\u0000\u0000\u0000\" \u0001\u0000\u0000"+ + "\u0000\"#\u0001\u0000\u0000\u0000#\u0003\u0001\u0000\u0000\u0000$\"\u0001"+ + "\u0000\u0000\u0000%&\u0001\u0000\u0000\u0000&\u0005\u0001\u0000\u0000"+ + "\u0000\'(\u0003\b\u0004\u0000()\u0006\u0003\uffff\uffff\u0000)+\u0001"+ + "\u0000\u0000\u0000*\'\u0001\u0000\u0000\u0000+,\u0001\u0000\u0000\u0000"+ + ",*\u0001\u0000\u0000\u0000,-\u0001\u0000\u0000\u0000-\u0007\u0001\u0000"+ + "\u0000\u0000./\u0005\u0013\u0000\u0000/0\u0003\n\u0005\u000001\u0006\u0004"+ + "\uffff\uffff\u00001\t\u0001\u0000\u0000\u000023\u0003\f\u0006\u00003:"+ + "\u0006\u0005\uffff\uffff\u000045\u0007\u0000\u0000\u000056\u0003\f\u0006"+ + "\u000067\u0006\u0005\uffff\uffff\u000079\u0001\u0000\u0000\u000084\u0001"+ + "\u0000\u0000\u00009<\u0001\u0000\u0000\u0000:8\u0001\u0000\u0000\u0000"+ + ":;\u0001\u0000\u0000\u0000;\u000b\u0001\u0000\u0000\u0000<:\u0001\u0000"+ + "\u0000\u0000=>\u0003\u000e\u0007\u0000>E\u0006\u0006\uffff\uffff\u0000"+ + "?@\u0007\u0001\u0000\u0000@A\u0003\u000e\u0007\u0000AB\u0006\u0006\uffff"+ + "\uffff\u0000BD\u0001\u0000\u0000\u0000C?\u0001\u0000\u0000\u0000DG\u0001"+ + "\u0000\u0000\u0000EC\u0001\u0000\u0000\u0000EF\u0001\u0000\u0000\u0000"+ + "F\r\u0001\u0000\u0000\u0000GE\u0001\u0000\u0000\u0000HI\u0005\u0015\u0000"+ + "\u0000IP\u0006\u0007\uffff\uffff\u0000JK\u0005\u0016\u0000\u0000KL\u0003"+ + "\n\u0005\u0000LM\u0005\u0017\u0000\u0000MN\u0006\u0007\uffff\uffff\u0000"+ + "NP\u0001\u0000\u0000\u0000OH\u0001\u0000\u0000\u0000OJ\u0001\u0000\u0000"+ + "\u0000P\u000f\u0001\u0000\u0000\u0000QR\u0005\u001d\u0000\u0000RS\u0006"+ + "\b\uffff\uffff\u0000S\u0011\u0001\u0000\u0000\u0000TU\u0005\u0003\u0000"+ + "\u0000UY\u0006\t\uffff\uffff\u0000VW\u0005\u0004\u0000\u0000WY\u0006\t"+ + "\uffff\uffff\u0000XT\u0001\u0000\u0000\u0000XV\u0001\u0000\u0000\u0000"+ + "Y\u0013\u0001\u0000\u0000\u0000\u0006\",:EOX"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/src/main/antlr/.antlr/VSLParser.tokens b/src/main/antlr/.antlr/VSLParser.tokens index 14ac99b..69a58ba 100644 --- a/src/main/antlr/.antlr/VSLParser.tokens +++ b/src/main/antlr/.antlr/VSLParser.tokens @@ -6,28 +6,29 @@ LE=5 LT=6 GE=7 GT=8 -IF=9 -THEN=10 -ELSE=11 -FIN=12 -WHILE=13 -DO=14 -DONE=15 -READ=16 -PRINT=17 -RETURN=18 -TEXT=19 -NUMBER=20 -ParO=21 -ParF=22 -PLUS=23 -MINUS=24 -DIV=25 -TIMES=26 -MOD=27 -IDENT=28 -WS=29 -COMMENT=30 +ASSIGN=9 +IF=10 +THEN=11 +ELSE=12 +FIN=13 +WHILE=14 +DO=15 +DONE=16 +READ=17 +PRINT=18 +RETURN=19 +TEXT=20 +NUMBER=21 +ParO=22 +ParF=23 +PLUS=24 +MINUS=25 +DIV=26 +TIMES=27 +MOD=28 +IDENT=29 +WS=30 +COMMENT=31 'FUNC'=1 'PROTO'=2 'INT'=3 @@ -36,20 +37,21 @@ COMMENT=30 '<'=6 '>='=7 '>'=8 -'IF'=9 -'THEN'=10 -'ELSE'=11 -'FI'=12 -'WHILE'=13 -'DO'=14 -'DONE'=15 -'READ'=16 -'PRINT'=17 -'RETURN'=18 -'('=21 -')'=22 -'+'=23 -'-'=24 -'/'=25 -'*'=26 -'%'=27 +':='=9 +'IF'=10 +'THEN'=11 +'ELSE'=12 +'FI'=13 +'WHILE'=14 +'DO'=15 +'DONE'=16 +'READ'=17 +'PRINT'=18 +'RETURN'=19 +'('=22 +')'=23 +'+'=24 +'-'=25 +'/'=26 +'*'=27 +'%'=28 diff --git a/src/main/antlr/VSLLexer.g b/src/main/antlr/VSLLexer.g index e3e2d30..0650516 100644 --- a/src/main/antlr/VSLLexer.g +++ b/src/main/antlr/VSLLexer.g @@ -17,13 +17,15 @@ TYPE_INT: 'INT' TYPE_VOID: 'VOID' ; LE : '<=' - ; + ; LT : '<' - ; + ; GE : '>=' - ; + ; GT : '>' - ; + ; +ASSIGN :':=' + ; IF : 'IF' ; THEN : 'THEN' diff --git a/src/main/antlr/VSLParser.g b/src/main/antlr/VSLParser.g index abf5df6..2915b00 100644 --- a/src/main/antlr/VSLParser.g +++ b/src/main/antlr/VSLParser.g @@ -34,10 +34,10 @@ function returns [ArrayList out] SymTable sym_table = new SymTable(); $out = new ArrayList(); }: - FUNCTION t=type i=ident ParO ParF instrs=list_instr[sym_table] + (FUNCTION t=type i=ident ParO ParF instrs=list_instr[sym_table] { $out.add(new FunctionImp($t.return_type, $i.out, $instrs.out)); - } + })* ; prototype returns [Program p]: @@ -56,8 +56,10 @@ instruction [SymTable table] returns [Instruction out]: RETURN e=expression [table] { $out =new Return_instrImp($e.out);} + ; +//Priorité lit(val, const ou paranthese) -> td_exp (*/%) -> exp (+-) expression [SymTable table] returns [Type return_Type, Expression out]: //Fix LL1 and compare add and sub first left=td_expression[table] { @@ -66,6 +68,7 @@ expression [SymTable table] returns [Type return_Type, Expression out]: } //maybe it will be binop(s) with add/sub here //if it is mul or div, they are all gonna be left=td_expression[table] to handle +// have to make $out,$right.out to make a loop (op=(PLUS | MINUS) right=td_expression[table] { $out = new BinopExpressionImp( switch($op.getType()) { @@ -73,19 +76,19 @@ expression [SymTable table] returns [Type return_Type, Expression out]: case MINUS -> Op.MINUS; default -> throw new IllegalArgumentException("Unknown operator"); }, - $left.out, + $out, $right.out ); - $return_Type = $right.return_Type; + $return_Type = $left.return_Type; })* ; td_expression [SymTable table] returns [Type return_Type, Expression out]: - left=lit { + left=lit[table] { $out = $left.out; $return_Type = $left.return_Type; } - (op=(TIMES | DIV) right=lit { + (op=(TIMES | DIV| MOD) right=lit [table] { $out = new Program.BinopExpressionImp( switch($op.getType()) { case TIMES -> Op.TIMES; @@ -93,18 +96,22 @@ td_expression [SymTable table] returns [Type return_Type, Expression out]: case MOD -> Op.MOD; default -> throw new IllegalArgumentException("Unknown operator"); }, - $left.out, + $out, $right.out ); - $return_Type = $right.return_Type; + $return_Type = $left.return_Type; })* ; -lit returns [Expression out, Type return_Type]: +lit [SymTable table] returns [Expression out, Type return_Type]: NUMBER { $return_Type = new Type_intImp(); $out = new ConstImp($NUMBER.int); } + | ParO e=expression[table] ParF{ + $out=$e.out; + $return_Type=$e.return_Type; + } ; ident returns [String out]: diff --git a/src/main/java/TP2/asd/Eval.java b/src/main/java/TP2/asd/Eval.java index 487a1ff..d1e248c 100644 --- a/src/main/java/TP2/asd/Eval.java +++ b/src/main/java/TP2/asd/Eval.java @@ -17,6 +17,7 @@ public class Eval { case Op.MINUS: return e.e1().accept(this, h)-e.e2().accept(this, h); case Op.TIMES: return e.e1().accept(this, h)*e.e2().accept(this, h); case Op.DIV: return e.e1().accept(this, h)/e.e2().accept(this, h); + case Op.MOD: return e.e1().accept(this, h)%e.e2().accept(this, h); default: throw new IllegalArgumentException(); } } @@ -29,6 +30,13 @@ public class Eval { ExprEval exprEval = new ExprEval(); return e.e().accept(exprEval, h); } + + @Override + public Integer visitAssign(AssignImp e, Map h) { + //h.put(e.i(), e.t()); + //TODO + return 1; + } } } diff --git a/src/main/java/TP2/asd/Interface.java b/src/main/java/TP2/asd/Interface.java index d615027..acf9656 100644 --- a/src/main/java/TP2/asd/Interface.java +++ b/src/main/java/TP2/asd/Interface.java @@ -30,6 +30,7 @@ public interface Interface{ public interface InstrVisitor{ public S visitReturn(Return_instrImp e, H h); + public S visitAssign(AssignImp e, H h); } public interface ExprVisitor { @@ -41,12 +42,5 @@ public interface Interface{ public String prettyprinter(); } - public enum Op {PLUS, MINUS, TIMES, DIV,MOD} - - //Eval - public interface ExprEval extends ExprVisitor, Integer> { - } - - public interface TypeCheck extends ExprVisitor, Type> { - } + public enum Op {PLUS, MINUS, TIMES, DIV, MOD} } \ No newline at end of file diff --git a/src/main/java/TP2/asd/Program.java b/src/main/java/TP2/asd/Program.java index 198a4f0..fab11c2 100644 --- a/src/main/java/TP2/asd/Program.java +++ b/src/main/java/TP2/asd/Program.java @@ -42,6 +42,11 @@ public class Program{ return v.visitReturn(this,h); } } + public static record AssignImp(String t, Expression e) implements Instruction{ + public S accept(InstrVisitor v, H h) { + return v.visitAssign(this, h); + } + } public static record Type_voidImp() implements Type{ public String prettyprinter() { @@ -88,6 +93,12 @@ public class Program{ ExprEval exprEval = new ExprEval(); return e.e().accept(exprEval, h); } + @Override + public Integer visitAssign(AssignImp e, Map h) { + //h.put(e.t(), e.e()); + //TODO + return 1; + } } public static class ExprEval implements ExprVisitor,Integer>{