Discussion:
SL "in" statement
(too old to reply)
James Schofield
2004-06-24 22:26:56 UTC
Permalink
I'm confused about the "in" statement in SL. The language specification
implies a form like:
in x;

But the sample SL programs (e.g. trivial.sl) treat it as a function call
that returns a value:
x <- in();

If the latter form is correct, would a statement like this be valid?
x <- in()+3;


James
Nguyen Nguyen
2004-06-25 01:47:38 UTC
Permalink
You're right. The sample programs and language specification don't agree.
For now, go with the language specification. The sample programs are
probably from a previous term.

So, an "in" statement looks like:
in x; # x is some variable expression

The structure of the "in" statement in total.sl is also incorrect.
Moreover, the line
array [current] <- readInt ();
should be
in array [current];

Nguyen
Post by James Schofield
I'm confused about the "in" statement in SL. The language specification
in x;
But the sample SL programs (e.g. trivial.sl) treat it as a function call
x <- in();
If the latter form is correct, would a statement like this be valid?
x <- in()+3;
James
Nguyen Nguyen
2004-06-27 14:04:20 UTC
Permalink
The SL specification has been changed. The form of an "in" statement is
now:
id <- in ( );

After you correct (or put) this in your .cup file, the provided sample
programs can be used as is to test your solution.

Nguyen
Post by Nguyen Nguyen
You're right. The sample programs and language specification don't agree.
For now, go with the language specification. The sample programs are
probably from a previous term.
in x; # x is some variable expression
The structure of the "in" statement in total.sl is also incorrect.
Moreover, the line
array [current] <- readInt ();
should be
in array [current];
Nguyen
Post by James Schofield
I'm confused about the "in" statement in SL. The language specification
in x;
But the sample SL programs (e.g. trivial.sl) treat it as a function call
x <- in();
If the latter form is correct, would a statement like this be valid?
x <- in()+3;
James
Troy Mark Gonsalves
2004-06-28 16:37:05 UTC
Permalink
The example sl files and the sample in the .cup file were/are correct. The
spec have been modified to reflect this.
Post by James Schofield
But the sample SL programs (e.g. trivial.sl) treat it as a function call
x <- in();
If the latter form is correct, would a statement like this be valid?
x <- in()+3;
no. keep the in and out statements simple (unless you really want to
complicate things).

Loading...