IF (4 < x < 8) THEN blabla
The answer is, yes, at least one: SAIL -- Stanford AI Language.
SAIL is an ALGOL derivative at heart, with two large extensions,
one to support sets and operations thereon and
one to support lists and operations thereon.
The requested construct was a part of the Algol part of the language.
My all-time favourite programming language.
-- Kenn Goutal ...decvax!savax!sii!siia!kgg
-Barry Shein, Boston University
Assuming x, y and z are arbitrary variables :
If x<y fails then x<y<z fails.
If x<y succeeds then its result is y and the whole expression becomes
y<z. Now if that succeeds then the whole expression (x<y<z) succeeds
(resulting in z) else it fails.
By the way Icon also does away with most semicolons, though in a
clumsy way. If a line does not end in a semicolon, but it would
be syntactically valid for there to be one there then, the parser assumes
it's there.
A better way to get rid of semicolons in a free format
language is to design the grammar so that it needs neither statement
(or declaration) separators nor terminators and is still LR(1).
An example is the Turing language. Dave Brosius speculates that
this will make error recovery difficult. However, error recovery in Turing
compilers is quite good, and because there are no forgotten-semicolon
errors less frequent than in Pascal ones. It is almost as easy to recover
by skipping to the next identifier which follows a ")", identifier or
constant as it is to skip till the next semicolon. My experience is
that forgetting meaningful separators (like writting x := 1 x rather
than x := 1 + x) is rare whereas forgetting syntactic artifacts like
";", "(" and ")" is common.
Contrary to Barry Shien's Statement, it is not necessary to forbid
assignments embedded in expressions in free form languages.
For instance this grammar will be unambiguous and LR(1).
Expression --> Identifier | Identifier ":=" Expression
| "(" Expression ")"
Statement --> Expression
Program --> Statement | Program Statement.
If you still want semicolons in your language, add the production
Statement --> ";"
so that those who like to exercise there right little finger
can put in all the statement terminators and/or separators they want.
Theodore Norvell
DCS U of Toronto
In a response to a question about languages that support the construct
if (x < y < z ) bla bla bla, Barry Shein replies something to the effect
that SPSS supports something like this. For the record, so does SAS, but
then the more important question is are either of these really considered
languages by you guys...
Tom Cole
SAS Institute (where we are supposed to know better)
Cary NC USA Earth
--
Darrel J. Van Buer, PhD
System Development Corp.
2525 Colorado Ave
Santa Monica, CA 90406
(213)820-4111 x5449
...{allegra,burdvax,cbosgd,hplabs,ihnp4,orstcs,sdcsvax,ucla-cs,akgua}
!sdcrdcf!darrelj
VAN...@USC-ECL.ARPA
(value relop value relop value)
is indeed (TA TA!) the Korn Shell! (evidenced by the following script)
| Script started on Sun Oct 26 12:32:45 1986
| $ if ((2>1>0)); then echo true; else echo false; fi
| true
| $ if ((1>1>0)); then echo true; else echo false; fi
| false
| $ if ((1>1>1)); then echo true; else echo false; fi
| false
| $ if ((2>1>1)); then echo true; else echo false; fi
| false
| script done on Sun Oct 26 12:35:04 1986
The first person who correctly explains this behavior will have $2.56
donated in their name to the Steinman Charitable Beer Trust.
(Just when you thought this silly subject had died out!)
--
:::::: Artificial Intelligence Machines --- Smalltalk Project ::::::
:::::: Jan Steinman Box 1000, MS 60-405 (w)503/685-2956 ::::::
:::::: tektronix!tekecs!jans Wilsonville, OR 97070 (h)503/657-7703 ::::::