msousa@460: /* msousa@460: * matiec - a compiler for the programming languages defined in IEC 61131-3 msousa@460: * msousa@460: * Copyright (C) 2012 Mario de Sousa (msousa@fe.up.pt) msousa@460: * msousa@460: * msousa@460: * This program is free software: you can redistribute it and/or modify msousa@460: * it under the terms of the GNU General Public License as published by msousa@460: * the Free Software Foundation, either version 3 of the License, or msousa@460: * (at your option) any later version. msousa@460: * msousa@460: * This program is distributed in the hope that it will be useful, msousa@460: * but WITHOUT ANY WARRANTY; without even the implied warranty of msousa@460: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the msousa@460: * GNU General Public License for more details. msousa@460: * msousa@460: * You should have received a copy of the GNU General Public License msousa@460: * along with this program. If not, see . msousa@460: * msousa@460: * msousa@460: * This code is made available on the understanding that it will not be msousa@460: * used in safety-critical situations without a full and competent review. msousa@460: */ msousa@460: msousa@460: /* msousa@460: * An IEC 61131-3 compiler. msousa@460: * msousa@460: * Based on the msousa@460: * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) msousa@460: * msousa@460: */ msousa@460: msousa@460: msousa@460: /* msousa@460: * Search for a specific label in an IL list. msousa@460: * msousa@460: * when instantiated, must be given a pointer to one of the following msousa@460: * - function_declaration_c msousa@460: * - function_block_declaration_c msousa@460: * - program_declaration_c msousa@460: * - instruction_list_c msousa@460: * msousa@460: * which is where all calls to search for a specific label will look for said label. msousa@460: */ msousa@460: msousa@460: msousa@460: msousa@460: #include "../absyntax_utils/absyntax_utils.hh" msousa@460: msousa@460: msousa@460: class search_il_label_c: public search_visitor_c { msousa@460: msousa@460: private: msousa@460: search_varfb_instance_type_c *search_varfb_instance_type; msousa@460: symbol_c *search_scope; msousa@460: symbol_c *search_label; msousa@460: msousa@460: public: msousa@460: search_il_label_c(symbol_c *search_scope); msousa@460: virtual ~search_il_label_c(void); msousa@460: msousa@460: il_instruction_c *find_label(const char *label); msousa@460: il_instruction_c *find_label(symbol_c *label); msousa@460: msousa@460: msousa@460: /****************************************/ msousa@460: /* B.2 - Language IL (Instruction List) */ msousa@460: /****************************************/ msousa@460: /***********************************/ msousa@460: /* B 2.1 Instructions and Operands */ msousa@460: /***********************************/ msousa@460: // void *visit(instruction_list_c *symbol); msousa@460: void *visit(il_instruction_c *symbol); msousa@460: // void *visit(il_simple_operation_c *symbol); msousa@460: // void *visit(il_function_call_c *symbol); msousa@460: // void *visit(il_expression_c *symbol); msousa@460: // void *visit(il_fb_call_c *symbol); msousa@460: // void *visit(il_formal_funct_call_c *symbol); msousa@460: // void *visit(il_operand_list_c *symbol); msousa@460: // void *visit(simple_instr_list_c *symbol); msousa@460: // void *visit(il_simple_instruction_c*symbol); msousa@460: // void *visit(il_param_list_c *symbol); msousa@460: // void *visit(il_param_assignment_c *symbol); msousa@460: // void *visit(il_param_out_assignment_c *symbol); msousa@460: msousa@460: msousa@460: }; // search_il_label_c msousa@460: msousa@460: msousa@460: msousa@460: msousa@460: msousa@460: msousa@460: msousa@460: