help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: space vs semicolon - why syntax error with the former ? (octave-3.4.


From: Sergei Steshenko
Subject: Re: space vs semicolon - why syntax error with the former ? (octave-3.4.2)
Date: Tue, 16 Aug 2011 10:52:49 -0700 (PDT)


--- On Tue, 8/16/11, CdeMills <address@hidden> wrote:

> From: CdeMills <address@hidden>
> Subject: Re: space vs semicolon - why syntax error with the former ? 
> (octave-3.4.2)
> To: address@hidden
> Date: Tuesday, August 16, 2011, 10:03 AM
> 
> Sergei Steshenko-2 wrote:
> > 
> > --- On Tue, 8/16/11, Ben Abbott &lt;address@hidden&gt;
> wrote:
> > 
> > 
> >> Back to your example, there is more than one
> interpretation
> >> of ...
> >> 
> >>     for ii = 1:1 ii endfor disp ii ;
> >> 
> >> Ben
> >> 
> > 
> > 'endfor' "balances" 'for', i.e. the parser may forget
> _completely_ (except
> > for input text pointer position) about the whole 'for'
> loop, and after
> > that parse the 'disp' (in this case) part.
> > 
> > I.e. I still don't see how different interpretation
> can be present in
> > this case - to me it looks like the 'for' loop
> statement is unambiguously
> > over, and no special separator (e.g. ';') is necessary
> - simply
> > because of 'endfor' detection.
> > 
> > 
> 
> Sorry, but taking your reasoning literally is bogus: let's
> consider
>  if (0>1) disp('Problem'); end; disp(36)
> if you take for granted that the 'end' close the
> expression, then then
> previous line should be equivalent to
>  ; disp(36)
> which is a syntactically incorrect.
> 
> Regards
> 
> Pascal
> 
> --
> View this message in context: 
> http://octave.1599824.n4.nabble.com/space-vs-semicolon-why-syntax-error-with-the-former-octave-3-4-2-tp3746937p3747777.html
> Sent from the Octave - General mailing list archive at
> Nabble.com.


And why should it be syntactically incorrect in the first place ?

E.g.:

"
address@hidden:~/junk> perl -e ';print "36\n"'
36
address@hidden:~/junk> 
".

Or:

"
address@hidden:~/junk/semicolon_in_c> cat -n main.c
     1  #include <stdio.h>
     2
     3  int main()
     4    {
     5    ;printf("%u\n", 36u);
     6    return 0;
     7    }
address@hidden:~/junk/semicolon_in_c> ~/AFSWD/install/gcc-4.4.6/binsh/gcc -Wall 
-Wextra main.c
address@hidden:~/junk/semicolon_in_c> ./a.out
36
address@hidden:~/junk/semicolon_in_c>   
".

Normal languages do not care about semicolon before a function call.

Regards,
  Sergei.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]