public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Language Reference, updated
@ 2006-11-24 21:52 Robb Romans
  2006-11-29  1:07 ` Martin Hunt
  2006-12-12 20:45 ` Mike Mason
  0 siblings, 2 replies; 18+ messages in thread
From: Robb Romans @ 2006-11-24 21:52 UTC (permalink / raw)
  To: SystemTap


[-- Attachment #1.1: Type: text/plain, Size: 290 bytes --]

I've updated the draft Language Reference. Here it is in gzipped LaTeX 
and PostScript. Comments welcome.

Regards,
Robb

-- 
Robb Romans                    (512) 838-0419
Linux Commando                   T/L 678-0419
robb@linux.vnet.ibm.com          ARS NA5TT
.-- - ..-. ..--..

[-- Attachment #1.2: SystemTap-LangRef-20061122.tex.gz --]
[-- Type: application/x-gzip, Size: 17892 bytes --]

[-- Attachment #1.3: SystemTap-LangRef-20061122.ps.gz --]
[-- Type: application/x-gzpostscript, Size: 85155 bytes --]

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: Language Reference, updated
@ 2006-12-12 21:24 Stone, Joshua I
  2006-12-12 22:19 ` Frank Ch. Eigler
  0 siblings, 1 reply; 18+ messages in thread
From: Stone, Joshua I @ 2006-12-12 21:24 UTC (permalink / raw)
  To: Mike Mason, Robb Romans; +Cc: SystemTap

On Tuesday, December 12, 2006 11:03 AM, Mike Mason wrote:
> Section 6.0.15
> I'm not sure why you'd ever use a ';' by itself instead of a newline.
> Explain further why you'd want to do that if, in fact, it's valid. 

The semicolon is necessary because it's optional.  :-/

Said with less tongue-in-cheek: There are certain grammatical
ambiguities that are due to the fact that the language has no statement
separator.  Remember that statements may also span lines, so a newline
itself is not a separator.  The semicolon then becomes necessary to make
it clear what you intend.  For example:

  probe foo {
    a = b
    ++c
  }

The spacing indicates what I want to happen, but the actual parsing will
produce this:

  probe foo {
    (a) = ((b)++)
    c
  }

Surprise!  Possible fixes here are to add a semicolon after 'b', reorder
'++c' before the assignment, or change it to a postincrement, 'c++'.

You might conclude that it's best to always include a semicolon as a
statement separator, but even that can backfire.  Another example:

  probe foo {
    if (a)
      printf("a is true\n");
    else            
      printf("a is false\n");
  }

This will give you "parse error: expected statement", pointing to the
'else' as the problem.  This is because the semicolon gets treated as a
separate statement.  Thus with two statements after an 'if' with no
curly braces, the 'else' becomes invalid syntax.

The second example might actually be a bug, depending on the intentions
of the language designers.  Frank, care to comment?


Josh

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2007-02-27 19:03 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-24 21:52 Language Reference, updated Robb Romans
2006-11-29  1:07 ` Martin Hunt
2006-11-29  7:44   ` Robb Romans
2006-12-06 17:14   ` Robb Romans
2006-12-06 18:41     ` Martin Hunt
2006-12-06 19:51       ` Robb Romans
2006-12-12 20:45 ` Mike Mason
2007-01-31  0:02   ` Robb Romans
2007-02-12 19:22     ` Robb Romans
2007-02-13 19:54       ` Frank Ch. Eigler
2007-02-16 23:59         ` Mike Mason
2007-02-17  0:39           ` Stone, Joshua I
2007-02-22 20:59         ` Robb Romans
2007-02-27 17:58     ` Mike Mason
2007-02-27 18:08       ` Robb Romans
2007-02-27 19:03         ` Robb Romans
2006-12-12 21:24 Stone, Joshua I
2006-12-12 22:19 ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).