static void e4(rdp_tree_node_data* rdp_tree) { { e5(rdp_add_child("e5", rdp_tree)); if (scan_test(NULL, RDP_T_4242 /* ** */, NULL)) { /* Start of rdp_e4_1 */ while (1) { { if (rdp_tree_update) memcpy(rdp_tree, text_scan_data, sizeof(scan_data)); scan_test(NULL, RDP_T_4242 /* ** */, &e4_stop); scan_(); e4(rdp_add_child("e4", rdp_tree)); } break; /* hi limit is 1! */ } } /* end of rdp_e4_1 */ else { /* default action processing for rdp_e4_1*/ if (rdp_tree_update) {rdp_tree->id = NULL; rdp_tree->token = SCAN_P_ID;} } scan_test_set(NULL, &e4_stop, &e4_stop); } }
static void reg(rdp_tree_node_data* rdp_tree) { { if (scan_test(NULL, SCAN_P_ID, NULL)) { if (rdp_tree_update) rdp_add_child(NULL, rdp_tree); scan_test(NULL, SCAN_P_ID, ®_stop); scan_(); } else if (scan_test(NULL, RDP_T_35 /* # */, NULL)) { if (rdp_tree_update) rdp_add_child(NULL, rdp_tree); scan_test(NULL, RDP_T_35 /* # */, ®_stop); scan_(); } else if (scan_test(NULL, RDP_T_40 /* ( */, NULL)) { if (rdp_tree_update) rdp_add_child(NULL, rdp_tree); scan_test(NULL, RDP_T_40 /* ( */, ®_stop); scan_(); alt(rdp_add_child("alt", rdp_tree)); if (rdp_tree_update) rdp_add_child(NULL, rdp_tree); scan_test(NULL, RDP_T_41 /* ) */, ®_stop); scan_(); } else scan_test_set(NULL, ®_first, ®_stop) ; scan_test_set(NULL, ®_stop, ®_stop); } }
static void e3(rdp_tree_node_data* rdp_tree) { { if (scan_test_set(NULL, &rdp_e3_0_first, NULL)) { if(rdp_tree_update) {rdp_tree->id = "e4"; rdp_tree->token = 0;} e4(rdp_tree); } else if (scan_test(NULL, RDP_T_43 /* + */, NULL)) { scan_test(NULL, RDP_T_43 /* + */, &e3_stop); scan_(); e3(rdp_add_child("e3", rdp_tree)); } else if (scan_test(NULL, RDP_T_45 /* - */, NULL)) { if (rdp_tree_update) memcpy(rdp_tree, text_scan_data, sizeof(scan_data)); scan_test(NULL, RDP_T_45 /* - */, &e3_stop); scan_(); e3(rdp_add_child("e3", rdp_tree)); } else scan_test_set(NULL, &e3_first, &e3_stop) ; scan_test_set(NULL, &e3_stop, &e3_stop); } }
/* Parser functions */ void alt(rdp_tree_node_data* rdp_tree) { { con(rdp_add_child("con", rdp_tree)); if (scan_test(NULL, RDP_T_124 /* | */, NULL)) { /* Start of rdp_alt_1 */ while (1) { { if (rdp_tree_update) rdp_add_child(NULL, rdp_tree); scan_test(NULL, RDP_T_124 /* | */, &alt_stop); scan_(); con(rdp_add_child("con", rdp_tree)); } break; /* hi limit is 1! */ } } /* end of rdp_alt_1 */ else { /* default action processing for rdp_alt_1*/ if (rdp_tree_update) {rdp_tree_node_data *temp = rdp_add_child(NULL, rdp_tree); temp->id = NULL; temp->token = SCAN_P_ID;} } scan_test_set(NULL, &alt_stop, &alt_stop); } }
static void dec_body(rdp_tree_node_data* rdp_tree) { char* name; { if (rdp_tree_update) memcpy(rdp_tree, text_scan_data, sizeof(scan_data)); scan_test(NULL, SCAN_P_ID, &dec_body_stop); name = SCAN_CAST->id; scan_(); if (scan_test(NULL, RDP_T_61 /* = */, NULL)) { /* Start of rdp_dec_body_1 */ while (1) { { scan_test(NULL, RDP_T_61 /* = */, &dec_body_stop); scan_(); e0(rdp_add_child("e0", rdp_tree)); } break; /* hi limit is 1! */ } } /* end of rdp_dec_body_1 */ else { /* default action processing for rdp_dec_body_1*/ } symbol_insert_key(mini, &name, sizeof(char*), sizeof(mini_data)); \ if (*name == '_' && *(name+1) == '_')\ text_message(TEXT_ERROR_ECHO, "variable names must not begin with two underscores\n");\ scan_test_set(NULL, &dec_body_stop, &dec_body_stop); } }
void program(rdp_tree_node_data* rdp_tree) { { if (scan_test_set(NULL, &rdp_program_4_first, NULL)) { /* Start of rdp_program_4 */ while (1) { { if (scan_test_set(NULL, &rdp_program_2_first, NULL)) { /* Start of rdp_program_2 */ while (1) { { if (scan_test(NULL, RDP_T_int, NULL)) { var_dec(rdp_add_child("var_dec", rdp_tree)); } else if (scan_test_set(NULL, &rdp_program_1_first, NULL)) { statement(rdp_add_child("statement", rdp_tree)); } else scan_test_set(NULL, &rdp_program_2_first, &program_stop) ; } break; /* hi limit is 1! */ } } /* end of rdp_program_2 */ else { /* default action processing for rdp_program_2*/ if (rdp_tree_update) {rdp_tree_node_data *temp = rdp_add_child(NULL, rdp_tree); temp->id = NULL; temp->token = SCAN_P_ID;} } scan_test(NULL, RDP_T_59 /* ; */, &program_stop); scan_(); } if (!scan_test_set(NULL, &rdp_program_4_first, NULL)) break; } } /* end of rdp_program_4 */ else { /* default action processing for rdp_program_4*/ if (rdp_tree_update) {rdp_tree_node_data *temp = rdp_add_child(NULL, rdp_tree); temp->id = NULL; temp->token = SCAN_P_ID;} } scan_test_set(NULL, &program_stop, &program_stop); } }
/* Parser functions */ static void String(rdp_tree_node_data* rdp_tree) { { if (rdp_tree_update) rdp_add_child(NULL, rdp_tree); scan_test(NULL, RDP_T_34 /* " */, &String_stop); scan_(); scan_test_set(NULL, &String_stop, &String_stop); } }
static void e2(rdp_tree_node_data* rdp_tree) { { if(rdp_tree_update) {rdp_tree->id = "e3"; rdp_tree->token = 0;} e3(rdp_tree); if (scan_test_set(NULL, &rdp_e2_2_first, NULL)) { /* Start of rdp_e2_2 */ while (1) { { if (scan_test(NULL, RDP_T_42 /* * */, NULL)) { if (rdp_tree_update) rdp_add_parent(NULL, rdp_tree); scan_test(NULL, RDP_T_42 /* * */, &e2_stop); scan_(); e3(rdp_add_child("e3", rdp_tree)); } else if (scan_test(NULL, RDP_T_47 /* / */, NULL)) { if (rdp_tree_update) rdp_add_parent(NULL, rdp_tree); scan_test(NULL, RDP_T_47 /* / */, &e2_stop); scan_(); e3(rdp_add_child("e3", rdp_tree)); } else scan_test_set(NULL, &rdp_e2_2_first, &e2_stop) ; } if (!scan_test_set(NULL, &rdp_e2_2_first, NULL)) break; } } /* end of rdp_e2_2 */ else { /* default action processing for rdp_e2_2*/ if (rdp_tree_update) {rdp_tree_node_data *temp = rdp_add_child(NULL, rdp_tree); temp->id = NULL; temp->token = SCAN_P_ID;} } scan_test_set(NULL, &e2_stop, &e2_stop); } }
static void con(rdp_tree_node_data* rdp_tree) { { kle(rdp_add_child("kle", rdp_tree)); if (scan_test_set(NULL, &rdp_con_1_first, NULL)) { /* Start of rdp_con_1 */ while (1) { { kle(rdp_add_child("kle", rdp_tree)); } break; /* hi limit is 1! */ } } /* end of rdp_con_1 */ else { /* default action processing for rdp_con_1*/ if (rdp_tree_update) {rdp_tree_node_data *temp = rdp_add_child(NULL, rdp_tree); temp->id = NULL; temp->token = SCAN_P_ID;} } scan_test_set(NULL, &con_stop, &con_stop); } }
static void kle(rdp_tree_node_data* rdp_tree) { { reg(rdp_add_child("reg", rdp_tree)); if (scan_test(NULL, RDP_T_42 /* * */, NULL)) { /* Start of rdp_kle_1 */ while (1) { { if (rdp_tree_update) rdp_add_child(NULL, rdp_tree); scan_test(NULL, RDP_T_42 /* * */, &kle_stop); scan_(); } break; /* hi limit is 1! */ } } /* end of rdp_kle_1 */ else { /* default action processing for rdp_kle_1*/ if (rdp_tree_update) {rdp_tree_node_data *temp = rdp_add_child(NULL, rdp_tree); temp->id = NULL; temp->token = SCAN_P_ID;} } scan_test_set(NULL, &kle_stop, &kle_stop); } }
static void var_dec(rdp_tree_node_data* rdp_tree) { { if (rdp_tree_update) memcpy(rdp_tree, text_scan_data, sizeof(scan_data)); scan_test(NULL, RDP_T_int, &var_dec_stop); scan_(); { /* Start of rdp_var_dec_1 */ while (1) { scan_test(NULL, SCAN_P_ID, &var_dec_stop); { dec_body(rdp_add_child("dec_body", rdp_tree)); } if (SCAN_CAST->token != RDP_T_44 /* , */) break; scan_(); } } /* end of rdp_var_dec_1 */ scan_test_set(NULL, &var_dec_stop, &var_dec_stop); } }
static void statement(rdp_tree_node_data* rdp_tree) { char* name; { if (scan_test(NULL, SCAN_P_ID, NULL)) { if (rdp_tree_update) rdp_add_child(NULL, rdp_tree); scan_test(NULL, SCAN_P_ID, &statement_stop); name = SCAN_CAST->id; scan_(); check_declared; if (rdp_tree_update) memcpy(rdp_tree, text_scan_data, sizeof(scan_data)); scan_test(NULL, RDP_T_61 /* = */, &statement_stop); scan_(); e0(rdp_add_child("e0", rdp_tree)); } else if (scan_test(NULL, RDP_T_if, NULL)) { if (rdp_tree_update) memcpy(rdp_tree, text_scan_data, sizeof(scan_data)); scan_test(NULL, RDP_T_if, &statement_stop); scan_(); e0(rdp_add_child("e0", rdp_tree)); scan_test(NULL, RDP_T_then, &statement_stop); scan_(); statement(rdp_add_child("statement", rdp_tree)); if (scan_test(NULL, RDP_T_else, NULL)) { /* Start of rdp_statement_2 */ /* WARNING - an LL(1) violation was detected at this point in the grammar */ while (1) { { scan_test(NULL, RDP_T_else, &statement_stop); scan_(); statement(rdp_add_child("statement", rdp_tree)); } break; /* hi limit is 1! */ } } /* end of rdp_statement_2 */ else { /* default action processing for rdp_statement_2*/ if (rdp_tree_update) {rdp_tree_node_data *temp = rdp_add_child(NULL, rdp_tree); temp->id = NULL; temp->token = SCAN_P_ID;} } } else if (scan_test(NULL, RDP_T_while, NULL)) { if (rdp_tree_update) memcpy(rdp_tree, text_scan_data, sizeof(scan_data)); scan_test(NULL, RDP_T_while, &statement_stop); scan_(); e0(rdp_add_child("e0", rdp_tree)); scan_test(NULL, RDP_T_do, &statement_stop); scan_(); statement(rdp_add_child("statement", rdp_tree)); } else if (scan_test(NULL, RDP_T_print, NULL)) { if (rdp_tree_update) memcpy(rdp_tree, text_scan_data, sizeof(scan_data)); scan_test(NULL, RDP_T_print, &statement_stop); scan_(); scan_test(NULL, RDP_T_40 /* ( */, &statement_stop); scan_(); { /* Start of rdp_statement_7 */ while (1) { scan_test_set(NULL, &rdp_statement_7_first, &statement_stop); { if (scan_test_set(NULL, &rdp_statement_5_first, NULL)) { e0(rdp_add_child("e0", rdp_tree)); } else if (scan_test(NULL, RDP_T_34 /* " */, NULL)) { String(rdp_tree); } else scan_test_set(NULL, &rdp_statement_7_first, &statement_stop) ; } if (SCAN_CAST->token != RDP_T_44 /* , */) break; scan_(); } } /* end of rdp_statement_7 */ scan_test(NULL, RDP_T_41 /* ) */, &statement_stop); scan_(); } else if (scan_test(NULL, RDP_T_begin, NULL)) { if (rdp_tree_update) memcpy(rdp_tree, text_scan_data, sizeof(scan_data)); scan_test(NULL, RDP_T_begin, &statement_stop); scan_(); { /* Start of rdp_statement_10 */ while (1) { scan_test_set(NULL, &rdp_statement_10_first, &statement_stop); { statement(rdp_add_child("statement", rdp_tree)); } if (SCAN_CAST->token != RDP_T_59 /* ; */) break; scan_(); } } /* end of rdp_statement_10 */ scan_test(NULL, RDP_T_end, &statement_stop); scan_(); } else scan_test_set(NULL, &statement_first, &statement_stop) ; scan_test_set(NULL, &statement_stop, &statement_stop); } }
static void e0(rdp_tree_node_data* rdp_tree) { { if(rdp_tree_update) {rdp_tree->id = "e1"; rdp_tree->token = 0;} e1(rdp_tree); if (scan_test_set(NULL, &rdp_e0_6_first, NULL)) { /* Start of rdp_e0_6 */ while (1) { { if (scan_test(NULL, RDP_T_62 /* > */, NULL)) { if (rdp_tree_update) rdp_add_parent(NULL, rdp_tree); scan_test(NULL, RDP_T_62 /* > */, &e0_stop); scan_(); e1(rdp_add_child("e1", rdp_tree)); } else if (scan_test(NULL, RDP_T_60 /* < */, NULL)) { if (rdp_tree_update) rdp_add_parent(NULL, rdp_tree); scan_test(NULL, RDP_T_60 /* < */, &e0_stop); scan_(); e1(rdp_add_child("e1", rdp_tree)); } else if (scan_test(NULL, RDP_T_6261 /* >= */, NULL)) { if (rdp_tree_update) rdp_add_parent(NULL, rdp_tree); scan_test(NULL, RDP_T_6261 /* >= */, &e0_stop); scan_(); e1(rdp_add_child("e1", rdp_tree)); } else if (scan_test(NULL, RDP_T_6061 /* <= */, NULL)) { if (rdp_tree_update) rdp_add_parent(NULL, rdp_tree); scan_test(NULL, RDP_T_6061 /* <= */, &e0_stop); scan_(); e1(rdp_add_child("e1", rdp_tree)); } else if (scan_test(NULL, RDP_T_6161 /* == */, NULL)) { if (rdp_tree_update) rdp_add_parent(NULL, rdp_tree); scan_test(NULL, RDP_T_6161 /* == */, &e0_stop); scan_(); e1(rdp_add_child("e1", rdp_tree)); } else if (scan_test(NULL, RDP_T_3361 /* != */, NULL)) { if (rdp_tree_update) rdp_add_parent(NULL, rdp_tree); scan_test(NULL, RDP_T_3361 /* != */, &e0_stop); scan_(); e1(rdp_add_child("e1", rdp_tree)); } else scan_test_set(NULL, &rdp_e0_6_first, &e0_stop) ; } break; /* hi limit is 1! */ } } /* end of rdp_e0_6 */ else { /* default action processing for rdp_e0_6*/ if (rdp_tree_update) {rdp_tree_node_data *temp = rdp_add_child(NULL, rdp_tree); temp->id = NULL; temp->token = SCAN_P_ID;} } scan_test_set(NULL, &e0_stop, &e0_stop); } }