[antlr-interest] Formatting responses was Re: program with ast grammar

William B. Clodius wclodius at los-alamos.net
Tue Nov 3 21:30:38 PST 2009


I am following antlr-interest through email with the Apple Mail  
application. As can be seen below the forwarded response changes my  
formatting (eliminating explicit end of lines in particular) so that  
it is difficult to read. I have seen responses by others with the same  
problem. Is there a a Preferences setting or other way of avoiding the  
changed formatting?

On Nov 3, 2009, at 10:05 PM, William B. Clodius wrote:

>
> On Nov 3, 2009, at 5:18 AM, Михаил Юрушкин wrote:
>> good day,> fortran supports "if construct" with following syntax:>>  
>> [name:] if (..) then> [block]>> else if (..) [name:] then>  
>> [block]....>> else if (..) [name:] then> [block]> else [name:]>  
>> [block]> end if [name]>> for example:> firstIf : if (a>10) then> a  
>> = 10> else if (b>10) : secondIf then> b = 10;> else secondif:> b =  
>> 20;>> else firstif:> a = 20;> endif firstif>
>
> Your syntax is incorrect. The correct syntax (from a recent draft  
> of  F09) is context free (unlike some other aspects of Fortran)     
> if-construct is if-then-stmt    block    [ else-if-stmt         
> block ] ...    [ else-stmt      block ]    end-if-stmt
>    if-then-stmt is [ if-construct-name : ] IF ( scalar-logical- 
> expr )  THEN
>    else-if-stmt is ELSE IF ( scalar-logical-expr ) THEN [ if-  
> construct-name ]
>    else-stmt is ELSE [ if-construct-name ]
>    end-if-stmt is END IF [ if-construct-name ]
> or in your form[name:] if (..) then[block]
> else if (..) then [name][block]....
> else if (..) then  [name][block]else [name][block]end if [name]
> Further the appearance of the if-construct-names must satisfy the   
> constraint
> If the if-then-stmt of an if-construct specifies an if-construct- 
> name,  the corresponding end-ifstmt shall specify the same if- 
> construct-name. If the if-then-stmt of  an if-construct does not  
> specify anif-construct-name, the corresponding end-if-stmt shall not  
> specify an  if-construct-name. If an else-ifstmt or else-stmt  
> specifies an if-construct-name, the corresponding if- then-stmt  
> shall specify the sameif-construct-name.
> i.e. there can only be one name used in all those contexts. If the   
> programmer wants to name the if blocks implicit in the else ifs  
> they  must be explicitly moved to the level of a block. i.e. as  
> legal code  you can have either
> first example:mainIf : if (a>10) then    a = 10else if (b>10)  then  
> mainIf    b = 10;else mainIf    b = 20;endif mainIf
> or
> second example:firstIf : if (a>10) then    a = 10else firstIf     
> secondIf : if (b>10) then        b = 10    else secondif        b =  
> 20    endif secondIfendif firstif
> Verifying the consistency of the names is best put off until after  
> the  syntactic analysis.
> <snip>
> List: http://www.antlr.org/mailman/listinfo/antlr- 
> interestUnsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>



More information about the antlr-interest mailing list