1 /********************************************************************
3 parser.c - recursive-descent parser
5 Niksa Orlic, 2004-04-19
7 ********************************************************************/
10 //#include "../util/message.h"
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <string.h>
35 #pragma warning (disable: 4305)
36 #pragma warning (disable: 4761)
40 //extern void (*compile_terminate)();
50 /* Scanner variables and functions */
73 /* Small macro for outputting the yytext value */
77 /* A macro to explicitly declare we didn't forget break inside
78 the case statement */
79 //#define no_break /* do nothing */;
86 int inside_implementation_part = 0; /* if the compiler is inside the implementation part of the unit */
99 //ASM - LABEL TABLE
103 //int ofs[1024];
106 /*
107 Starts parsing the input file. The grammar rule
108 used is:
110 <parser_start> -> <RD_program_header> <RD_uses_list> <RD_block> . <<EOF>>
111 -> <RD_program_header> <RD_unit_interface> <RD_unit_implementation> <RD_unit_initialization> <RD_unit_finalization> . <<EOF>>
112 */
114 {
129 {
137 // j-a-s-d
141 /* initialize the random number generator */
156 /* END initialize the random number generator */
158 /* initialize the index counter field */
165 /* END initialize the IC field */
167 /* reset the keyboard buffers */
174 /* END reset the keyboard buffers */
178 /* do the 'halt' at the end of program execution */
185 /* bytecode verififer wants this unnecessary return */
187 }
188 else
189 {
193 symbols_filename = (char*) mem_alloc(strlen(output_path) + string_length(str_program_name) + 10);
194 #ifdef WIN32
196 #endif
197 #ifdef UNIX
199 #endif
215 // j-a-s-d
219 }
223 else
224 {
226 }
231 }
233 /* check if there are forward declarations without the body */
237 {
240 /* Error-recovery: find the end of input */
243 }
244 else
248 {
250 }
253 {
259 {
262 }
263 else
264 {
265 output_file_name = (char*) mem_alloc(strlen(output_path) + string_length(str_program_name) + 10);
267 }
273 {
274 #ifdef WIN32
276 #endif
277 #ifdef UNIX
279 #endif
281 }
282 else
283 {
284 #ifdef WIN32
286 #endif
287 #ifdef UNIX
289 #endif
291 }
296 {
298 }
303 }
304 // j-a-s-d
305 end_parsing:
310 }
313 /*
314 Program header, uses the grammar rule:
316 <RD_program_header> -> [program IDENTIFIER ;]
317 */
319 {
324 {
331 {
333 }
334 else
343 {
347 /* Error-recovery: find any of the following:
348 CONST, TYPE, VAR, PROCEDURE, FUNCTION, BEGIN, ., EOF
349 */
358 {
360 }
361 }
362 else
364 }
367 }
369 /*
370 the interface part of the unit source
372 <RD_unit_interface> -> [interface [;] <RD_block> ]
374 special rules apply to declarations inside the interface; global variable inside_interface_part is used to denote the special cases
375 */
377 {
379 {
386 do
387 {
389 }
393 }
403 }
405 /*
406 the implementation part of the unit source
408 <RD_unit_implementation> -> implementation [;] <RD_uses_list> <RD_block>
409 */
411 {
416 {
419 do
420 {
422 }
426 }
435 // j-a-s-d
442 }
444 /*
445 the initialization part of the unit
447 <RD_unit_initialization> -> [initialization [;] <RD_block_body> ]
448 */
450 {
452 {
459 }
460 }
462 /*
463 the finalization part of the unit is not supported by the compiler
464 */
466 {
468 {
472 }
473 }
475 /*
476 The list of 'uses' directives.
477 <RD_uses_list> -> ( uses NAME; )*
478 */
480 {
482 {
483 following_unit:
487 {
490 /* do error recovery */
493 {
496 }
497 }
499 /* process the library */
508 {
511 /* do error recovery */
514 {
517 }
518 }
519 else
521 }
527 {
532 // j-a-s-d
533 //compile_terminate();
535 }
536 }
539 /*
540 Program block with declarations and code.
541 The grammar rule used:
543 <RD_block> -> const <RD_const_declaration>
544 | type <RD_type_declaration>
545 | var <RD_var_declaration>
546 | procedure <RD_procedure_declaration>
547 | function <RD_function_declaration>
548 | begin <RD_block_body> end
549 */
551 {
553 {
555 {
559 }
562 {
566 }
569 {
573 }
576 {
583 }
586 {
593 }
596 {
598 {
601 do
602 {
607 }
614 {
616 }
617 else
621 }
624 {
630 ))
631 {
633 }
639 ))
640 {
642 }
647 /* Error-recovery: find any of the following:
648 CONST, TYPE, VAR, PROCEDURE, FUNCTION, BEGIN, ., EOF
649 */
658 {
660 }
663 }
664 }
667 }
670 /*
671 Constant declarations, the grammar rule used is:
673 <RD_constant_declaration> -> ( IDN = CONST ; )+ <RD_block>
674 */
676 {
680 do
681 {
684 else
688 {
690 }
693 {
695 }
702 {
705 /* Error-recovery: find the first SEMI_COLON */
708 {
710 }
713 {
717 }
720 }
724 // j-a-s-d: quick fix to support negative integer constants
732 }
733 }
736 {
738 {
747 }
750 {
759 }
762 {
771 }
774 {
783 }
786 {
795 }
798 {
799 /* TODO:: ovo nije dobro, ovdje bi mogao pisati bilo kakav
800 konstantni izraz */
803 /* Error-recovery: find the first semi-colon */
806 {
808 }
811 {
814 }
817 }
818 }
825 }
828 /*
829 Handles variable declarations field. The grammar rule used is:
831 <RD_var_declaration> -> (<RD_identifier_list> : <RD_type> ;)+ <RD_block>
832 */
834 {
838 do
839 {
843 {
846 /* Error-recovery: find any of the following:
847 CONST, TYPE, VAR, PROCEDURE, FUNCTION, BEGIN, ., EOF
848 */
857 {
859 }
863 {
866 }
869 }
876 {
879 }
890 {
893 /* Error-recovery: find any of the following:
894 CONST, TYPE, VAR, PROCEDURE, FUNCTION, BEGIN, ., EOF
895 */
904 {
906 }
910 {
913 }
916 }
925 ))
926 {
928 }
941 {
944 }
947 }
950 /*
951 The list of identifiers, the rule used is:
953 <RD_identifier_list> -> IDN (, IDN)*
955 param check_valid_names should be nonzero if the function
956 should call block_check_name() for each identifier
957 */
960 {
967 {
970 /* Error-recovery: find the first : or EOF */
974 {
976 }
979 }
983 {
985 }
994 {
998 {
1001 /* Error-recovery: find the first : or EOF */
1005 {
1007 }
1010 }
1014 {
1016 }
1023 }
1026 }
1029 /*
1030 Handles the declaration of a new type. The grammar
1031 rule used is:
1033 <RD_type_declaration> -> ( IDN = <RD_type> ; )+ <RD_block>
1034 */
1036 {
1040 do
1041 {
1043 {
1049 ))
1050 {
1052 }
1056 /* Error-recovery: find the first ; or EOF */
1060 {
1062 }
1068 }
1077 {
1080 /* Error-recovery: find the first ; or EOF */
1084 {
1086 }
1094 }
1106 {
1109 /* Error-recovery: find the first ; or EOF */
1113 {
1115 }
1121 }
1135 {
1138 }
1142 }
1145 /*
1146 Handles the procedure declaration. The grammar
1147 rule used is:
1149 <RD_procedure_declaration> -> IDN <RD_param_list> ;
1150 <RD_proc_block> ; <RD_block>
1151 */
1153 {
1166 {
1168 }
1174 {
1177 /* Error-recovery: find the first ; */
1180 {
1182 }
1186 }
1187 else
1188 {
1190 }
1195 /* create a new block for the procedure */
1201 {
1204 /* Error-recovery: do nothing */
1205 }
1206 else
1221 add_procedure(current_block, procedure_name, parameters, forward_declaration, procedure_linenum);
1224 {
1228 /* Error-recovery: do nothing */
1229 }
1230 else
1236 }
1239 /*
1240 Handles the function declaration. The grammar
1241 rule used is:
1243 <RD_function_declaration> -> IDN <RD_param_list> : IDN ;
1244 <RD_proc_block> ; <RD_block>
1245 */
1247 {
1261 {
1263 }
1269 {
1272 /* Error-recovery: find the first ; */
1275 {
1277 }
1281 }
1282 else
1288 /* create a new block for the function */
1291 /* parameters start at index 0, variables follow after the return value */
1300 {
1302 }
1303 else
1312 {
1315 }
1318 {
1320 }
1321 else
1325 {
1328 /* Error-recovery: do nothing */
1329 }
1330 else
1333 /* initialize the return value */
1341 else
1358 {
1362 /* Error-recovery: do nothing */
1363 }
1364 else
1370 }
1373 /*
1374 Allows forward declarations. The rule used is:
1376 <RD_proc_block> -> forward | <RD_block>
1378 Return nonzero value if the declaration is forward
1379 declaration.
1380 */
1382 {
1390 {
1397 }
1398 else
1399 {
1405 /* insert current_block into it's parents block list */
1407 {
1409 }
1410 else
1411 {
1412 current_block->parent_block->children = (block**) mem_realloc(current_block->parent_block->children,
1414 }
1422 {
1430 {
1434 }
1435 else
1436 {
1438 {
1454 }
1457 }
1477 {
1493 }
1498 }
1500 current_block->parent_block->children[current_block->parent_block->children_count-1] = current_block;
1501 }
1504 }
1507 /*
1508 Handles the declarations of parameters to a
1509 procedure/function. The grammar rule used is:
1511 <RD_param_list> -> empty
1512 | "(" [var] <RD_identifier_list> : [IDN.]IDN (; [var] <RD_identifier_list> : [IDN.]IDN )+ ")"
1513 */
1515 {
1526 {
1527 do
1528 {
1532 {
1535 }
1543 {
1547 }
1552 {
1555 /* Error-recovery, find the ")" */
1557 {
1559 }
1566 }
1567 else
1573 {
1574 /* check if the name is an unit name */
1582 {
1589 else
1596 else
1598 }
1601 }
1604 {
1607 }
1609 /* add the types into parameter_list */
1615 is_parameter_variable);
1618 {
1621 /* Error-recovery */
1625 }
1626 else
1632 {
1635 /* Error-recovery: find the first ; */
1638 {
1640 }
1641 }
1644 }
1647 }
1649 /*
1650 Handles the block of code. The grammar rule used is:
1652 <RD_block_body> -> (<RD_statement> ; )+
1653 */
1655 {
1658 do
1659 {
1662 else
1668 }
1671 /*
1672 The statements rule:
1674 <RD_statement> -> begin <RD_block_body> end
1675 | empty (if current_token == end || current_token == until)
1676 | if <RD_if_statement>
1677 | case <RD_case_statement>
1678 | while <RD_while_statement>
1679 | repeat <RD_repeat_statement>
1680 | for <RD_for_statement>
1681 | with <RD_with_statement>
1682 | <RD_assignment_or_procedure_call>
1683 | break
1684 */
1686 {
1688 {
1690 {
1695 {
1697 }
1702 }
1705 {
1707 }
1710 {
1724 {
1728 }
1729 else
1730 {
1732 {
1748 }
1751 }
1771 {
1787 }
1790 }
1793 }
1795 {
1799 }
1802 {
1806 }
1809 {
1813 }
1816 {
1820 }
1823 {
1827 }
1830 {
1835 }
1839 {
1842 }
1845 {
1850 else
1851 {
1854 }
1856 }
1859 {
1867 }
1870 {
1884 }
1886 }
1889 {
1892 }
1893 }
1894 }
1899 ///////////////////////////////////////////////////////////////////////////////////////////////////
1900 ////////////////////////////////////// JAVA - ASM /////////////////////////////////////////////////
1901 ///////////////////////////////////////////////////////////////////////////////////////////////////
1902 /*
1903 Handles the inline statement. The grammar rule
1904 is:
1905 <inline (byte)>
1906 <inline (opcode)>
1907 <inline (opcode int)>
1908 <inline (opcode [[cp_type] 'param1', 'param2', 'param3'])>
1909 */
1912 if (strcmp(yytext, "aconst_null") == 0) return 0x01; // çà ãðóçêà â ñòåê null ( ïóñòîé ññûëêè Ãà îáúåêò)
1913 if (strcmp(yytext, "iconst_m1") == 0) return 0x02; // çà ãðóçêà öåëî÷èñëåÃÃîé êîÃñòà Ãòû -1
1914 if (strcmp(yytext, "iconst_0") == 0) return 0x03; // çà ãðóçêà öåëî÷èñëåÃÃîé êîÃñòà Ãòû 0}
1915 if (strcmp(yytext, "iconst_1") == 0) return 0x04; // çà ãðóçêà öåëî÷èñëåÃÃîé êîÃñòà Ãòû 1}
1916 if (strcmp(yytext, "iconst_2") == 0) return 0x05; // çà ãðóçêà öåëî÷èñëåÃÃîé êîÃñòà Ãòû 2}
1917 if (strcmp(yytext, "iconst_3") == 0) return 0x06; // çà ãðóçêà öåëî÷èñëåÃÃîé êîÃñòà Ãòû 3}
1918 if (strcmp(yytext, "iconst_4") == 0) return 0x07; // çà ãðóçêà öåëî÷èñëåÃÃîé êîÃñòà Ãòû 4}
1919 if (strcmp(yytext, "iconst_5") == 0) return 0x08; // çà ãðóçêà öåëî÷èñëåÃÃîé êîÃñòà Ãòû 5}
1920 if (strcmp(yytext, "lconst_0") == 0) return 0x09; // çà ãðóçêà äëèÃÃîé öåëî÷èñëåÃÃîé êîÃñòà Ãòû 0}
1921 if (strcmp(yytext, "lconst_1") == 0) return 0x0A; // çà ãðóçêà äëèÃÃîé öåëî÷èñëåÃÃîé êîÃñòà Ãòû 1}
1922 if (strcmp(yytext, "fconst_0") == 0) return 0x0B; // çà ãðóçêà âåùåñòâåÃÃîãî ÷èñëà îäèÃà ðÃîé òî÷Ãîñòè 0}
1923 if (strcmp(yytext, "fconst_1") == 0) return 0x0C; // çà ãðóçêà âåùåñòâåÃÃîãî ÷èñëà îäèÃà ðÃîé òî÷Ãîñòè 1}
1924 if (strcmp(yytext, "fconst_2") == 0) return 0x0D; // çà ãðóçêà âåùåñòâåÃÃîãî ÷èñëà îäèÃà ðÃîé òî÷Ãîñòè 2}
1925 if (strcmp(yytext, "dconst_0") == 0) return 0x0E; // çà ãðóçêà âåùåñòâåÃÃîãî ÷èñëà äâîéÃîé òî÷Ãîñòè 0}
1926 if (strcmp(yytext, "dconst_1") == 0) return 0x0F; // çà ãðóçêà âåùåñòâåÃÃîãî ÷èñëà äâîéÃîé òî÷Ãîñòè 1}
1927 if (strcmp(yytext, "bipush") == 0) return 0x10; // [1]çà ãðóçêà â ñòåê îäÃîáà éòîâîãî öåëîãî ñî çÃà êîì}
1928 if (strcmp(yytext, "sipush") == 0) return 0x11; // [2+-]çà ãðóçêà â ñòåê äâóõáà éòîâîãî öåëîãî ñî çÃà êîì}
1929 if (strcmp(yytext, "ldc1") == 0) return 0x12; // [1]çà ãðóçêà â ñòåê ýëåìåÃòà èç êîÃñòà ÃòÃîãî ïóëà }
1930 if (strcmp(yytext, "ldc2") == 0) return 0x13; // [2]çà ãðóçêà â ñòåê ýëåìåÃòà èç êîÃñòà ÃòÃîãî ïóëà }
1931 if (strcmp(yytext, "ldc2w") == 0) return 0x14; // [2]çà ãðóçêà â ñòåê äëèÃÃîãî öåëîãî èëè äâîéÃîãî âåùåñòâåÃÃîãî çÃà ÷åÃèÿ èç êîÃñòà ÃòÃîãî ïóëà }
1932 if (strcmp(yytext, "iload") == 0) return 0x15; // [1]çà ãðóçêà öåëîãî èç ëîêà ëüÃîé ïåðåìåÃÃîé}
1933 if (strcmp(yytext, "lload") == 0) return 0x16; // [1]çà ãðóçêà äëèÃÃîãî öåëîãî èç ëîêà ëüÃîé ïåðåìåÃÃîé}
1934 if (strcmp(yytext, "fload") == 0) return 0x17; // [1]çà ãðóçêà âåùåñòâåÃÃîãî îäèÃà ðÃîé òî÷Ãîñòè èç ëîêà ëüÃîé ïåðåìåÃÃîé}
1935 if (strcmp(yytext, "dload") == 0) return 0x18; // [1]çà ãðóçêà âåùåñòâåÃÃîãî äâîéÃîé òî÷Ãîñòè èç ëîêà ëüÃîé ïåðåìåÃÃîé}
1936 if (strcmp(yytext, "aload") == 0) return 0x19; // [1]çà ãðóçêà îáúåêòÃîé ññûëêè èç ëîêà ëüÃîé ïåðåìåÃÃîé}
1937 if (strcmp(yytext, "iload_0") == 0) return 0x1A; // çà ãðóçêà öåëîãî èç ëîêà ëüÃîé ïåðåìåÃÃîé 0}
1938 if (strcmp(yytext, "iload_1") == 0) return 0x1B; // çà ãðóçêà öåëîãî èç ëîêà ëüÃîé ïåðåìåÃÃîé 1}
1939 if (strcmp(yytext, "iload_2") == 0) return 0x1C; // çà ãðóçêà öåëîãî èç ëîêà ëüÃîé ïåðåìåÃÃîé 2}
1940 if (strcmp(yytext, "iload_3") == 0) return 0x1D; // çà ãðóçêà öåëîãî èç ëîêà ëüÃîé ïåðåìåÃÃîé 3}
1941 if (strcmp(yytext, "lload_0") == 0) return 0x1E; // çà ãðóçêà äëèÃÃîãî öåëîãî èç ëîêà ëüÃîé ïåðåìåÃÃîé 0}
1942 if (strcmp(yytext, "lload_1") == 0) return 0x1F; // çà ãðóçêà äëèÃÃîãî öåëîãî èç ëîêà ëüÃîé ïåðåìåÃÃîé 1}
1943 if (strcmp(yytext, "lload_2") == 0) return 0x20; // çà ãðóçêà äëèÃÃîãî öåëîãî èç ëîêà ëüÃîé ïåðåìåÃÃîé 2}
1944 if (strcmp(yytext, "lload_3") == 0) return 0x21; // çà ãðóçêà äëèÃÃîãî öåëîãî èç ëîêà ëüÃîé ïåðåìåÃÃîé 3}
1945 if (strcmp(yytext, "fload_0") == 0) return 0x22; // çà ãðóçêà âåùåñòâåÃÃîãî îäèÃà ðÃîé òî÷Ãîñòè èç ëîêà ëüÃîé ïåðåìåÃÃîé 0}
1946 if (strcmp(yytext, "fload_1") == 0) return 0x23; // çà ãðóçêà âåùåñòâåÃÃîãî îäèÃà ðÃîé òî÷Ãîñòè èç ëîêà ëüÃîé ïåðåìåÃÃîé 1}
1947 if (strcmp(yytext, "fload_2") == 0) return 0x24; // çà ãðóçêà âåùåñòâåÃÃîãî îäèÃà ðÃîé òî÷Ãîñòè èç ëîêà ëüÃîé ïåðåìåÃÃîé 2}
1948 if (strcmp(yytext, "fload_3") == 0) return 0x25; // çà ãðóçêà âåùåñòâåÃÃîãî îäèÃà ðÃîé òî÷Ãîñòè èç ëîêà ëüÃîé ïåðåìåÃÃîé 3}
1949 if (strcmp(yytext, "dload_0") == 0) return 0x26; // çà ãðóçêà âåùåñòâåÃÃîãî äâîéÃîé òî÷Ãîñòè èç ëîêà ëüÃîé ïåðåìåÃÃîé 0}
1950 if (strcmp(yytext, "dload_1") == 0) return 0x27; // çà ãðóçêà âåùåñòâåÃÃîãî äâîéÃîé òî÷Ãîñòè èç ëîêà ëüÃîé ïåðåìåÃÃîé 1}
1951 if (strcmp(yytext, "dload_2") == 0) return 0x28; // çà ãðóçêà âåùåñòâåÃÃîãî äâîéÃîé òî÷Ãîñòè èç ëîêà ëüÃîé ïåðåìåÃÃîé 2}
1952 if (strcmp(yytext, "dload_3") == 0) return 0x29; // çà ãðóçêà âåùåñòâåÃÃîãî äâîéÃîé òî÷Ãîñòè èç ëîêà ëüÃîé ïåðåìåÃÃîé 3}
1953 if (strcmp(yytext, "aload_0") == 0) return 0x2A; // çà ãðóçêà îáúåêòÃîé ññûëêè èç ëîêà ëüÃîé ïåðåìåÃÃîé 0}
1954 if (strcmp(yytext, "aload_1") == 0) return 0x2B; // çà ãðóçêà îáúåêòÃîé ññûëêè èç ëîêà ëüÃîé ïåðåìåÃÃîé 1}
1955 if (strcmp(yytext, "aload_2") == 0) return 0x2C; // çà ãðóçêà îáúåêòÃîé ññûëêè èç ëîêà ëüÃîé ïåðåìåÃÃîé 2}
1956 if (strcmp(yytext, "aload_3") == 0) return 0x2D; // çà ãðóçêà îáúåêòÃîé ññûëêè èç ëîêà ëüÃîé ïåðåìåÃÃîé 3}
1957 if (strcmp(yytext, "iaload") == 0) return 0x2E; // çà ãðóçêà öåëîãî èç ìà ññèâà }
1958 if (strcmp(yytext, "laload") == 0) return 0x2F; // çà ãðóçêà äëèÃÃîãî öåëîãî èç ìà ññèâà }
1959 if (strcmp(yytext, "faload") == 0) return 0x30; // çà ãðóçêà âåùåñòâåÃÃîãî èç ìà ññèâà }
1960 if (strcmp(yytext, "daload") == 0) return 0x31; // çà ãðóçêà äâîéÃîãî âåùåñòâåÃÃîãî èç ìà ññèâà }
1961 if (strcmp(yytext, "aaload") == 0) return 0x32; // çà ãðóçêà îáúåêòÃîé ññûëêè èç ìà ññèâà }
1962 if (strcmp(yytext, "baload") == 0) return 0x33; // çà ãðóçêà áà éòà ñî çÃà êîì èç ìà ññèâà }
1963 if (strcmp(yytext, "caload") == 0) return 0x34; // çà ãðóçêà ñèìâîëà èç ìà ññèâà }
1964 if (strcmp(yytext, "saload") == 0) return 0x35; // çà ãðóçêà êîðîòêîãî èç ìà ññèâà }
1965 if (strcmp(yytext, "istore") == 0) return 0x36; // [1]ñîõðà ÃÃ¥Ãèå öåëîãî çÃà ÷åÃèÿ â ëîêà ëüÃîé ïåðåìåÃÃîé}
1966 if (strcmp(yytext, "lstore") == 0) return 0x37; // [1]ñîõðà ÃÃ¥Ãèå äëèÃÃîãî öåëîãî â ëîêà ëüÃîé ïåðåìåÃÃîé}
1967 if (strcmp(yytext, "fstore") == 0) return 0x38; // [1]ñîõðà ÃÃ¥Ãèå âåùåñòâåÃÃîãî îäèÃà ðÃîé òî÷Ãîñòè â ëîêà ëüÃîé ïåðåìåÃÃîé}
1968 if (strcmp(yytext, "dstore") == 0) return 0x39; // [1]ñîõðà ÃÃ¥Ãèå äâîéÃîãî âåùåñòâåÃÃîãî â ëîêà ëüÃîé ïåðåìåÃÃîé}
1969 if (strcmp(yytext, "astore") == 0) return 0x3A; // [1]ñîõðà ÃÃ¥Ãèå îáúåêòÃîé ññûëêè â ëîêà ëüÃîé ïåðåìåÃÃîé}
1970 if (strcmp(yytext, "istore_0") == 0) return 0x3B; // ñîõðà ÃÃ¥Ãèå öåëîãî â ëîêà ëüÃîé ïåðåìåÃÃîé 0}
1971 if (strcmp(yytext, "istore_1") == 0) return 0x3C; // ñîõðà ÃÃ¥Ãèå öåëîãî â ëîêà ëüÃîé ïåðåìåÃÃîé 1}
1972 if (strcmp(yytext, "istore_2") == 0) return 0x3D; // ñîõðà ÃÃ¥Ãèå öåëîãî â ëîêà ëüÃîé ïåðåìåÃÃîé 2}
1973 if (strcmp(yytext, "istore_3") == 0) return 0x3E; // ñîõðà ÃÃ¥Ãèå öåëîãî â ëîêà ëüÃîé ïåðåìåÃÃîé 3}
1974 if (strcmp(yytext, "lstore_0") == 0) return 0x3F; // ñîõðà ÃÃ¥Ãèå äëèÃÃîãî öåëîãî â ëîêà ëüÃîé ïåðåìåÃÃîé 0}
1975 if (strcmp(yytext, "lstore_1") == 0) return 0x40; // ñîõðà ÃÃ¥Ãèå äëèÃÃîãî öåëîãî â ëîêà ëüÃîé ïåðåìåÃÃîé 1}
1976 if (strcmp(yytext, "lstore_2") == 0) return 0x41; // ñîõðà ÃÃ¥Ãèå äëèÃÃîãî öåëîãî â ëîêà ëüÃîé ïåðåìåÃÃîé 2}
1977 if (strcmp(yytext, "lstore_3") == 0) return 0x42; // ñîõðà ÃÃ¥Ãèå äëèÃÃîãî öåëîãî â ëîêà ëüÃîé ïåðåìåÃÃîé 3}
1978 if (strcmp(yytext, "fstore_0") == 0) return 0x43; // ñîõðà ÃÃ¥Ãèå âåùåñòâåÃÃîãî îäèÃà ðÃîé òî÷Ãîñòè â ëîêà ëüÃîé ïåðåìåÃÃîé 0}
1979 if (strcmp(yytext, "fstore_1") == 0) return 0x44; // ñîõðà ÃÃ¥Ãèå âåùåñòâåÃÃîãî îäèÃà ðÃîé òî÷Ãîñòè â ëîêà ëüÃîé ïåðåìåÃÃîé 1}
1980 if (strcmp(yytext, "fstore_2") == 0) return 0x45; // ñîõðà ÃÃ¥Ãèå âåùåñòâåÃÃîãî îäèÃà ðÃîé òî÷Ãîñòè â ëîêà ëüÃîé ïåðåìåÃÃîé 2}
1981 if (strcmp(yytext, "fstore_3") == 0) return 0x46; // ñîõðà ÃÃ¥Ãèå âåùåñòâåÃÃîãî îäèÃà ðÃîé òî÷Ãîñòè â ëîêà ëüÃîé ïåðåìåÃÃîé 3}
1982 if (strcmp(yytext, "dstore_0") == 0) return 0x47; // ñîõðà ÃÃ¥Ãèå äâîéÃîãî âåùåñòâåÃÃîãî â ëîêà ëüÃîé ïåðåìåÃÃîé 0}
1983 if (strcmp(yytext, "dstore_1") == 0) return 0x48; // ñîõðà ÃÃ¥Ãèå äâîéÃîãî âåùåñòâåÃÃîãî â ëîêà ëüÃîé ïåðåìåÃÃîé 1}
1984 if (strcmp(yytext, "dstore_2") == 0) return 0x49; // ñîõðà ÃÃ¥Ãèå äâîéÃîãî âåùåñòâåÃÃîãî â ëîêà ëüÃîé ïåðåìåÃÃîé 2}
1985 if (strcmp(yytext, "dstore_3") == 0) return 0x4A; // ñîõðà ÃÃ¥Ãèå äâîéÃîãî âåùåñòâåÃÃîãî â ëîêà ëüÃîé ïåðåìåÃÃîé 3}
1986 if (strcmp(yytext, "astore_0") == 0) return 0x4B; // ñîõðà ÃÃ¥Ãèå îáúåêòÃîé ññûëêè â ëîêà ëüÃîé ïåðåìåÃÃîé 0}
1987 if (strcmp(yytext, "astore_1") == 0) return 0x4C; // ñîõðà ÃÃ¥Ãèå îáúåêòÃîé ññûëêè â ëîêà ëüÃîé ïåðåìåÃÃîé 1}
1988 if (strcmp(yytext, "astore_2") == 0) return 0x4D; // ñîõðà ÃÃ¥Ãèå îáúåêòÃîé ññûëêè â ëîêà ëüÃîé ïåðåìåÃÃîé 2}
1989 if (strcmp(yytext, "astore_3") == 0) return 0x4E; // ñîõðà ÃÃ¥Ãèå îáúåêòÃîé ññûëêè â ëîêà ëüÃîé ïåðåìåÃÃîé 3}
1990 if (strcmp(yytext, "iastore") == 0) return 0x4F; // ñîõðà ÃÃ¥Ãèå â öåëî÷èñëåÃÃîì ìà ññèâå}
1991 if (strcmp(yytext, "lastore") == 0) return 0x50; // ñîõðà ÃÃ¥Ãèå â ìà ññèâå èç äëèÃÃûõ öåëûõ}
1992 if (strcmp(yytext, "fastore") == 0) return 0x51; // ñîõðà ÃÃ¥Ãèå â ìà ññèâå èç îäèÃà ðÃûõ âåùåñòâåÃÃûõ}
1993 if (strcmp(yytext, "dastore") == 0) return 0x52; // ñîõðà ÃÃ¥Ãèå â ìà ññèâå èç äâîéÃûõ âåùåñòâåÃÃûõ}
1994 if (strcmp(yytext, "aastore") == 0) return 0x53; // ñîõðà ÃÃ¥Ãèå â ìà ññèâå èç îáúåêòÃûõ ññûëîê}
1995 if (strcmp(yytext, "bastore") == 0) return 0x54; // ñîõðà ÃÃ¥Ãèå â ìà ññèâå áà éòîâ ñî çÃà êîì}
1996 if (strcmp(yytext, "castore") == 0) return 0x55; // ñîõðà ÃÃ¥Ãèå â ñèìâîëüÃîì ìà ññèâå}
1997 if (strcmp(yytext, "sastore") == 0) return 0x56; // ñîõðà ÃÃ¥Ãèå â ìà ññèâå èç êîðîòêèõ öåëûõ}
1998 if (strcmp(yytext, "pop") == 0) return 0x57; // èçâëå÷åÃèå ñëîâà ñ âåðøèÃû ñòåêà }
1999 if (strcmp(yytext, "pop2") == 0) return 0x58; // èçâëå÷åÃèå äâóõ ñëîâ ñ âåðøèÃû ñòåêà }
2000 if (strcmp(yytext, "dup") == 0) return 0x59; // äóáëèðîâà Ãèå ñëîâà Ãà âåðøèÃÃ¥ ñòåêà }
2001 if (strcmp(yytext, "dup_x1") == 0) return 0x5A; // äóáëèðîâà Ãèå ñëîâî Ãà âåðøèÃÃ¥ ñòåêà è ïîìåùåÃèå êîïèè â ñòåê Ãà äâà ñëîâà Ãèæå}
2002 if (strcmp(yytext, "dup_x2") == 0) return 0x5B; // äóáëèðîâà Ãèå âåðøèÃû ñòåêà è ïîìåùåÃèå êîïèè Ãà òðè ñëîâà Ãèæå}
2003 if (strcmp(yytext, "dup2") == 0) return 0x5C; // äóáëèðîâà Ãèå äâóõ ñëîâ Ãà âåðøèÃÃ¥ ñòåêà }
2004 if (strcmp(yytext, "dup2_x1") == 0) return 0x5D; // äóáëèðîâà Ãèå äâóõ ñëîâ Ãà âåðøèÃÃ¥ ñòåêà è ïîìåùåÃèå êîïèé Ãà äâà ñëîâà Ãèæå}
2005 if (strcmp(yytext, "dup2_x2") == 0) return 0x5E; // äóáëèðîâà Ãèå äâóõ ñëîâ Ãà âåðøèÃÃ¥ ñòåêà è ïîìåùåÃèå êîïèé Ãà òðè ñëîâà Ãèæå}
2006 if (strcmp(yytext, "swap") == 0) return 0x5F; // îáìåà äâóõ ñëîâ Ãà âåðøèÃÃ¥ ñòåêà }
2009 if (strcmp(yytext, "fadd") == 0) return 0x62; // ñëîæåÃèå îäèÃà ðÃûõ âåùåñòâåÃÃûõ}
2010 if (strcmp(yytext, "dadd") == 0) return 0x63; // ñëîæåÃèå äâîéÃûõ âåùåñòâåÃÃûõ}
2013 if (strcmp(yytext, "fsub") == 0) return 0x66; // âû÷èòà Ãèå îäèÃà ðÃûõ âåùåñòâåÃÃûõ}
2014 if (strcmp(yytext, "dsub") == 0) return 0x67; // âû÷èòà Ãèå äâîéÃûõ âåùåñòâåÃÃûõ}
2017 if (strcmp(yytext, "fmul") == 0) return 0x6A; // óìÃîæåÃèå îäèÃà ðÃûõ âåùåñòâåÃÃûõ}
2018 if (strcmp(yytext, "dmul") == 0) return 0x6B; // óìÃîæåÃèå äâîéÃûõ âåùåñòâåÃÃûõ}
2021 if (strcmp(yytext, "fdiv") == 0) return 0x6E; // äåëåÃèå îäèÃà ðÃûõ âåùåñòâåÃÃûõ}
2022 if (strcmp(yytext, "ddiv") == 0) return 0x6F; // äåëåÃèå äâîéÃûõ âåùåñòâåÃÃûõ}
2023 if (strcmp(yytext, "irem") == 0) return 0x70; // îñòà òîê îò äåëåÃèÿ öåëûõ}
2024 if (strcmp(yytext, "lrem") == 0) return 0x71; // îñòà òîê îò äåëåÃèÿ äëèÃÃûõ öåëûõ}
2025 if (strcmp(yytext, "frem") == 0) return 0x72; // îñòà òîê îò äåëåÃèÿ îäèÃà ðÃûõ âåùåñòâåÃÃûõ}
2026 if (strcmp(yytext, "drem") == 0) return 0x73; // îñòà òîê îò äåëåÃèÿ äâîéÃûõ âåùåñòâåÃÃûõ}
2028 if (strcmp(yytext, "leg") == 0) return 0x75; // îòðèöà Ãèå äëèÃÃîãî öåëîãî}
2029 if (strcmp(yytext, "fneg") == 0) return 0x76; // îòðèöà Ãèå îäèÃà ðÃîãî âåùåñòâåÃÃîãî}
2030 if (strcmp(yytext, "dneg") == 0) return 0x77; // îòðèöà Ãèå äâîéÃîãî âåùåñòâåÃÃîãî ÷èñëà }
2032 if (strcmp(yytext, "lshl") == 0) return 0x79; // ñäâèã äëèÃÃîãî öåëîãî âëåâî}
2033 if (strcmp(yytext, "ishr") == 0) return 0x7A; // à ðèôìåòè÷åñêèé ñäâèã öåëîãî âïðà âî}
2034 if (strcmp(yytext, "lshr") == 0) return 0x7B; // à ðèôìåòè÷åñêèé ñäâèã äëèÃÃîãî öåëîãî âïðà âî}
2035 if (strcmp(yytext, "iushr") == 0) return 0x7C; // ëîãè÷åñêèé ñäâèã öåëîãî âïðà âî}
2036 if (strcmp(yytext, "lushr") == 0) return 0x7D; // ëîãè÷åñêèé ñäâèã äëèÃÃîãî öåëîãî âïðà âî}
2037 if (strcmp(yytext, "iand") == 0) return 0x7E; // ëîãè÷åñêîå È ñ îïåðà Ãäà ìè öåëîãî òèïà }
2038 if (strcmp(yytext, "land") == 0) return 0x7F; // ëîãè÷åñêîå È ñ îïåðà Ãäà ìè äëèÃÃîãî öåëîãî òèïà }
2039 if (strcmp(yytext, "ior") == 0) return 0x80; // ëîãè÷åñêîå ÈËÈ ñ öåëî÷èñëåÃÃûìè îïåðà Ãäà ìè}
2040 if (strcmp(yytext, "lor") == 0) return 0x81; // ëîãè÷åñêîå ÈËÈ ñ îïåðà Ãäà ìè äëèÃÃîãî öåëîãî òèïà }
2041 if (strcmp(yytext, "ixor") == 0) return 0x82; // èñêëþ÷à þùåå ÈËÈ ñ öåëî÷èñëåÃÃûìè îïåðà Ãäà ìè}
2042 if (strcmp(yytext, "lxor") == 0) return 0x83; // èñêëþ÷à þùåå ÈËÈ ñ îïåðà Ãäà ìè äëèÃÃîãî öåëîãî òèïà }
2043 if (strcmp(yytext, "iinc") == 0) return 0x84; // [1,1+-]óâåëè÷åÃèå ëîêà ëüÃîé ïåðåìåÃÃîé Ãà êîÃñòà Ãòó}
2044 if (strcmp(yytext, "i2l") == 0) return 0x85; // ïðåîáðà çîâà Ãèå öåëîãî â äëèÃÃîå öåëîå}
2046 if (strcmp(yytext, "i2d") == 0) return 0x87; // öåëîå â äâîéÃîå âåùåñòâåÃÃîå}
2048 if (strcmp(yytext, "l2f") == 0) return 0x89; // äëèÃÃîå öåëîå â âåùåñòâåÃÃîå}
2049 if (strcmp(yytext, "l2d") == 0) return 0x8A; // äëèÃÃîå öåëîå â äâîéÃîå âåùåñòâåÃÃîå}
2051 if (strcmp(yytext, "f2l") == 0) return 0x8C; // âåùåñòâåÃÃîå â äëèÃÃîå öåëîå}
2052 if (strcmp(yytext, "f2d") == 0) return 0x8D; // âåùåñòâåÃÃîå â äâîéÃîå âåùåñòâåÃÃîå}
2053 if (strcmp(yytext, "d2i") == 0) return 0x8E; // äâîéÃîå âåùåñòâåÃÃîå â öåëîå}
2054 if (strcmp(yytext, "d2l") == 0) return 0x8F; // äâîéÃîå âåùåñòâåÃÃîå â äëèÃÃîå öåëîå}
2055 if (strcmp(yytext, "d2f") == 0) return 0x90; // äâîéÃîå âåùåñòâåÃÃîå â âåùåñòâåÃÃîå}
2060 if (strcmp(yytext, "fcmpl") == 0) return 0x95; // ñðà âÃÃ¥Ãèå âåùåñòâåÃÃûõ îäèÃà ðÃîé òî÷Ãîñòè (-1 ïðè NaN)}
2061 if (strcmp(yytext, "fcmpg") == 0) return 0x96; // ñðà âÃÃ¥Ãèå âåùåñòâåÃÃûõ îäèÃà ðÃîé òî÷Ãîñòè (1 ïðè NaN)}
2062 if (strcmp(yytext, "dcmpl") == 0) return 0x97; // ñðà âÃÃ¥Ãèå âåùåñòâåÃÃûõ äâîéÃîé òî÷Ãîñòè(-1 ïðè NaN)}
2063 if (strcmp(yytext, "dcmpg") == 0) return 0x98; // ñðà âÃÃ¥Ãèå âåùåñòâåÃÃûõ äâîéÃîé òî÷Ãîñòè(1 ïðè NaN)}
2065 if (strcmp(yytext, "ifne") == 0) return 0x9A; // [2]ïåðåõîä, åñëè ÃÃ¥ ðà âÃî 0}
2067 if (strcmp(yytext, "ifge") == 0) return 0x9C; // [2]ïåðåõîä, åñëè áîëüøå èëè ðà âÃî 0}
2069 if (strcmp(yytext, "ifle") == 0) return 0x9E; // [2]ïåðåõîä, åñëè ìåÃüøå èëè ðà âÃî 0}
2070 if (strcmp(yytext, "if_icmpeq") == 0) return 0x9F; // [2]ïåðåõîä, åñëè öåëûå ðà âÃû}
2071 if (strcmp(yytext, "if_icmpne") == 0) return 0xA0; // [2]ïåðåõîä, åñëè öåëûå ÃÃ¥ ðà âÃû}
2072 if (strcmp(yytext, "if_icmplt") == 0) return 0xA1; // [2]ïåðåõîä, åñëè öåëîå ìåÃüøå 0}
2073 if (strcmp(yytext, "if_icmpge") == 0) return 0xA2; // [2]ïåðåõîä, åñëè öåëîå áîëüøå èëè ðà âÃî}
2074 if (strcmp(yytext, "if_icmpgt") == 0) return 0xA3; // [2]ïåðåõîä, åñëè öåëîå áîëüøå 0}
2075 if (strcmp(yytext, "if_icmple") == 0) return 0xA4; // [2]ïåðåõîä, åñëè öåëîå ìåÃüøå èëè ðà âÃî}
2076 if (strcmp(yytext, "if_acmpeq") == 0) return 0xA5; // [2]ïåðåõîä, åñëè ññûëêè Ãà îáúåêò ðà âÃû}
2077 if (strcmp(yytext, "if_acmpne") == 0) return 0xA6; // [2]ïåðåõîä, åñëè ññûëêè Ãà îáúåêò ÃÃ¥ ðà âÃû}
2079 if (strcmp(yytext, "jsr") == 0) return 0xA8; // [2]ïåðåõîä Ãà ïîäïðîãðà ììó}
2080 if (strcmp(yytext, "ret") == 0) return 0xA9; // [1]âîçâðà ò èç ïîäïðîãðà ììû}
2081 if (strcmp(yytext, "tableswitch") == 0) return 0xAA; // [tbs] äîñòóï ê òà áëèöå ïåðåõîäà ïî èÃäåêñó è ïåðåõîä}
2082 if (strcmp(yytext, "lookupswitch") == 0) return 0xAB; // [lks] äîñòóï ê òà áëèöå ïåðåõîäà ïî ñðà âÃÃ¥Ãèþ ñ êëþ÷îì è ïåðåõîä}
2083 if (strcmp(yytext, "ireturn") == 0) return 0xAC; // âîçâðà ò öåëîãî çÃà ÷åÃèÿ ôóÃêöèè}
2084 if (strcmp(yytext, "lreturn") == 0) return 0xAD; // âîçâðà ò äëèÃÃîãî öåëîãî çÃà ÷åÃèÿ ôóÃêöèè}
2085 if (strcmp(yytext, "freturn") == 0) return 0xAE; // âîçâðà ò îäèÃà ðÃîãî âåùåñòâåÃÃîãî çÃà ÷åÃèÿ ôóÃêöèè}
2086 if (strcmp(yytext, "dreturn") == 0) return 0xAF; // âîçâðà ò äâîéÃîãî âåùåñòâåÃÃîãî çÃà ÷åÃèÿ ôóÃêöèè}
2087 if (strcmp(yytext, "areturn") == 0) return 0xB0; // âîçâðà ò îáúåêòÃîé ññûëêè èç ôóÃêöèè}
2088 if (strcmp(yytext, "return") == 0) return 0xB1; // âîçâðà ò(îïóñòîøà þùèé) èç ïðîöåäóðû}
2089 if (strcmp(yytext, "getstatic") == 0) return 0xB2; // [2fld]ïîëó÷åÃèå ñòà òè÷åñêîãî ïîëÿ êëà ññà }
2090 if (strcmp(yytext, "putstatic") == 0) return 0xB3; // [2fld]óñòà Ãîâêà ñòà òè÷åñêîãî ïîëÿ â êëà ññå}
2091 if (strcmp(yytext, "getfield") == 0) return 0xB4; // [2fld]ïåðåÃîñ ïîëÿ èç îáúåêòà }
2092 if (strcmp(yytext, "putfield") == 0) return 0xB5; // [2fld]óñòà Ãîâêà ïîëÿ â îáúåêòå}
2093 if (strcmp(yytext, "invokevirtual") == 0) return 0xB6; // [2mtd],âûçûâà åò ìåòîä ýêçåìïëÿðà , îñÃîâûâà ÿñü Ãà òèïå âðåìåÃè âûïîëÃÃ¥Ãèÿ}
2094 if (strcmp(yytext, "invokenonvirtual") == 0) return 0xB7; // [2mtd],âûçûâà åò ìåòîä ýêçåìïëÿðà , îñÃîâûâà ÿñü Ãà ÃÃ¥ âèðòóà ëüÃîì òèïå}
2095 if (strcmp(yytext, "invokestatic") == 0) return 0xB8; // [2mtd]âûçîâ ìåòîäà êëà ññà (ñòà òè÷åñêîãî ìåòîäà )}
2096 if (strcmp(yytext, "invokeinterface") == 0) return 0xB9; // [2,1,1]âûçûâà åò ìåòîä èÃòåðôåéñà }
2098 if (strcmp(yytext, "newarray") == 0) return 0xBC; // [1]atype> T_BOOLEAN=4,T_CHAR=5,T_FLOAT=6,T_DOUBLE=7,T_BYTE=8, T_SHORT=9,T_INT=9,T_LONG=11}
2099 if (strcmp(yytext, "anewarray") == 0) return 0xBD; // [2class]îáúÿâëåÃèå Ãîâîãî ìà ññèâà èç ññûëîê Ãà îáúåêòû}
2100 if (strcmp(yytext, "arraylength") == 0) return 0xBE; // âîçâðà ùà åò äëèÃó ìà ññèâà }
2101 if (strcmp(yytext, "athrow") == 0) return 0xBF; // ãåÃåðà öèÿ îáðà áîòêè èëè îøèáêè}
2102 if (strcmp(yytext, "checkcast") == 0) return 0xC0; // cs 2,ïðîâåðÿåò, ÷òî îáúåêò èìååò äà ÃÃûé òèï}
2103 if (strcmp(yytext, "instanceof") == 0) return 0xC1; // [2class]îïðåäåëÿåò, èìååò ëè îáúåêò äà ÃÃûé òèï}
2104 if (strcmp(yytext, "monitorenter") == 0) return 0xC2; // âõîä â êîÃòðîëèðóåìóþ îáëà ñòü êîäà }
2105 if (strcmp(yytext, "monitorexit") == 0) return 0xC3; // âûõîä èç êîÃòðîëèðóåìîé îáëà ñòè êîäà }
2106 if (strcmp(yytext, "wide") == 0) return 0xC4; // ðà ñøèðåÃÃûé èÃäåêñ äëÿ äîñòóïà ê ëîêà ëüÃûì ïåðåìåÃÃûì äëÿ êîìà Ãä çà ãðóçêè, ñîõðà ÃÃ¥Ãèÿ è ïðèðà ùåÃè}
2107 if (strcmp(yytext, "multianewarray") == 0) return 0xC5; // [2cp-index,1b]ðà çìåùåÃèå Ãîâîãî ìÃîãîìåðÃîãî ìà ññèâà }
2108 if (strcmp(yytext, "ifnull") == 0) return 0xC6; // [2ofs]ïåðåõîä, åñëè ïóñòîé óêà çà òåëü}
2109 if (strcmp(yytext, "ifnonnull") == 0) return 0xC7; // [2ofs]ïåðåõîä, åñëè ÃÃ¥ ïóñòîé óêà çà òåëü}
2110 if (strcmp(yytext, "goto_w") == 0) return 0xC8; // [4ofs]ïåðåõîä Ãà (ðà ñøèðåÃÃûé èÃäåêñ)}
2111 if (strcmp(yytext, "jsr_w") == 0) return 0xC9; // [4ofs]ïåðåõîä Ãà ïîäïðîãðà ììó (ðà ñøèðåÃÃûé èÃäåêñ)}
2112 if (strcmp(yytext, "breakpoint") == 0) return 0xCA; // îñòà Ãîâêà è ïåðåäà ÷à êîÃòðîëÿ îáðà áîò÷èêó ïðåðûâà Ãèé}
2113 if (strcmp(yytext, "ret_w") == 0) return 0xD1; // [2]âîçâðà ò èç ïîäïðîãðà ììû (ðà ñøèðåÃÃûé èÃäåêñ)}
2115 //0x10,0xBC 1b;
2116 //0x11 2b+-;
2117 //0x12 1b constpool-index;
2118 //0x13 2b constpool-index(2byte-const);
2119 //0x14 2b constpool-index(4byte-const);
2120 //0xB2,0xB3,0xB4,0xB5 2b constpool-field;
2121 //0xB6,0xB7,0xB8 2b constpool-method;
2122 //0xB9 2b constpool-method; 1b; 1b;
2123 //0xBB 2b constpool-index;
2124 //0xC5 2b constpool-index; 1b;
2125 //0xBD,0xC1 2b constpool-class;
2126 //0xC0 2b constpool-string;
2127 //0x15,0x16,0x17,0x18,0x19 1b locvar-index;
2128 //0x36,0x37,0x38,0x39,0x3A 1b locvar-index;
2129 //0x84 1b; 1b+-(locvar-add-const);
2130 //0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xC6,0xC7 2b offs;
2131 //0xC8 4b offs;
2132 //0xC9 4b call;
2133 //0xA8 2b call;
2134 //0xA9 1b ret;
2135 //0xD1 2b ret;
2136 //0xC4 wide...;
2137 //0xAA tableswitch...;
2138 //0xAB loookupswitch...;
2139 //îñòà ëüÃûå êîäû ïà ðà ìåòðîâ ÃÃ¥ èìåþò...
2140 }
2143 { //ðà çáîð ìîäèôèêà öèé ññûëîê Ãà ïà ðà ìåòðû êîÃñòà ÃòÃîãî ïóëÃ
2147 {
2149 {
2152 }
2154 {
2157 }
2159 {
2162 }
2164 {
2167 }
2169 {
2172 {
2176 {
2178 if ((current_token == CST_STRING)||(current_token == CST_CHAR)) return cp_add_nameandtype(p1, yytext);
2179 }
2180 }
2182 {
2185 {
2189 {
2192 {
2196 {
2198 if ((current_token == CST_STRING)||(current_token == CST_CHAR)) return cp_add_fieldref(p1,p2,yytext);
2199 }
2200 }
2201 }
2202 }
2203 }
2205 {
2208 {
2212 {
2215 {
2219 {
2221 if ((current_token == CST_STRING)||(current_token == CST_CHAR)) return cp_add_methodref(p1,p2,yytext);
2222 }
2223 }
2224 }
2225 }
2226 }
2227 }
2229 {
2232 {
2236 {
2239 {
2243 {
2245 if ((current_token == CST_STRING)||(current_token == CST_CHAR)) return cp_add_interface(p1,p2,yytext);
2246 }
2247 }
2248 }
2249 }
2250 }
2252 }
2256 {
2260 {
2263 {
2271 //add find block
2272 labcount++;
2277 }
2278 }
2280 }
2284 {
2291 {
2294 ///////
2296 {
2313 {
2316 }
2322 {
2326 {
2329 {
2332 }
2333 }
2334 }
2340 {
2343 }
2368 {
2370 {
2373 }
2374 }
2375 //current_token = yylex();
2376 //if ((current_token == CST_INTEGER) && (integer_constant>=0) && (integer_constant<=65535))
2377 //{
2378 // bytecode_append_short_int(current_block->code, (short)integer_constant);
2379 // err=0;
2380 //}
2388 {
2391 }
2392 //current_token = yylex();
2393 //if (current_token == CST_INTEGER)
2394 //{
2395 // bytecode_append_long_int(current_block->code, integer_constant);
2396 // err=0;
2397 //}
2404 {
2407 }
2414 {
2417 }
2424 {
2428 {
2431 {
2433 {
2436 }
2437 }
2438 }
2439 }
2446 {
2449 {
2452 }
2453 }
2459 {
2462 {
2465 }
2466 }
2472 //if ((current_token == IDENTIFIER) && (strcmp(yytext, "int") == 0))
2473 //{
2476 {
2479 }
2480 //}
2489 {
2492 {
2495 }
2496 }
2504 {
2507 {
2510 }
2511 }
2517 {
2520 {
2524 {
2528 {
2532 {
2535 {
2537 {
2540 }
2541 }
2542 }
2543 }
2544 }
2545 }
2546 }
2547 }
2550 {
2557 {
2561 {
2564 {
2569 {
2572 {
2573 bytecode_append_long_int(current_block->code, integer_constant); //high-index Length=high-low+1
2577 {
2580 {
2583 {
2586 }
2588 {
2592 }
2594 }
2595 }
2596 }
2597 }
2598 }
2599 }
2600 }
2601 }
2605 {
2612 {
2616 {
2619 {
2624 {
2627 {
2631 {
2635 {
2638 }
2639 }
2641 {
2645 }
2647 }
2648 }
2649 }
2650 }
2651 }
2652 }
2654 /*
2655 case 0xC4: //wide;
2656 break;
2657 */
2661 }
2662 }
2664 {
2666 else if (integer_constant<=65535) bytecode_append_short_int(current_block->code, (short)integer_constant);
2669 }
2671 {
2675 {
2681 {
2682 labcount++;
2687 }
2688 else
2689 {
2692 }
2694 }
2695 }
2697 /////////
2699 {
2702 }
2704 //modify old label
2706 {
2709 {
2716 {
2719 }
2720 }
2722 }
2723 }
2724 ///////////////////////////////////////////////////////////////////////////////////////////////////
2725 //////////////////////////////////// END JAVA - ASM ///////////////////////////////////////////////
2726 ///////////////////////////////////////////////////////////////////////////////////////////////////
2731 /*
2732 Handles the if-then-[else] statement. The grammar rule
2733 is:
2735 <RD_if_statement> -> <RD_expression> then <RD_statement>
2736 [ else <RD_statement> ]
2738 */
2740 {
2749 {
2751 }
2756 {
2758 }
2762 /* generate the code */
2774 {
2775 /* set the address of the next instruction */
2789 /* set the adress of the next instruction */
2793 }
2794 else
2795 {
2799 /* set the address of the next instruction */
2804 /* put the current token back to stream and preceed it with ';' */
2813 }
2814 }
2816 /*
2817 The case-of statement. The rule used is:
2819 <RD_case_statement> -> <RD_expression> OF
2820 <RD_case_list> end
2821 */
2823 {
2833 {
2835 }
2838 {
2840 }
2847 {
2849 }
2853 }
2856 /*
2857 The case expression's list.
2859 <RD_case_list> -> ( CONST (, CONST)* : <RD_statement> )+
2860 */
2862 {
2865 do
2866 {
2869 else
2873 {
2875 {
2877 {
2882 }
2885 }
2888 {
2896 }
2899 {
2908 }
2911 {
2913 {
2918 }
2921 }
2924 {
2926 {
2931 }
2934 }
2937 {
2938 /* find the constant type for the given identifier */
2945 else
2947 {
2954 add_error_message(409, string_get_cstr(expected_type_name), string_get_cstr(constant_type_name));
2958 }
2964 }
2967 {
2970 /* Error-recovery: find the first : */
2973 {
2975 }
2981 }
2982 }
2990 {
2993 /* Error-recovery: find the first : */
2996 {
2998 }
3002 }
3007 }
3010 /*
3011 The while-do statement.
3013 <RD_while_statement> -> <RD_expression> do <RD_statement>
3014 */
3016 {
3034 {
3036 }
3041 {
3043 }
3044 else
3047 inside_loop++;
3051 inside_loop --;
3060 transform_break_stmts(current_block->code, break_pos1, break_pos2, current_block->code->bytecode_pos);
3061 }
3064 // j-a-s-d: besides
3065 //
3066 // current_token = yylex();
3067 //
3068 // bytecode_append(current_block->code, goto$);
3069 // bytecode_append_short_int(current_block->code, pos1 - current_block->code->bytecode_pos + 1);
3070 //
3071 // transform_break_stmts(current_block->code, break_pos1, break_pos2, current_block->code->bytecode_pos);
3072 //
3073 // is the exact implementation of forever,
3074 // the lesser impact implementation of repeat/forever to this MP compiler seems to be an "until false"
3077 {
3084 }
3086 /*
3087 The repeat-until statement.
3089 <RD_repeat_statement> -> <RD_block_body> until <RD_expression>
3090 */
3093 {
3100 inside_loop ++;
3104 inside_loop --;
3107 {
3111 {
3113 }
3118 }
3119 /* generate the code */
3125 {
3127 }
3129 transform_break_stmts(current_block->code, break_pos1, break_pos2, current_block->code->bytecode_pos);
3132 }
3136 /*
3137 The for statement.
3139 <RD_for_statement> -> IDN := <RD_expression> (to | downto)
3140 <RD_expression> do <RD_statement>
3141 */
3143 {
3160 {
3164 }
3168 {
3170 }
3173 {
3176 /* Error-recovery: find the first := */
3179 {
3181 }
3184 {
3188 }
3189 }
3190 else
3194 {
3196 }
3197 else
3206 {
3215 }
3218 {
3220 {
3224 }
3227 {
3231 }
3234 {
3237 }
3238 }
3243 create_variable_bytecode(iterator, current_block->code, iterator_name->cstr, iterator->belongs_to_program_block);
3248 else
3254 {
3263 }
3266 {
3268 }
3269 else
3272 inside_loop ++;
3276 inside_loop --;
3279 // TODO:: moguca optimizacija za neke slucajeve sa iinc$ naredbom
3280 create_variable_bytecode(iterator, current_block->code, iterator_name->cstr, iterator->belongs_to_program_block);
3284 else
3289 create_put_variable_bytecode(iterator, current_block->code, iterator_name->cstr, iterator->belongs_to_program_block);
3292 bytecode_append_short_int(current_block->code, evaluate_pos - current_block->code->bytecode_pos + 1);
3294 current_block->code->bytecode[check_bytecode_pos + 1] = (char) ((current_block->code->bytecode_pos - check_bytecode_pos)>>8);
3295 current_block->code->bytecode[check_bytecode_pos + 2] = (char) (current_block->code->bytecode_pos - check_bytecode_pos);
3298 transform_break_stmts(current_block->code, break_pos1, break_pos2, current_block->code->bytecode_pos);
3304 }
3307 /*
3308 Type declaration:
3310 <RD_type> -> <RD_basic_type>
3311 | [packed] array <RD_array_declaration>
3312 | record <RD_record_declaration>
3313 | file <RD_file_declaration>
3314 | set <RD_set_declaration> currently unsupported !!!
3315 */
3317 {
3319 {
3321 {
3326 //no_break;
3327 }
3330 {
3333 }
3336 {
3339 }
3342 {
3345 }
3348 {
3356 }
3359 {
3362 }
3363 }
3364 }
3367 /*
3368 Basic type:
3370 <RD_basic_type> -> [IDN .] IDN
3371 | CONST .. CONST
3372 | "(" IDN (, IDN)* ")" enumerated types are not supported
3373 */
3375 {
3381 {
3383 {
3393 {
3400 else
3407 else
3409 }
3414 {
3419 }
3420 else
3421 {
3430 {
3436 else
3446 {
3449 /* Error-recovery */
3454 {
3456 }
3459 }
3464 {
3469 {
3471 }
3472 else
3473 {
3476 else
3478 }
3481 }
3483 {
3488 }
3490 {
3495 }
3496 else
3497 {
3499 }
3503 }
3504 else
3505 {
3509 }
3510 }
3515 }
3519 {
3523 {
3526 }
3527 else
3528 {
3531 }
3538 {
3540 }
3547 {
3549 }
3550 else
3551 {
3553 {
3560 {
3562 }
3569 {
3571 }
3572 else
3573 {
3576 else
3578 }
3582 }
3584 {
3586 }
3587 else
3588 {
3590 }
3591 }
3596 }
3599 {
3604 {
3608 brack_count ++;
3611 brack_count --;
3615 }
3620 }
3623 {
3629 {
3631 }
3634 }
3635 }
3638 }
3641 /*
3642 The declaration of an array.
3644 <RD_array_declaration> -> "[" (<RD_basic_type> (, <RD_basic_type>)* )+ "]" of <RD_type>
3645 */
3647 {
3657 {
3659 }
3661 do
3662 {
3668 {
3670 }
3677 {
3679 }
3682 {
3688 }
3695 {
3697 }
3704 }
3707 /*
3708 The declaration of a record.
3710 <RD_record_declaration> -> <RD_identifier_list> ":" <RD_type>
3711 ( <RD_identifier_list> ":" <RD_type> )* end
3712 */
3714 {
3728 next_record_ID ++;
3730 do
3731 {
3734 else
3744 {
3746 }
3754 {
3757 }
3772 {
3774 }
3781 }
3784 /*
3785 The declaration of a file
3787 <RD_file_declaration> -> of IDN
3788 */
3790 {
3795 {
3797 }
3800 // !!!! TODO:: dodati podrsku za fajlove
3804 }
3807 /*
3808 Sets are not supported yet, however, this rule is used
3809 as an error-recovery rule if someone tries to use sets.
3811 <RD_set_declaration> -> of <RD_basic_type>
3812 */
3814 {
3818 }
3821 /*
3822 Handle the expressions, the relational operators.
3824 <RD_expression> -> <RD_sum> [<rel_operator> <RD_sum>]
3825 */
3827 {
3840 {
3854 {
3857 }
3858 else
3859 {
3866 }
3868 /* if operands need to be casted */
3871 {
3873 {
3880 {
3883 }
3884 else
3885 {
3892 }
3896 }
3898 }
3899 else
3900 {
3902 {
3908 /* string cast */
3914 }
3915 }
3918 {
3923 }
3925 /* create the code */
3930 {
3935 {
3954 }
3956 /* create the rest of the jumping and setting the whatever code */
3962 }
3965 {
3970 {
3972 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "lessThan", "(LReal;)Z"));
3975 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "lessEqual", "(LReal;)Z"));
3978 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "greaterEqual", "(LReal;)Z"));
3981 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "greaterThan", "(LReal;)Z"));
3984 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "equalTo", "(LReal;)Z"));
3987 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "notEqualTo", "(LReal;)Z"));
3989 }
3991 /* create the rest of the jumping and setting the whatever code */
3998 }
4001 {
4003 {
4005 }
4007 {
4009 }
4010 else
4011 {
4014 }
4016 /* create the rest of the jumping and setting the whatever code */
4022 }
4024 }
4027 {
4033 {
4052 }
4054 /* create the rest of the jumping and setting the whatever code */
4060 }
4064 /* the type of comparison is boolean */
4067 }
4070 }
4073 /*
4074 Handle +, -, or, xor operators.
4076 <RD_sum> -> <RD_mult> (<sum_operator> <RD_mult>)*
4077 */
4079 {
4091 {
4108 {
4111 }
4112 else
4113 {
4116 /* if first type is char, cast it to string */
4118 {
4127 }
4134 }
4136 /* if operands need to be casted */
4139 {
4146 {
4149 }
4150 else
4151 {
4158 }
4165 {
4170 }
4172 }
4173 }
4180 {
4183 }
4185 /* create the code */
4189 {
4194 {
4207 }
4208 }
4211 {
4214 {
4220 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "<init>", "(LReal;)V"));
4229 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "<init>", "(LReal;)V"));
4237 }
4240 {
4246 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "<init>", "(LReal;)V"));
4255 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "<init>", "(LReal;)V"));
4263 }
4264 }
4268 {
4276 {
4280 {
4282 bytecode_append_short_int(current_block->code, cp_add_methodref("F", "tS", "(I)Ljava/lang/String;"));
4283 }
4284 else
4285 {
4287 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "toString", "()Ljava/lang/String;"));
4288 }
4289 }
4293 append_index = cp_add_methodref("java/lang/StringBuffer", "append", "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
4294 toString_index = cp_add_methodref("java/lang/StringBuffer", "toString", "()Ljava/lang/String;");
4297 {
4300 append2_index = cp_add_methodref("java/lang/StringBuffer", "append", "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
4303 append2_index = cp_add_methodref("java/lang/StringBuffer", "append", "(I)Ljava/lang/StringBuffer;");
4307 append2_index = cp_add_methodref("java/lang/StringBuffer", "append", "(C)Ljava/lang/StringBuffer;");
4311 append2_index = cp_add_methodref("java/lang/StringBuffer", "append", "(Z)Ljava/lang/StringBuffer;");
4315 }
4319 /* create new string buffer */
4326 /* append the first argument */
4331 /* append the second argument */
4337 /* convert StringBuffer into the String */
4344 }
4346 }
4349 }
4352 /*
4353 Handle * / div mod and operators.
4355 <RD_mult> -> <RD_not> (<mult_operator> <RD_not>)*
4356 */
4358 {
4373 {
4386 {
4389 }
4390 else
4391 {
4398 }
4401 {
4402 /* if operands need to be casted */
4409 {
4412 }
4413 else
4414 {
4421 }
4427 {
4432 }
4433 }
4434 }
4441 {
4444 }
4448 {
4451 }
4453 /* generate the code */
4455 {
4457 {
4471 ///////////
4478 // j-a-s-d
4482 }
4483 }
4486 {
4489 {
4491 {
4493 {
4497 }
4498 else
4499 {
4505 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "<init>", "(LReal;)V"));
4514 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "<init>", "(LReal;)V"));
4521 }
4522 }
4525 {
4527 {
4531 }
4532 else
4533 {
4539 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "<init>", "(LReal;)V"));
4548 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "<init>", "(LReal;)V"));
4555 }
4556 }
4558 }
4559 }
4563 {
4565 }
4566 }
4569 }
4572 /*
4573 The not operator.
4575 <RD_not> -> [not] <RD_neg>
4576 */
4578 {
4584 {
4587 }
4593 /* generate the code */
4595 {
4598 }
4604 {
4607 }
4610 }
4613 /*
4614 The - sign operator.
4616 <RD_neg> -> ["-"] <RD_value>
4617 */
4619 {
4625 {
4628 }
4634 /* generate the code */
4636 {
4642 {
4650 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "<init>", "(LReal;)V"));
4654 }
4655 }
4661 {
4664 }
4667 }
4670 /*
4671 The expression that calls a procedure or
4672 assigns a value to a variable.
4674 <RD_assignment_or_procedure_call>
4676 -> IDN ["[" <RD_expression_list> "]" ] (. IDN ["[" <RD_expression_list> "]" ])* := <RD_expression>
4677 -> IDN ["(" <RD_expression_list> ")"]
4679 */
4681 {
4688 {
4692 }
4696 {
4702 }
4706 }
4711 {
4714 /* Error-recovery: find the first ";", end, "." or <<EOF>> */
4719 {
4721 }
4725 }
4732 {
4739 }
4744 {
4748 {
4753 }
4763 {
4769 }
4780 }
4783 /* the name belongs to a procedure */
4785 {
4786 procedure_call:
4788 {
4790 }
4793 {
4796 {
4800 {
4803 {
4807 }
4812 br_depth ++;
4815 br_depth --;
4816 }
4819 }
4820 }
4821 else
4822 {
4824 {
4826 }
4827 else
4828 {
4843 }
4846 {
4851 }
4856 {
4858 }
4859 else
4861 }
4862 }
4864 /* create the bytecode */
4866 {
4867 /* the procedure is user-defined */
4879 {
4884 }
4885 else
4886 {
4888 }
4894 {
4901 }
4904 pos ++;
4909 else
4915 {
4920 else
4925 }
4926 else
4927 {
4930 else
4931 methodref_index = cp_add_methodref(string_get_cstr(str_program_name), element_name->cstr, descriptor);
4932 }
4937 }
4938 else
4939 {
4940 /* handle standard functions and procedures */
4942 }
4943 }
4945 /* if the identifier is the function name and that is not the name of the current
4946 block, report an error */
4948 {
4950 {
4952 }
4953 }
4955 /* if an identifier is a valid l-value */
4958 || (name->identifier_class == function_name)) /* function names are treated as variables for return values */
4959 {
4967 variable_lvalue:
4981 /* create the get and put bytecodes */
4996 {
5000 {
5006 }
5009 {
5016 /* append the old get bytecode */
5019 /* reset the bytecodes */
5024 {
5027 /* Error-recovery */
5031 {
5033 }
5039 }
5044 {
5046 }
5047 else
5048 {
5049 /* create the new put and get bytecodes */
5064 }
5068 {
5071 /* Error-recovery */
5075 {
5077 }
5083 }
5086 }
5088 {
5093 // ako je [, a zadnji je array, procitaj listu, usporedi, vrati slijedeci, skoci gore
5095 {
5098 /* Error-recovery */
5102 {
5104 }
5110 }
5117 //bytecode_append_bytecode(put_bytecode, tmp_code);
5123 /* remove the last aaload from put bytecode, adjust the stack and create the
5124 put bytecode */
5130 {
5140 else
5156 }
5161 {
5168 /* Error-recovery */
5172 {
5174 }
5180 }
5183 {
5186 /* Error-recovery */
5190 {
5192 }
5198 }
5208 }
5209 else
5210 {
5213 /* Error-recovery */
5217 {
5219 }
5223 }
5224 }
5234 {
5238 {
5241 }
5242 else
5243 {
5250 }
5251 }
5255 {
5258 /* string cast */
5261 }
5267 {
5270 }
5271 else
5273 {
5276 }
5284 }
5291 }
5294 /*
5295 The list of expressions, used when calling the function
5296 or procedure.
5298 <RD_expression_list> -> <RD_expression> (, <RD_expression>)*
5299 */
5301 {
5314 {
5322 }
5325 }
5327 /*
5328 Same as the above, only the types are casted according to the second parameter
5329 */
5331 {
5343 {
5349 {
5354 }
5357 {
5361 {
5364 }
5365 else
5366 {
5373 }
5374 }
5377 }
5384 {
5390 {
5396 {
5401 }
5404 {
5408 {
5411 }
5412 else
5413 {
5420 }
5421 }
5424 }
5429 }
5432 }
5434 /*
5435 Same as RD_expression_list, only aaload is generated after each element and the indices
5436 are adjusted.For example, if array is [a..b], the a value must be substracted from the index
5437 */
5439 {
5465 {
5478 }
5483 }
5486 /*
5487 The with statement, currently not supported. This
5488 function is used as an error recovery function.
5490 <RD_with_statement> -> IDN (. IDN)* do <RD_statement>
5491 */
5493 {
5494 /* simplified parsing */
5496 {
5501 }
5506 }
5509 /*
5510 Anything that has value: constant, identifier, identifier inside
5511 a record or a function call.
5513 <RD_value> -> CONST
5514 | IDN [ "[" <RD_expression_list> "]" ] ( . IDN [ "[" <RD_expression_list> "]" ])*
5515 | IDN [ "(" <RD_expression_list> ")"]
5516 | "(" <RD_expression> ")"
5517 */
5519 {
5526 {
5528 {
5551 {
5553 {
5556 }
5558 {
5561 }
5562 else
5563 {
5567 {
5570 }
5571 else
5572 {
5575 }
5576 }
5578 }
5579 }
5584 }
5587 {
5592 /* calculate the exponent and the integer part */
5601 {
5602 /* put the integer part on the stack */
5604 {
5607 }
5609 {
5612 }
5613 else
5614 {
5617 }
5619 /* put the fraction part to the stack */
5621 {
5624 }
5626 {
5629 }
5630 else
5631 {
5634 }
5638 }
5639 else
5640 {
5652 bytecode_append_short_int(current_block->code, cp_add_methodref("Real", "<init>", "(Ljava/lang/String;)V"));
5653 }
5658 }
5661 {
5663 {
5665 }
5666 else
5667 {
5669 }
5674 }
5677 {
5684 }
5687 {
5691 {
5694 }
5695 else
5696 {
5699 }
5704 }
5707 {
5720 {
5726 }
5732 {
5733 constant_value:
5740 }
5742 /*
5743 Parse the unit functions.
5744 */
5746 {
5750 {
5755 }
5763 {
5769 }
5784 }
5788 {
5792 variable_value:
5796 {
5799 }
5803 {
5806 }
5816 {
5817 /* get an element from the record */
5819 {
5825 {
5828 /* Error-recovery */
5832 {
5834 }
5838 }
5848 {
5851 /* Error-recovery */
5855 {
5857 }
5861 }
5871 }
5872 /* get an element from an array */
5874 {
5878 {
5881 /* Error-recovery */
5885 {
5887 }
5891 }
5897 /* replace the last aaload in the bytecode with the proper loading instruction */
5901 {
5908 /* Error-recovery */
5912 {
5914 }
5918 }
5921 {
5924 /* Error-recovery */
5928 {
5930 }
5934 }
5944 }
5946 }
5953 }
5955 function_call:
5957 /* a function call */
5959 {
5966 {
5968 }
5971 {
5974 {
5978 {
5981 {
5984 }
5989 br_depth ++;
5992 br_depth --;
5993 }
5996 }
5998 /* create the bytecode */
6000 {
6004 else
6016 }
6018 {
6019 /* the function is user-defined */
6024 else
6025 methodref_index = cp_add_methodref(string_get_cstr(str_program_name), identifier_text, method_type);
6028 }
6029 else
6030 {
6031 /* handle standard functions and procedures */
6033 }
6045 }
6046 else
6047 {
6053 {
6055 }
6068 }
6071 {
6076 }
6081 {
6083 }
6084 else
6089 /* create the bytecode */
6091 {
6092 {
6101 {
6110 }
6113 }
6119 {
6123 else
6129 }
6130 else
6131 {
6134 else
6135 methodref_index = cp_add_methodref(string_get_cstr(str_program_name), identifier_text, method_type);
6136 }
6140 }
6141 else
6142 {
6143 /* handle standard functions and procedures */
6145 }
6146 /* END create the bytecode */
6156 }
6157 }
6162 }
6164 /* brackets, priority change, no code generated in here */
6166 {
6173 {
6175 }
6180 }
6185 }
6188 /*
6189 Create the bytecode that loads the given constant
6190 */
6192 {
6196 {
6200 {
6203 }
6204 else
6205 {
6208 }
6212 {
6217 /* calculate the exponent and the integer part */
6226 {
6227 /* put the integer part on the stack */
6229 {
6232 }
6234 {
6237 }
6238 else
6239 {
6242 }
6244 /* put the fraction part to the stack */
6246 {
6249 }
6251 {
6254 }
6255 else
6256 {
6259 }
6263 }
6264 else
6265 {
6279 }
6283 }
6289 {
6292 }
6293 else
6294 {
6297 }
6302 {
6304 }
6305 else
6306 {
6308 }
6314 {
6317 }
6318 else
6319 {
6322 }
6324 }
6325 }
6328 /*
6329 Creates the code that loads the variable or parameter value to the stack
6330 */
6332 {
6336 /* if the block is program block, load field instead of variable */
6338 {
6340 {
6348 {
6351 else
6352 bytecode_append_short_int(code, cp_add_fieldref(string_get_cstr(str_program_name), name, type_descriptor));
6353 }
6354 else
6355 {
6360 else
6367 bytecode_append_short_int(code, cp_add_fieldref(string_get_cstr(unit_name), name, type_descriptor));
6370 }
6371 }
6374 }
6377 {
6380 }
6382 {
6383 /* this is used for error recovery and returning values form functions */
6386 }
6388 {
6391 }
6392 else
6393 {
6396 }
6399 {
6404 {
6421 }
6427 {
6429 {
6446 }
6447 }
6448 else
6449 {
6451 {
6468 }
6469 }
6482 {
6499 }
6505 }
6506 }
6508 /*
6509 Creates the code that puts the variable or parameter value from the stack into memory
6510 */
6512 {
6517 {
6520 }
6522 {
6525 }
6526 else if (item->identifier_class == function_name)/* function name, it is return value variable */
6527 {
6531 }
6532 else
6533 {
6536 }
6538 /* if the value on the top of the stack is string, copy it */
6540 {
6553 }
6556 {
6571 }
6573 /* if the value on the top of the stack is record type, copy it */
6575 {
6597 }
6599 /* if the block is program block, load field instead of variable */
6601 {
6603 {
6611 {
6614 else
6615 bytecode_append_short_int(code, cp_add_fieldref(string_get_cstr(str_program_name), name, type_descriptor));
6616 }
6617 else
6618 {
6623 else
6630 bytecode_append_short_int(code, cp_add_fieldref(string_get_cstr(unit_name), name, type_descriptor));
6633 }
6634 }
6637 }
6640 {
6645 {
6662 }
6668 {
6670 {
6687 }
6688 }
6689 else
6690 {
6692 {
6709 }
6710 }
6723 {
6740 }
6746 }
6747 }
6749 /*
6750 The last instruction in the bytecode is aaload; it should be replaced with
6751 the iaload, faload, aload or something like that.
6752 */
6754 {
6755 /* delete the last instruction */
6758 /* create the new instruction */
6760 {
6769 {
6771 }
6772 else
6773 {
6775 }
6791 }
6792 }
6794 /*
6795 Creates the code that adjustes array indices
6796 */
6798 {
6803 {
6808 //bytecode_append(code, iconst_0$);
6822 {
6825 }
6826 else
6827 {
6830 }
6831 }
6835 }