stage3/narrow_candidate_datatypes.hh
changeset 552 3c39d80fdede
parent 502 a6211f73690b
child 652 7fe1533d2260
equal deleted inserted replaced
551:a75e3aea98ff 552:3c39d80fdede
    28  * An IEC 61131-3 compiler.
    28  * An IEC 61131-3 compiler.
    29  *
    29  *
    30  * Based on the
    30  * Based on the
    31  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
    31  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
    32  *
    32  *
       
    33  */
       
    34 
       
    35 
       
    36 /* NOTE: The algorithm implemented here assumes that candidate datatype lists have already been filled!
       
    37  *       BEFORE running this visitor, be sure to CALL the fill_candidate_datatype_c visitor!
       
    38  */
       
    39 
       
    40 
       
    41 /*
       
    42  *  Choose, from the list of all the possible datatypes each expression may take, the single datatype that it will in fact take.
       
    43  *  The resulting (chosen) datatype, will be stored in the symbol_c.datatype variable, leaving the candidate datatype list untouched!
       
    44  * 
       
    45  *  For rvalue expressions, this decision will be based on the datatype of the lvalue expression.
       
    46  *  For lvalue expressions, the candidate datatype list should have a single entry.
       
    47  * 
       
    48  *  For example, the very simple literal '0' in 'foo := 0', may represent a:
       
    49  *    BOOL, BYTE, WORD, DWORD, LWORD, USINT, SINT, UINT, INT, UDINT, DINT, ULINT, LINT (as well as the SAFE versions of these data tyes too!)
       
    50  * 
       
    51  *  In this class, the datatype of '0' will be set to the same datatype as the 'foo' variable.
       
    52  *  If the intersection of the candidate datatype lists of the left and right side expressions is empty, 
       
    53  *  then a datatype error has been found, and the datatype is either left at NULL, or set to a pointer of an invalid_type_name_c object!
    33  */
    54  */
    34 
    55 
    35 
    56 
    36 #include "../absyntax_utils/absyntax_utils.hh"
    57 #include "../absyntax_utils/absyntax_utils.hh"
    37 #include "datatype_functions.hh"
    58 #include "datatype_functions.hh"