# HG changeset patch # User Mario de Sousa # Date 1349373255 -3600 # Node ID d28c7ebaca21ec037ccb69d01f4394fbb8e7de13 # Parent 400bf52a269183d935c8f6bf7d6e8ab38a47c304 Remove deprecated search_expression_type_c diff -r 400bf52a2691 -r d28c7ebaca21 absyntax_utils/Makefile.am --- a/absyntax_utils/Makefile.am Thu Oct 04 18:50:21 2012 +0100 +++ b/absyntax_utils/Makefile.am Thu Oct 04 18:54:15 2012 +0100 @@ -16,7 +16,6 @@ search_il_label.cc \ search_base_type.cc \ search_constant_type.cc \ - search_expression_type.cc \ search_fb_instance_decl.cc \ search_fb_typedecl.cc \ search_varfb_instance_type.cc \ diff -r 400bf52a2691 -r d28c7ebaca21 absyntax_utils/Makefile.in --- a/absyntax_utils/Makefile.in Thu Oct 04 18:50:21 2012 +0100 +++ b/absyntax_utils/Makefile.in Thu Oct 04 18:54:15 2012 +0100 @@ -87,7 +87,6 @@ get_sizeof_datatype.$(OBJEXT) get_var_name.$(OBJEXT) \ search_il_label.$(OBJEXT) search_base_type.$(OBJEXT) \ search_constant_type.$(OBJEXT) \ - search_expression_type.$(OBJEXT) \ search_fb_instance_decl.$(OBJEXT) search_fb_typedecl.$(OBJEXT) \ search_varfb_instance_type.$(OBJEXT) \ search_var_instance_decl.$(OBJEXT) \ @@ -225,7 +224,6 @@ search_il_label.cc \ search_base_type.cc \ search_constant_type.cc \ - search_expression_type.cc \ search_fb_instance_decl.cc \ search_fb_typedecl.cc \ search_varfb_instance_type.cc \ @@ -328,7 +326,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_var_name.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search_base_type.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search_constant_type.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search_expression_type.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search_fb_instance_decl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search_fb_typedecl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search_il_label.Po@am__quote@ diff -r 400bf52a2691 -r d28c7ebaca21 absyntax_utils/absyntax_utils.hh --- a/absyntax_utils/absyntax_utils.hh Thu Oct 04 18:50:21 2012 +0100 +++ b/absyntax_utils/absyntax_utils.hh Thu Oct 04 18:54:15 2012 +0100 @@ -113,7 +113,6 @@ #include "search_varfb_instance_type.hh" #include "search_constant_type.hh" #include "search_il_operand_type.hh" -#include "search_expression_type.hh" #include "add_en_eno_param_decl.hh" #include "get_sizeof_datatype.hh" #include "search_il_label.hh" diff -r 400bf52a2691 -r d28c7ebaca21 absyntax_utils/search_expression_type.cc --- a/absyntax_utils/search_expression_type.cc Thu Oct 04 18:50:21 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,389 +0,0 @@ -/* - * matiec - a compiler for the programming languages defined in IEC 61131-3 - * - * Copyright (C) 2003-2011 Mario de Sousa (msousa@fe.up.pt) - * Copyright (C) 2007-2011 Laurent Bessard and Edouard Tisserant - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * - * This code is made available on the understanding that it will not be - * used in safety-critical situations without a full and competent review. - */ - -/* - * An IEC 61131-3 compiler. - * - * Based on the - * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) - * - */ - - -/* Determine the data type of an ST expression. - * A reference to the relevant type definition is returned. - * - * For example: - * 2 + 3 -> returns reference to a int_type_name_c object. - * 22.2 - 5 -> returns reference to a real_type_name_c object. - * etc... - */ - - - -#include "absyntax_utils.hh" -#include - -search_expression_type_c::search_expression_type_c(symbol_c *search_scope) { - search_varfb_instance_type = new search_varfb_instance_type_c(search_scope); -} - -search_expression_type_c::~search_expression_type_c(void) { - delete search_varfb_instance_type; -} - -/* A helper function... */ -bool search_expression_type_c::is_bool_type(symbol_c *type_symbol) { - bool_type_name_c tt; - if (type_symbol == NULL) {return true;} - if (typeid(*type_symbol) == typeid(safebool_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(bool_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(boolean_true_c)) {return true;} - if (typeid(*type_symbol) == typeid(boolean_false_c)) {return true;} - return false; -} - -/* A helper function... */ -bool search_expression_type_c::is_time_type(symbol_c *type_symbol) { - if (type_symbol == NULL) {return true;} - if (typeid(*type_symbol) == typeid(time_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(date_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(tod_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(dt_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safetime_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safedate_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safetod_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safedt_type_name_c)) {return true;} - return false; -} - -/* A helper function... */ -bool search_expression_type_c::is_string_type(symbol_c *type_symbol) { - if (type_symbol == NULL) {return true;} - if (typeid(*type_symbol) == typeid(string_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(wstring_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safestring_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safewstring_type_name_c)) {return true;} - return false; -} - -/* A helper function... */ -bool search_expression_type_c::is_literal_integer_type(symbol_c *type_symbol) { - if (type_symbol == NULL) {return true;} - if (typeid(*type_symbol) == typeid(integer_c)) {return true;} - if (typeid(*type_symbol) == typeid(neg_integer_c)) {return true;} - if (typeid(*type_symbol) == typeid(binary_integer_c)) {return true;} - if (typeid(*type_symbol) == typeid(octal_integer_c)) {return true;} - if (typeid(*type_symbol) == typeid(hex_integer_c)) {return true;} - return false; -} - -/* A helper function... */ -bool search_expression_type_c::is_integer_type(symbol_c *type_symbol) { - if (type_symbol == NULL) {return true;} - if (typeid(*type_symbol) == typeid(sint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(int_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(dint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(lint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(usint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(uint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(udint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(ulint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safesint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safeint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safedint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safelint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safeusint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safeuint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safeudint_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safeulint_type_name_c)) {return true;} - return is_literal_integer_type(type_symbol); -} - -/* A helper function... */ -bool search_expression_type_c::is_literal_real_type(symbol_c *type_symbol) { - if (type_symbol == NULL) {return true;} - if (typeid(*type_symbol) == typeid(real_c)) {return true;} - if (typeid(*type_symbol) == typeid(neg_real_c)) {return true;} - return false; -} - -/* A helper function... */ -bool search_expression_type_c::is_real_type(symbol_c *type_symbol) { - if (type_symbol == NULL) {return true;} - if (typeid(*type_symbol) == typeid(real_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(lreal_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safereal_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safelreal_type_name_c)) {return true;} - return is_literal_real_type(type_symbol); -} - -bool search_expression_type_c::is_num_type(symbol_c *type_symbol) { - if (type_symbol == NULL) {return true;} - return is_real_type(type_symbol) || is_integer_type(type_symbol); -} - -bool search_expression_type_c::is_nbinary_type(symbol_c *type_symbol) { - if (type_symbol == NULL) {return true;} - if (typeid(*type_symbol) == typeid(byte_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(word_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(dword_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(lword_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safebyte_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safeword_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safedword_type_name_c)) {return true;} - if (typeid(*type_symbol) == typeid(safelword_type_name_c)) {return true;} - return is_literal_integer_type(type_symbol); -} - -bool search_expression_type_c::is_binary_type(symbol_c *type_symbol) { - if (type_symbol == NULL) {return true;} -// if (typeid(*type_symbol) == typeid(bool_type_name_c)) {return true;} -// if (typeid(*type_symbol) == typeid(safebool_type_name_c)) {return true;} - return (is_nbinary_type(type_symbol) || is_bool_type(type_symbol)); -} - -bool search_expression_type_c::is_same_type(symbol_c *first_type, symbol_c *second_type) { - if (first_type == NULL || second_type == NULL) {return true;} - if (typeid(*first_type) == typeid(*second_type)) {return true;} - if (is_bool_type(first_type) && is_bool_type(second_type)) {return true;} - if (is_integer_type(first_type) && is_literal_integer_type(second_type)) {return true;} - if (is_literal_integer_type(first_type) && is_integer_type(second_type)) {return true;} - if (is_binary_type(first_type) && is_literal_integer_type(second_type)) {return true;} - if (is_literal_integer_type(first_type) && is_binary_type(second_type)) {return true;} - if (is_real_type(first_type) && is_literal_real_type(second_type)) {return true;} - if (is_literal_real_type(first_type) && is_real_type(second_type)) {return true;} - return false; -} - -symbol_c* search_expression_type_c::common_type(symbol_c *first_type, symbol_c *second_type) { - if (first_type == NULL && second_type == NULL) {return NULL;} - if (first_type == NULL) {return second_type;} - if (second_type == NULL) {return first_type;} - if (typeid(*first_type) == typeid(*second_type)) {return first_type;} - if (is_integer_type(first_type) && is_literal_integer_type(second_type)) {return first_type;} - if (is_literal_integer_type(first_type) && is_integer_type(second_type)) {return second_type;} - if (is_binary_type(first_type) && is_literal_integer_type(second_type)) {return first_type;} - if (is_literal_integer_type(first_type) && is_binary_type(second_type)) {return second_type;} - if (is_real_type(first_type) && is_literal_real_type(second_type)) {return first_type;} - if (is_literal_real_type(first_type) && is_real_type(second_type)) {return second_type;} - return NULL; -} - -symbol_c *search_expression_type_c::default_literal_type(symbol_c* symbol) { - if (is_literal_integer_type(symbol)) { - return (symbol_c *)&search_constant_type_c::lint_type_name; - } - else if (is_literal_real_type(symbol)) { - return (symbol_c *)&search_constant_type_c::lreal_type_name; - } - return symbol; -} - - -/* A helper function... */ -void *search_expression_type_c::compute_boolean_expression(symbol_c *left_type, symbol_c *right_type) { - if (!is_same_type(left_type, right_type)) - ERROR; - if (!is_bool_type(left_type) && !is_binary_type(left_type)) - ERROR; - if (is_literal_integer_type(left_type)) {return (void *)right_type;} - else {return (void *)left_type;} -} - -/* A helper function... */ -void *search_expression_type_c::compute_numeric_expression(symbol_c *left_type, symbol_c *right_type) { - if (!is_same_type(left_type, right_type)) - ERROR; - if (!is_integer_type(left_type) && !is_real_type(left_type)) - ERROR; - if (is_literal_integer_type(left_type) || is_literal_real_type(left_type)) {return (void *)right_type;} - else {return (void *)left_type;} - return NULL; -} - -/* a helper function... */ -symbol_c *search_expression_type_c::base_type(symbol_c *symbol) { - return (symbol_c *)symbol->accept(search_base_type); -} - -/*********************/ -/* B 1.4 - Variables */ -/*********************/ - -void *search_expression_type_c::visit(symbolic_variable_c *symbol) { - symbol_c *res; - - /* Nope, now we assume it is a variable, and determine its type... */ - res = search_varfb_instance_type->get_basetype_decl(symbol); - if (NULL != res) return res; - - return NULL; -} - -/********************************************/ -/* B 1.4.1 - Directly Represented Variables */ -/********************************************/ -void *search_expression_type_c::visit(direct_variable_c *symbol) { - symbol_c *res; - - /* Nope, now we assume it is a variable, and determine its type... */ - res = search_varfb_instance_type->get_basetype_decl(symbol); - if (NULL != res) return res; - - return NULL; -} - -/*************************************/ -/* B 1.4.2 - Multi-element variables */ -/*************************************/ - -void *search_expression_type_c::visit(array_variable_c *symbol) { - symbol_c *res; - - /* Nope, now we assume it is a variable, and determine its type... */ - res = search_varfb_instance_type->get_basetype_decl(symbol); - if (NULL != res) return res; - - return NULL; -} - -void *search_expression_type_c::visit(structured_variable_c *symbol) { - symbol_c *res; - - /* Nope, now we assume it is a variable, and determine its type... */ - res = search_varfb_instance_type->get_basetype_decl(symbol); - if (NULL != res) return res; - - return NULL; -} - -/***************************************/ -/* B.3 - Language ST (Structured Text) */ -/***************************************/ -/***********************/ -/* B 3.1 - Expressions */ -/***********************/ -void *search_expression_type_c::visit(or_expression_c *symbol) { - symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); - symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); - return compute_boolean_expression(left_type, right_type); -} - -void *search_expression_type_c::visit(xor_expression_c *symbol) { - symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); - symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); - return compute_boolean_expression(left_type, right_type); -} - -void *search_expression_type_c::visit(and_expression_c *symbol) { - symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); - symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); - return compute_boolean_expression(left_type, right_type); -} - -void *search_expression_type_c::visit(equ_expression_c *symbol) {return (void *)&bool_type_name;} -void *search_expression_type_c::visit(notequ_expression_c *symbol) {return (void *)&bool_type_name;} -void *search_expression_type_c::visit(lt_expression_c *symbol) {return (void *)&bool_type_name;} -void *search_expression_type_c::visit(gt_expression_c *symbol) {return (void *)&bool_type_name;} -void *search_expression_type_c::visit(le_expression_c *symbol) {return (void *)&bool_type_name;} -void *search_expression_type_c::visit(ge_expression_c *symbol) {return (void *)&bool_type_name;} - -void *search_expression_type_c::visit(add_expression_c *symbol) { - symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); - symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); - if (typeid(*left_type) == typeid(time_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) {return (void *)&time_type_name;} - if (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) {return (void *)&tod_type_name;} - if (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) {return (void *)&dt_type_name;} - return compute_numeric_expression(left_type, right_type); -} - -void *search_expression_type_c::visit(sub_expression_c *symbol) { - symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); - symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); - if (typeid(*left_type) == typeid(time_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) {return (void *)&time_type_name;} - if (typeid(*left_type) == typeid(date_type_name_c) && typeid(*right_type) == typeid(date_type_name_c)) {return (void *)&time_type_name;} - if (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) {return (void *)&tod_type_name;} - if (typeid(*left_type) == typeid(tod_type_name_c) && typeid(*right_type) == typeid(tod_type_name_c)) {return (void *)&time_type_name;} - if (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(time_type_name_c)) {return (void *)&dt_type_name;} - if (typeid(*left_type) == typeid(dt_type_name_c) && typeid(*right_type) == typeid(dt_type_name_c)) {return (void *)&time_type_name;} - return compute_numeric_expression(left_type, right_type); -} - -void *search_expression_type_c::visit(mul_expression_c *symbol) { - symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); - symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); - if (typeid(*left_type) == typeid(time_type_name_c) && is_num_type(right_type)) { - return (void *)&time_type_name; - } - return compute_numeric_expression(left_type, right_type); -} - -void *search_expression_type_c::visit(div_expression_c *symbol) { - symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); - symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); - if (typeid(*left_type) == typeid(time_type_name_c) && is_num_type(right_type)){ - return (void *)&time_type_name; - } - return compute_numeric_expression(left_type, right_type); -} - -void *search_expression_type_c::visit(mod_expression_c *symbol) { - symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); - symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); - return compute_numeric_expression(left_type, right_type); -} - -void *search_expression_type_c::visit(power_expression_c *symbol) { - symbol_c *left_type = base_type((symbol_c *)symbol->l_exp->accept(*this)); - symbol_c *right_type = base_type((symbol_c *)symbol->r_exp->accept(*this)); - if (is_real_type(left_type) && is_num_type(right_type)) { - return (void *)left_type; - } - ERROR; - return NULL; -} - -void *search_expression_type_c::visit(neg_expression_c *symbol) { - symbol_c *exp_type = base_type((symbol_c *)symbol->exp->accept(*this)); - if (is_num_type(exp_type) || typeid(*exp_type) == typeid(time_type_name_c)){ - return (void *)exp_type; - } - ERROR; - return NULL; -} - -void *search_expression_type_c::visit(not_expression_c *symbol) { - symbol_c *exp_type = base_type((symbol_c *)symbol->exp->accept(*this)); - return compute_boolean_expression(exp_type, exp_type); -} - -void *search_expression_type_c::visit(function_invocation_c *symbol) { - function_declaration_c *f_decl = (function_declaration_c *)symbol->called_function_declaration; - if (f_decl == NULL) ERROR; - return base_type(f_decl->type_name); -} - -/*bool_type_name_c search_expression_type_c::bool_type_name;*/ - diff -r 400bf52a2691 -r d28c7ebaca21 absyntax_utils/search_expression_type.hh --- a/absyntax_utils/search_expression_type.hh Thu Oct 04 18:50:21 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -/* - * matiec - a compiler for the programming languages defined in IEC 61131-3 - * - * Copyright (C) 2003-2011 Mario de Sousa (msousa@fe.up.pt) - * Copyright (C) 2007-2011 Laurent Bessard and Edouard Tisserant - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * - * This code is made available on the understanding that it will not be - * used in safety-critical situations without a full and competent review. - */ - -/* - * An IEC 61131-3 compiler. - * - * Based on the - * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) - * - */ - -/* Determine the data type of an ST expression. - * A reference to the relevant type definition is returned. - * - * For example: - * 2 + 3 -> returns reference to a int_type_name_c object. - * 22.2 - 5 -> returns reference to a real_type_name_c object. - * etc... - */ - -/* WARNING WARNING WARNING - * - * When taking into consideration calls to functions, this search_expression_type_c - * class will use internal atributes (i.e. anotation) in the function_invocation_c symbol - * in the abstract syntax tree. - * - * Since this anotation/atribute is only set/populated with the correct value - * during stage3 (semantic verification), this class will only work correctly - * after the semantic verification in stage 3 has been executed - * (to be more exact, the data type checking of stage 3). - */ - -class search_expression_type_c: public search_constant_type_c { - - private: - search_varfb_instance_type_c *search_varfb_instance_type; - search_base_type_c search_base_type; - - - public: - search_expression_type_c(symbol_c *search_scope); - virtual ~search_expression_type_c(void); - - /* A helper function... */ - bool is_bool_type(symbol_c *type_symbol); - bool is_time_type(symbol_c *type_symbol); - bool is_string_type(symbol_c *type_symbol); - bool is_literal_integer_type(symbol_c *type_symbol); - bool is_integer_type(symbol_c *type_symbol); - bool is_literal_real_type(symbol_c *type_symbol); - bool is_real_type(symbol_c *type_symbol); - bool is_num_type(symbol_c *type_symbol); - bool is_nbinary_type(symbol_c *type_symbol); - bool is_binary_type(symbol_c *type_symbol); - - bool is_same_type(symbol_c *first_type, symbol_c *second_type); - symbol_c* common_type(symbol_c *first_type, symbol_c *second_type); - symbol_c* default_literal_type(symbol_c *symbol); - - /*static bool_type_name_c bool_type_name;*/ - - /* A helper function... */ - void *compute_boolean_expression(symbol_c *left_type, symbol_c *right_type); - - /* A helper function... */ - void *compute_numeric_expression(symbol_c *left_type, symbol_c *right_type); - - /* a helper function... */ - symbol_c *base_type(symbol_c *symbol); - - /*********************/ - /* B 1.4 - Variables */ - /*********************/ - - void *visit(symbolic_variable_c *symbol); - - /********************************************/ - /* B 1.4.1 - Directly Represented Variables */ - /********************************************/ - void *visit(direct_variable_c *symbol); - - /*************************************/ - /* B 1.4.2 - Multi-element variables */ - /*************************************/ - - void *visit(array_variable_c *symbol); - void *visit(structured_variable_c *symbol); - - /***************************************/ - /* B.3 - Language ST (Structured Text) */ - /***************************************/ - /***********************/ - /* B 3.1 - Expressions */ - /***********************/ - void *visit(or_expression_c *symbol); - void *visit(xor_expression_c *symbol); - void *visit(and_expression_c *symbol); - void *visit(equ_expression_c *symbol); - void *visit(notequ_expression_c *symbol); - void *visit(lt_expression_c *symbol); - void *visit(gt_expression_c *symbol); - void *visit(le_expression_c *symbol); - void *visit(ge_expression_c *symbol); - - void *visit(add_expression_c *symbol); - void *visit(sub_expression_c *symbol); - void *visit(mul_expression_c *symbol); - void *visit(div_expression_c *symbol); - void *visit(mod_expression_c *symbol); - void *visit(power_expression_c *symbol); - void *visit(neg_expression_c *symbol); - void *visit(not_expression_c *symbol); - void *visit(function_invocation_c *symbol); - - - static integer_c integer; - -}; // search_expression_type_c - - -