683 return NULL; |
702 return NULL; |
684 } |
703 } |
685 |
704 |
686 |
705 |
687 // void *visit(il_operand_list_c *symbol); |
706 // void *visit(il_operand_list_c *symbol); |
688 |
707 // void *visit(simple_instr_list_c *symbol); |
689 |
|
690 /* | simple_instr_list il_simple_instruction */ |
|
691 /* This object is referenced by il_expression_c objects */ |
|
692 void *print_datatypes_error_c::visit(simple_instr_list_c *symbol) { |
|
693 /* TODO */ |
|
694 return NULL; |
|
695 } |
|
696 |
708 |
697 // SYM_REF1(il_simple_instruction_c, il_simple_instruction, symbol_c *prev_il_instruction;) |
709 // SYM_REF1(il_simple_instruction_c, il_simple_instruction, symbol_c *prev_il_instruction;) |
698 void *print_datatypes_error_c::visit(il_simple_instruction_c *symbol) { |
710 void *print_datatypes_error_c::visit(il_simple_instruction_c *symbol) { |
699 /* TODO */ |
711 prev_il_instruction = symbol->prev_il_instruction; |
700 return NULL; |
712 symbol->il_simple_instruction->accept(*this); |
701 } |
713 prev_il_instruction = NULL; |
702 |
714 return NULL; |
703 // void *visit(simple_instr_list_c *symbol); |
715 } |
|
716 |
|
717 |
704 // void *visit(il_param_list_c *symbol); |
718 // void *visit(il_param_list_c *symbol); |
705 // void *visit(il_param_assignment_c *symbol); |
719 // void *visit(il_param_assignment_c *symbol); |
706 // void *visit(il_param_out_assignment_c *symbol); |
720 // void *visit(il_param_out_assignment_c *symbol); |
707 |
721 |
708 /*******************/ |
722 /*******************/ |
709 /* B 2.2 Operators */ |
723 /* B 2.2 Operators */ |
710 /*******************/ |
724 /*******************/ |
711 void *print_datatypes_error_c::visit(LD_operator_c *symbol) { |
725 void *print_datatypes_error_c::visit(LD_operator_c *symbol) { |
712 prev_il_instruction = symbol; |
|
713 return NULL; |
726 return NULL; |
714 } |
727 } |
715 |
728 |
716 void *print_datatypes_error_c::visit(LDN_operator_c *symbol) { |
729 void *print_datatypes_error_c::visit(LDN_operator_c *symbol) { |
717 il_operand->accept(*this); |
|
718 if ((symbol->candidate_datatypes.size() == 0) && |
730 if ((symbol->candidate_datatypes.size() == 0) && |
719 (il_operand->candidate_datatypes.size() > 0)) |
731 (il_operand->candidate_datatypes.size() > 0)) |
720 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'LDN' operator."); |
732 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'LDN' operator."); |
721 prev_il_instruction = symbol; |
|
722 return NULL; |
733 return NULL; |
723 } |
734 } |
724 |
735 |
725 void *print_datatypes_error_c::visit(ST_operator_c *symbol) { |
736 void *print_datatypes_error_c::visit(ST_operator_c *symbol) { |
726 /* MANU: |
737 /* MANU: |
727 * if prev_instruction is NULL we can print a message error or warning error like: |
738 * if prev_instruction is NULL we can print a message error or warning error like: |
728 * we can't use a ST like first instruction. |
739 * we can't use a ST like first instruction. |
729 * What do you think? |
740 * What do you think? |
730 */ |
741 */ |
731 il_operand->accept(*this); |
|
732 if ((symbol->candidate_datatypes.size() == 0) && |
742 if ((symbol->candidate_datatypes.size() == 0) && |
733 (il_operand->candidate_datatypes.size() > 0)) |
743 (il_operand->candidate_datatypes.size() > 0)) |
734 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'ST' operator."); |
744 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'ST' operator."); |
735 prev_il_instruction = symbol; |
|
736 return NULL; |
745 return NULL; |
737 } |
746 } |
738 |
747 |
739 void *print_datatypes_error_c::visit(STN_operator_c *symbol) { |
748 void *print_datatypes_error_c::visit(STN_operator_c *symbol) { |
740 /* MANU: |
749 /* MANU: |
741 * if prev_instruction is NULL we can print a message error or warning error like: |
750 * if prev_instruction is NULL we can print a message error or warning error like: |
742 * we can't use a ST like first instruction. |
751 * we can't use a ST like first instruction. |
743 * What do you think? |
752 * What do you think? |
744 */ |
753 */ |
745 il_operand->accept(*this); |
|
746 if ((symbol->candidate_datatypes.size() == 0) && |
754 if ((symbol->candidate_datatypes.size() == 0) && |
747 (il_operand->candidate_datatypes.size() > 0)) |
755 (il_operand->candidate_datatypes.size() > 0)) |
748 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'STN' operator."); |
756 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'STN' operator."); |
749 prev_il_instruction = symbol; |
|
750 return NULL; |
757 return NULL; |
751 } |
758 } |
752 |
759 |
753 void *print_datatypes_error_c::visit(NOT_operator_c *symbol) { |
760 void *print_datatypes_error_c::visit(NOT_operator_c *symbol) { |
754 prev_il_instruction = symbol; |
|
755 return NULL; |
761 return NULL; |
756 } |
762 } |
757 |
763 |
758 void *print_datatypes_error_c::visit(S_operator_c *symbol) { |
764 void *print_datatypes_error_c::visit(S_operator_c *symbol) { |
759 /* TODO: what if this is a FB call ?? */ |
765 /* TODO: what if this is a FB call ?? */ |
760 il_operand->accept(*this); |
|
761 if ((symbol->candidate_datatypes.size() == 0) && |
766 if ((symbol->candidate_datatypes.size() == 0) && |
762 (il_operand->candidate_datatypes.size() > 0)) |
767 (il_operand->candidate_datatypes.size() > 0)) |
763 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'S' operator."); |
768 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'S' operator."); |
764 prev_il_instruction = symbol; |
|
765 return NULL; |
769 return NULL; |
766 } |
770 } |
767 |
771 |
768 void *print_datatypes_error_c::visit(R_operator_c *symbol) { |
772 void *print_datatypes_error_c::visit(R_operator_c *symbol) { |
769 /* TODO: what if this is a FB call ?? */ |
773 /* TODO: what if this is a FB call ?? */ |
770 il_operand->accept(*this); |
|
771 if ((symbol->candidate_datatypes.size() == 0) && |
774 if ((symbol->candidate_datatypes.size() == 0) && |
772 (il_operand->candidate_datatypes.size() > 0)) |
775 (il_operand->candidate_datatypes.size() > 0)) |
773 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'R' operator."); |
776 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'R' operator."); |
774 prev_il_instruction = symbol; |
|
775 return NULL; |
777 return NULL; |
776 } |
778 } |
777 |
779 |
778 void *print_datatypes_error_c::visit(S1_operator_c *symbol) { |
780 void *print_datatypes_error_c::visit(S1_operator_c *symbol) { |
779 handle_implicit_il_fb_invocation(symbol, "S1", symbol->called_fb_declaration); |
781 handle_implicit_il_fb_invocation(symbol, "S1", symbol->called_fb_declaration); |
814 handle_implicit_il_fb_invocation(symbol, "PT", symbol->called_fb_declaration); |
816 handle_implicit_il_fb_invocation(symbol, "PT", symbol->called_fb_declaration); |
815 return NULL; |
817 return NULL; |
816 } |
818 } |
817 |
819 |
818 void *print_datatypes_error_c::visit(AND_operator_c *symbol) { |
820 void *print_datatypes_error_c::visit(AND_operator_c *symbol) { |
819 il_operand->accept(*this); |
|
820 if ((symbol->candidate_datatypes.size() == 0) && |
821 if ((symbol->candidate_datatypes.size() == 0) && |
821 (il_operand->candidate_datatypes.size() > 0)) |
822 (il_operand->candidate_datatypes.size() > 0)) |
822 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'AND' operator."); |
823 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'AND' operator."); |
823 prev_il_instruction = symbol; |
|
824 return NULL; |
824 return NULL; |
825 } |
825 } |
826 |
826 |
827 void *print_datatypes_error_c::visit(OR_operator_c *symbol) { |
827 void *print_datatypes_error_c::visit(OR_operator_c *symbol) { |
828 il_operand->accept(*this); |
|
829 if ((symbol->candidate_datatypes.size() == 0) && |
828 if ((symbol->candidate_datatypes.size() == 0) && |
830 (il_operand->candidate_datatypes.size() > 0)) |
829 (il_operand->candidate_datatypes.size() > 0)) |
831 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'OR' operator."); |
830 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'OR' operator."); |
832 prev_il_instruction = symbol; |
|
833 return NULL; |
831 return NULL; |
834 } |
832 } |
835 |
833 |
836 void *print_datatypes_error_c::visit(XOR_operator_c *symbol) { |
834 void *print_datatypes_error_c::visit(XOR_operator_c *symbol) { |
837 il_operand->accept(*this); |
|
838 if ((symbol->candidate_datatypes.size() == 0) && |
835 if ((symbol->candidate_datatypes.size() == 0) && |
839 (il_operand->candidate_datatypes.size() > 0)) |
836 (il_operand->candidate_datatypes.size() > 0)) |
840 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'XOR' operator."); |
837 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'XOR' operator."); |
841 prev_il_instruction = symbol; |
|
842 return NULL; |
838 return NULL; |
843 } |
839 } |
844 |
840 |
845 void *print_datatypes_error_c::visit(ANDN_operator_c *symbol) { |
841 void *print_datatypes_error_c::visit(ANDN_operator_c *symbol) { |
846 il_operand->accept(*this); |
|
847 if ((symbol->candidate_datatypes.size() == 0) && |
842 if ((symbol->candidate_datatypes.size() == 0) && |
848 (il_operand->candidate_datatypes.size() > 0)) |
843 (il_operand->candidate_datatypes.size() > 0)) |
849 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'ANDN' operator."); |
844 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'ANDN' operator."); |
850 prev_il_instruction = symbol; |
|
851 return NULL; |
845 return NULL; |
852 } |
846 } |
853 |
847 |
854 void *print_datatypes_error_c::visit(ORN_operator_c *symbol) { |
848 void *print_datatypes_error_c::visit(ORN_operator_c *symbol) { |
855 il_operand->accept(*this); |
|
856 if ((symbol->candidate_datatypes.size() == 0) && |
849 if ((symbol->candidate_datatypes.size() == 0) && |
857 (il_operand->candidate_datatypes.size() > 0)) |
850 (il_operand->candidate_datatypes.size() > 0)) |
858 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'ORN' operator."); |
851 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'ORN' operator."); |
859 prev_il_instruction = symbol; |
|
860 return NULL; |
852 return NULL; |
861 } |
853 } |
862 |
854 |
863 void *print_datatypes_error_c::visit(XORN_operator_c *symbol) { |
855 void *print_datatypes_error_c::visit(XORN_operator_c *symbol) { |
864 il_operand->accept(*this); |
|
865 if ((symbol->candidate_datatypes.size() == 0) && |
856 if ((symbol->candidate_datatypes.size() == 0) && |
866 (il_operand->candidate_datatypes.size() > 0)) |
857 (il_operand->candidate_datatypes.size() > 0)) |
867 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'ORN' operator."); |
858 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'ORN' operator."); |
868 prev_il_instruction = symbol; |
|
869 return NULL; |
859 return NULL; |
870 } |
860 } |
871 |
861 |
872 void *print_datatypes_error_c::visit(ADD_operator_c *symbol) { |
862 void *print_datatypes_error_c::visit(ADD_operator_c *symbol) { |
873 il_operand->accept(*this); |
|
874 if ((symbol->candidate_datatypes.size() == 0) && |
863 if ((symbol->candidate_datatypes.size() == 0) && |
875 (il_operand->candidate_datatypes.size() > 0)) |
864 (il_operand->candidate_datatypes.size() > 0)) |
876 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'ADD' operator."); |
865 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'ADD' operator."); |
877 prev_il_instruction = symbol; |
|
878 return NULL; |
866 return NULL; |
879 } |
867 } |
880 |
868 |
881 void *print_datatypes_error_c::visit(SUB_operator_c *symbol) { |
869 void *print_datatypes_error_c::visit(SUB_operator_c *symbol) { |
882 il_operand->accept(*this); |
|
883 if ((symbol->candidate_datatypes.size() == 0) && |
870 if ((symbol->candidate_datatypes.size() == 0) && |
884 (il_operand->candidate_datatypes.size() > 0)) |
871 (il_operand->candidate_datatypes.size() > 0)) |
885 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'SUB' operator."); |
872 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'SUB' operator."); |
886 prev_il_instruction = symbol; |
|
887 return NULL; |
873 return NULL; |
888 } |
874 } |
889 |
875 |
890 void *print_datatypes_error_c::visit(MUL_operator_c *symbol) { |
876 void *print_datatypes_error_c::visit(MUL_operator_c *symbol) { |
891 il_operand->accept(*this); |
|
892 if ((symbol->candidate_datatypes.size() == 0) && |
877 if ((symbol->candidate_datatypes.size() == 0) && |
893 (il_operand->candidate_datatypes.size() > 0)) |
878 (il_operand->candidate_datatypes.size() > 0)) |
894 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'MUL' operator."); |
879 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'MUL' operator."); |
895 prev_il_instruction = symbol; |
|
896 return NULL; |
880 return NULL; |
897 } |
881 } |
898 |
882 |
899 void *print_datatypes_error_c::visit(DIV_operator_c *symbol) { |
883 void *print_datatypes_error_c::visit(DIV_operator_c *symbol) { |
900 il_operand->accept(*this); |
|
901 if ((symbol->candidate_datatypes.size() == 0) && |
884 if ((symbol->candidate_datatypes.size() == 0) && |
902 (il_operand->candidate_datatypes.size() > 0)) |
885 (il_operand->candidate_datatypes.size() > 0)) |
903 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'DIV' operator."); |
886 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'DIV' operator."); |
904 prev_il_instruction = symbol; |
|
905 return NULL; |
887 return NULL; |
906 } |
888 } |
907 |
889 |
908 void *print_datatypes_error_c::visit(MOD_operator_c *symbol) { |
890 void *print_datatypes_error_c::visit(MOD_operator_c *symbol) { |
909 il_operand->accept(*this); |
|
910 if ((symbol->candidate_datatypes.size() == 0) && |
891 if ((symbol->candidate_datatypes.size() == 0) && |
911 (il_operand->candidate_datatypes.size() > 0)) |
892 (il_operand->candidate_datatypes.size() > 0)) |
912 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'MOD' operator."); |
893 STAGE3_ERROR(0, symbol, symbol, "Data type mismatch for 'MOD' operator."); |
913 prev_il_instruction = symbol; |
|
914 return NULL; |
894 return NULL; |
915 } |
895 } |
916 |
896 |
917 void *print_datatypes_error_c::visit(GT_operator_c *symbol) { |
897 void *print_datatypes_error_c::visit(GT_operator_c *symbol) { |
918 prev_il_instruction = symbol; |
|
919 return NULL; |
898 return NULL; |
920 } |
899 } |
921 |
900 |
922 void *print_datatypes_error_c::visit(GE_operator_c *symbol) { |
901 void *print_datatypes_error_c::visit(GE_operator_c *symbol) { |
923 prev_il_instruction = symbol; |
|
924 return NULL; |
902 return NULL; |
925 } |
903 } |
926 |
904 |
927 void *print_datatypes_error_c::visit(EQ_operator_c *symbol) { |
905 void *print_datatypes_error_c::visit(EQ_operator_c *symbol) { |
928 prev_il_instruction = symbol; |
|
929 return NULL; |
906 return NULL; |
930 } |
907 } |
931 |
908 |
932 void *print_datatypes_error_c::visit(LT_operator_c *symbol) { |
909 void *print_datatypes_error_c::visit(LT_operator_c *symbol) { |
933 prev_il_instruction = symbol; |
|
934 return NULL; |
910 return NULL; |
935 } |
911 } |
936 |
912 |
937 void *print_datatypes_error_c::visit(LE_operator_c *symbol) { |
913 void *print_datatypes_error_c::visit(LE_operator_c *symbol) { |
938 prev_il_instruction = symbol; |
|
939 return NULL; |
914 return NULL; |
940 } |
915 } |
941 |
916 |
942 void *print_datatypes_error_c::visit(NE_operator_c *symbol) { |
917 void *print_datatypes_error_c::visit(NE_operator_c *symbol) { |
943 prev_il_instruction = symbol; |
|
944 return NULL; |
918 return NULL; |
945 } |
919 } |
946 |
920 |
947 void *print_datatypes_error_c::visit(CAL_operator_c *symbol) { |
921 void *print_datatypes_error_c::visit(CAL_operator_c *symbol) { |
948 prev_il_instruction = symbol; |
|
949 return NULL; |
922 return NULL; |
950 } |
923 } |
951 |
924 |
952 void *print_datatypes_error_c::visit(CALC_operator_c *symbol) { |
925 void *print_datatypes_error_c::visit(CALC_operator_c *symbol) { |
953 prev_il_instruction = symbol; |
|
954 return NULL; |
926 return NULL; |
955 } |
927 } |
956 |
928 |
957 void *print_datatypes_error_c::visit(CALCN_operator_c *symbol) { |
929 void *print_datatypes_error_c::visit(CALCN_operator_c *symbol) { |
958 prev_il_instruction = symbol; |
|
959 return NULL; |
930 return NULL; |
960 } |
931 } |
961 |
932 |
962 void *print_datatypes_error_c::visit(RET_operator_c *symbol) { |
933 void *print_datatypes_error_c::visit(RET_operator_c *symbol) { |
963 prev_il_instruction = symbol; |
|
964 return NULL; |
934 return NULL; |
965 } |
935 } |
966 |
936 |
967 void *print_datatypes_error_c::visit(RETC_operator_c *symbol) { |
937 void *print_datatypes_error_c::visit(RETC_operator_c *symbol) { |
968 prev_il_instruction = symbol; |
|
969 return NULL; |
938 return NULL; |
970 } |
939 } |
971 |
940 |
972 void *print_datatypes_error_c::visit(RETCN_operator_c *symbol) { |
941 void *print_datatypes_error_c::visit(RETCN_operator_c *symbol) { |
973 prev_il_instruction = symbol; |
|
974 return NULL; |
942 return NULL; |
975 } |
943 } |
976 |
944 |
977 void *print_datatypes_error_c::visit(JMP_operator_c *symbol) { |
945 void *print_datatypes_error_c::visit(JMP_operator_c *symbol) { |
978 prev_il_instruction = symbol; |
|
979 return NULL; |
946 return NULL; |
980 } |
947 } |
981 |
948 |
982 void *print_datatypes_error_c::visit(JMPC_operator_c *symbol) { |
949 void *print_datatypes_error_c::visit(JMPC_operator_c *symbol) { |
983 prev_il_instruction = symbol; |
|
984 return NULL; |
950 return NULL; |
985 } |
951 } |
986 |
952 |
987 void *print_datatypes_error_c::visit(JMPCN_operator_c *symbol) { |
953 void *print_datatypes_error_c::visit(JMPCN_operator_c *symbol) { |
988 prev_il_instruction = symbol; |
|
989 return NULL; |
954 return NULL; |
990 } |
955 } |
991 |
956 |
992 /* Symbol class handled together with function call checks */ |
957 /* Symbol class handled together with function call checks */ |
993 // void *visit(il_assign_operator_c *symbol, variable_name); |
958 // void *visit(il_assign_operator_c *symbol, variable_name); |