News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Compiler error messages

Started by shantanu@india, Aug 19, 2022, 07:30 AM

Previous topic - Next topic

shantanu@india

Hi,
In quite a number of instances I have found that the compiler error message quite unrelated to the actual syntactical error.
In the following snippet:
display_update:
Inc display_timer     
If display_timer<100 Then Return
    display_timer=0
    Inc disp_timer
    If disp_timer>=0 And disp_timer<50 Then
        If prog=0 Then     
                If wifi_status= "0" Then
                        [u]If page=0 Then[/u]
                            Print At 1,1,"WIFI_OK1" ,Dec2 param1
                            Print At 2,1,Dec2 param2,",",Dec2 param3                             
                        ElseIf page=1 Then
                            Print At 1,1,"WIFI_OK2" ,Dec2 param4
                            Print At 2,1,Dec2 param5,",",Dec2 param6                             
                        ElseIf page=2 Then
                            Print At 1,1,"WIFI_OK3"," DIG I/O"
                            Print At 2,1,"IN=",in1_status,in2_status,in3_status,in4_status,"  OUT=",out1_state,out2_state
                        EndIf
                        led=1
The compiler threw "item missing" error against the underlined part.
After commenting out certain sections of the code compiler generated the true error message " page is a protected keyword used by the compiler..."
I understand that errors have a hierarchy and its difficult to list out the total error messages once the compiler exits in its second pass but maybe something can be done to detect protected keywords in the initial stages.
Regards
Shantanu

joesaliba

Shantanu,

I used page in a code but it detected it immediately, but had not all those nested If's.

In fact, now I use Pge instead of Page.

Joe

shantanu@india

Joe, I have a feeling that the compiler catches all the exceptions but prints selectively.
Les knows better...
Regards
Shantanu

top204

#3
If the compiler gives an "Item Missing" type error message, whatever is placed on that line is not supported by that particular command or directive, so the parser does not know what to do with it. And because it does not recognise what the item is, it gives a generic error message.

The compiler must have generic error messages, otherwise, it would be a task and a half to add meaningful errors for "all" situations, and probably an impossible task. :-) It also has the generic: "Syntax Error" message.