Language Reference, updated
Frank Ch. Eigler
fche@redhat.com
Tue Dec 12 22:19:00 GMT 2006
josh wrote:
> 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.
Yes. (Or, alternately, because it has both prefix and postfix operators.)
> [...] The spacing indicates what I want to happen, but the actual
> parsing will produce this:
> probe foo {
> (a) = ((b)++)
> c
> }
> Surprise! [...]
We could have a "DWIM" post-parse pass, which would emit warnings if
suspicious line spans occur in expression statements.
> You might conclude that it's best to always include a semicolon as a
> statement separator, but even that can backfire. [if () foo; else bar; ]
> This will give you "parse error: expected statement" [...]
I'm ambivalent about how problematic this is. Awk and tcl, for
example are newline sensitive (";" is a separator for multiple
statements on a single line). We all know how python feels. IIRC
dtrace takes the C route.
- FChE
More information about the Systemtap
mailing list