🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

89 total messages Page 2 of 2 Started by Dan Cross Wed, 07 Oct 2026 13:28
Page 2 of 2 • 89 total messages
Re: Comment delimiters
#155
Author: Anton Ertl
Date: Fri, 16 Oct 2026 17:56
71 lines
4211 bytes
EricP <ThatWouldBeTelling@thevillage.com> writes:
>On 2026-Oct-15 02:17, Anton Ertl wrote:
>> My guess as to how this stuff was parsed:
>> 
>> Deal with the first columns as appropriate.  For the rest: Remove any
>> white space.  Use a backtracking parser that tries to match a rule at
>> a time; for the DO statement, simply compare the start with "DO".  If
>> a rule does not match, look at the next rule.
>> 
>> The result is messy, especially when you want to extend the language.
>
>A backtracking parser sounds like way overkill.

A backtracking parser is relatively easy and the memory needs for
parsing just a single statement are small, too.  For an example of how
short a parser generator for a backtracking parser framework can be,
look at the second example in
<https://bernd-paysan.de/screenful.html>.

>I am under the impression that many Fortran 77 compilers used
>hand written lexer and a recursive decent parser.
>The parser passes some local context to the lexer to let it know,
>for example, which set of keywords are active at that point.
>Anyway, that is how I would do it.

The reason why I think of a backtracking parser is that it seems the
easiest way to be able to handle both

DO101I=1.100

and

DO101I=1,100

(examples given on
<https://en.wikipedia.org/wiki/Fortran#Fixed_layout_and_punched_cards>)

>There is a method called "Sale's Algorithm" which was published
>in CACM in the 1960's which describes how to lex up to Fortran 77.

Interesting, but did the FORTRAN team come up with that?  According to
<https://fortran-lang.discourse.group/t/has-anyone-played-with-sales-fortran-classification-algorithm-lately/7802>
the algorithm was published in 1971.

>After that it is pretty standard AST processing.
>The only semantic difference I can think of immediately is
>Fortran's parenthesis rule that forces an order of evaluation
>and would interact with optimizations like common subexpressions.

Searching around, I found little about "order of evaluation" when it
comes to parenthesis in FORTRAN, although I remember hearing or
reading about the significance of parentheses in FORTRAN several
times.  But does it have any relevance beyond determining that a+(b+c)
is evalutated as

t=b+c
r=a+t

rather than

t=a+b
r=t+c

If not, that rule just disallows reassociation, but reassociation is
not something I have seen in common subexpression elimination (or,
more generally, partial redundancy elimination) algorithms anyway.

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Re: Comment delimiters
#156
Author: Thomas Koenig
Date: Fri, 16 Oct 2026 20:35
117 lines
7193 bytes
EricP <ThatWouldBeTelling@thevillage.com> schrieb:
> On 2026-Oct-15 02:17, Anton Ertl wrote:
>> EricP <ThatWouldBeTelling@thevillage.com> writes:
>>> Old FORTRAN is difficult to parse because
>>> a) it did not separate the language into lexical and syntax levels
>>> b) it was white space oblivious except in quoted strings
>>> c) there were no reserved words - keywords were statement
>>>     position and sometimes semantic context dependent.
>>> d) statements were based on punch cards BUT because
>>>     continuation cards used the absence of a C in column 6
>>>     to indicate the start of a new statement, parsers have to
>>>     always look ahead to see in the next card has a C and
>>>     then "unget" the card if not.
>> 
>> Given that the original FORTRAN worked on an IBM 704, I think that the
>> designers made it as easy (and with as little memory) to parse as they
>> could, given the state of the art at the time.  Concerning the points:
>> 
>> a) I guess that the division into lexical and syntax levels had not
>>     been developed at the time; and even later, e.g., Wirth does not
>>     make this distinction in his language definitions, using EBNF down
>>     to the lexical level (although he does define reserved words).
>> 
>> b) Without this distinction, if you ignore white space at all, you
>>     either ignore it everywhere, or give it a special role in your
>>     syntax.  Ignoring is probably simpler.
>> 
>> c) The programming language community took quite a while until it
>>     arrived at reserved words.  E.g., while Algol 60 was specified in
>>     BNF, being modern in that regard, it does not have reserved words,
>>     just symbols that are distinct from all identifiers; i.e., you
>>     could have an identifier like IF in Algol 60, distinct from the
>>     symbol 'IF', and it's up to the implementation how to distinguish
>>     them.  Anyway, without a) reserved words make no sense.
>> 
>> d) Does the original FORTRAN support continuation cards?
>
> Yes. Fortran's continuation card is LL(1) and behaves the same as
> an ISA with start bits - you have to look ahead to find out
> that you didn't need to look ahead, and unget the card.
>
> Statement terminators like ; act like ISA stop bits and don't need lookahead.
>
>>> The classic ambiguous parsing example being
>>>
>>>    DO I = 1,100
>>>    DOI = 1.100
>>>
>>> depends on the presence or absence of a "naked comma" later in the
>>> statement to decide whether there is a keyword DO and a variable I,
>>> or a variable DOI. A "naked comma" is a comma not enclosed inside
>>> a quoted character or string, or inside a possibly nested parenthesis.
>> 
>> My guess as to how this stuff was parsed:
>> 
>> Deal with the first columns as appropriate.  For the rest: Remove any
>> white space.  Use a backtracking parser that tries to match a rule at
>> a time; for the DO statement, simply compare the start with "DO".  If
>> a rule does not match, look at the next rule.
>> 
>> The result is messy, especially when you want to extend the language.
>
> A backtracking parser sounds like way overkill.

I haven't worked on a Fortran 77 compiler, but gfortran, a Fortran
20xx compiler, does exactly that.

It tries matching constructs until they are accepted.  If somethig
does not match, an error message is queued, and the next
match is tried.  If everything failes, then the last error message
is output, and the next statement is looked at.

But that is only a part.  After the AST has been generated, a
lot of checks are run, and details are filled in (the so-called
resolution stage).  Then, some manipulation of the AST and finally
transfer to gcc's GENERIC, a C-like intermediate language.  This is
where things like scalarization are handled.  GCC later lowers the
GENERIC to GIMPLE, which is an SSA variant.

> I am under the impression that many Fortran 77 compilers used
> hand written lexer and a recursive decent parser.
> The parser passes some local context to the lexer to let it know,
> for example, which set of keywords are active at that point.
> Anyway, that is how I would do it.

I think John L. wrote a FORTRAN compiler once.

>
> The first thing a Fortran compiler does is scan ahead loading card
> statements into a card buffer array from the (possibly nested INCLUDE)
> source files until it sees a non-continue card, which it ungets.
>
> Then it checks the format of the cards is ok and extracts things like
> a label from columns 2:5.
>
> Compacting out comments and white space is unnecessary -
> the hand written lexer knows to skip over them.
> There is a method called "Sale's Algorithm" which was published
> in CACM in the 1960's which describes how to lex up to Fortran 77.
>
> The parser knows which statement it is working on so can tell the
> lexer what options it should handle at the point.
> There could be a post pass over the AST to patch up ambiguous
> constructs that require semantic context to fix.
>
> After that it is pretty standard AST processing.
> The only semantic difference I can think of immediately is
> Fortran's parenthesis rule that forces an order of evaluation
> and would interact with optimizations like common subexpressions.

The gfortran front end has INTRINSIC_PARENTHESES , which it then
translates into PAREN_EXPR in the intermediate language.

-- 
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.
Re: Comment delimiters
#159
Author: George Neuner
Date: Fri, 16 Oct 2026 22:57
68 lines
4714 bytes
On Fri, 16 Oct 2026 17:10:24 GMT, anton@mips.complang.tuwien.ac.at
(Anton Ertl) wrote:


>As for convenience, for various compilers I read that either the
>scanner or the parser (or both) were hand-written (I don't remember
>which one was more frequent).  

Scanners.  Parser are a lot of work.

> It certainly does not seem much work to
>write a scanner for a typical programming language by hand (you
>recognize keywords by table lookup of things that will be classified
>as identifiers if they are not in the table).  For the parser of a
>language that is not LL(1), it's more work, but writing it by hand
>allows you to do various things that, e.g., bison does not support

Bison is limited to single (token) lookahead, but since it can
backtrack, and also create LR(1), SLR(1), and GLR(1) parsers as well
as the (yacc-alike) LALR(1) ... well, I've never actually encountered
a situation that Bison couldn't be contorted into handling.
[Of course the contortions required can make the grammar feel
unnatural.]

And Bison doesn't generate lexers (scanners) so they have to be
provided separately.


>(ANTLR has support for "syntactic predicates" and "semantic
>predicates", which probably is good enough for a lot of cases; it was
>written with C++ in mind).

Again, I've never encountered any situation ANTLR can't handle.  ANTLR
can generate both parsers and lexers (scanners), and because they are
recursive descent they tend to be easier to debug (when necessary)
than are Bison/Flex state machines.


Early versions of ANTLR were LL(k): you had to specify the maximum
lookahead required by any rule in your grammar else the parser would
not work correctly [if it could be generated at all].

Starting from version 3, ANTLR became LL(*) which has per-rule
lookahead figured out by the tool.  LL(*) is easier to use, but its
grammars are incompatible with the earlier LL(k) versions.  The LL(*)
versions support parser AND lexer in a single grammar file, whereas
the early versions required them to be separate.

Also starting from version 3, ANTLR is written in Java.  It can
generate code for different target languages (and there are runtime
libraries available for the various targets), but the tool itself
requires a JVM to execute.


Current version is 4.13.2.

I keep 2.7.7 around for Windows and Linux specifically because it was
NOT written in Java. Being LL(k), it is a bit harder to use, and it
targets only C or C++, but AFAIK it is the last version of ANTLR to be
available as a simple executable rather than a jar.


[I am aware that Java programs (at least theoretically) can be
compiled directly to executable. B ut I don't know offhand what Java
compilers can do that, and AFAICT nobody has done it for any modern
versions of ANTLR.

If anybody knows differently, I'm happy to hear that I'm mistaken.]
Re: Optimization by programmers
#160
Author: Dan Cross
Date: Sat, 17 Oct 2026 02:03
579 lines
25226 bytes
In article <1791844557-5857@newsgrouper.org>,
MitchAlsup  <user5857@newsgrouper.org.invalid> wrote:
>cross@spitfire.i.gajendra.net (Dan Cross) posted:
>> In article <1791830267-5857@newsgrouper.org>,
>> MitchAlsup  <user5857@newsgrouper.org.invalid> wrote:
>> >cross@spitfire.i.gajendra.net (Dan Cross) posted:
>> >First off: thank you dan for a well done explanation.
>> >
>> >> In article <1791742457-5857@newsgrouper.org>,
>> >> MitchAlsup  <user5857@newsgrouper.org.invalid> wrote:
>> >> >
>> >> >Terje Mathisen <terje.mathisen@tmsw.no> posted:
>> >> >
>> >> >> Dan Cross wrote:
>> >> >---------
>> >> >> 
>> >> >> My old asm/C brain _knows_ that a slice of something with a known 
>> >> >> address and total length is effectively the same thing as an unmutable 
>> >> >> array.
>> >> >
>> >> >Can I get a definition of what mutable in Rust means ??
>> >> 
>> >--------snip of what I understand clearly------------
>> >> 
>> >> So this will fail to compile:
>> >> 
>> >> ?	let mut foo = something();
>> >> ?	let foomut = &mut foo;	// Ok: only mutable
>> >> ?	let barmut = &mut foo	// Fail: a mut ref to foo exists
>> >
>> >Is this supposed to work across threads ?? so, only 1 thread has write
>> >access at any given point in time.
>> 
>> Yes, that's right.
>> 
>> >If so, how does one thread hand-off mutability to another ??
>> 
>> Typically, you use a mutual exclusion primitive of one kind or
>> another to serialize access to mutable state.  For example, the
>> standard library includes the usual complement of Mutex,
>> reader/writer locks, condition variables, barriers, reference
>> counters, thread-safe channels, and so on.  For bare-metal
>> programs we have to implement these ourselves, but there are
>> some third-party implementations that can help (for example, the
>> `spin` crate implements spinlocks, providing, an interface that
>> looks close to `std::sync::Mutex`).
>> 
>> Something I should have mentioned earlier is that Rust object
>> has a single, well-defined owner, and that references to that
>> object are borrowed _from the owner_.
>
>I was expecting one "thread" to hold (own?) the object in question
>and was unsure how mutablility was handed out across other threads.

I think it may be easier to think of software objects as the
owners, and threads as scopes.  You can certainly have data that
"lives" within the context of a single thread and shared with
other threads, but the fundamental mechanism is the same: you
share some some kind of immutable reference to the (software)
object that actually owns the data and ask it to borrow the
actual data.

>I had imagined that then current mut owner had its 'pointer' go
>out of block and that somehow his no longer having a mutable ref
>to the object somehow got propagated automagically by his leaving
>of the block {which seems untenable}.
>
>falling back on standard ways of passing this stuff around adds hope.
>{{less Ada rendezvous like}}

Yeah.  The thing that makes Rust interesting with respect to
these primitives is how you build them, using interior
mutability and the sharing rules of the language to make
guarantees about the correctness of the locking protocol.

In particular, if you take a resource you want to share, and you
hide it "inside" of some other object that logically "owns" the
resource, and then make it so that the only way you can access
it is via some interface provided by the owning object, then you
can enforce that nothing goes behind the back of the locking
protocol and accesses the shared resource independently.

Put another way, if the only way to get access to the resource
is through a proxy object returned by the owner's `.lock()`
method, and the owner makes sure that only one of those exists
at a time, then you've defacto serialized access to the
resource.  Moreover, this is now enforced statically, by the
_compiler_, at build time.  Your runtime cost on top of the
usual way is zero.

>> So, using `Mutex` as an example, we make the `Mutex` itself the
>> owner of the object: the `.lock()` method lets threads borrow
>> mutable references to the object, and the serialization inherent
>> in the Mutex type and the locking protocol enforces the
>> "mut ^ immut" semantics across threads.
>
>Since I am a CPU guy, I would like to see the asm from any modern 
>architecture perform this handoff ! <please> ?

I mentioned this earlier but it bears repeating: all of this is
logical, at the level of the language.

Within the context of the Rust standard library, when targeting
an existing platform, the library primitives are usually
implemented in terms of familiar system interfaces: futexs on
Linux; pthreads and `pthread_mutex_t` where that's applicable;
whatever Windows does on Windows, and so on.

When you're writing bare metal code, you can roll your own, but
lots of folks just use the `spin` crate.

Once it's compiled, big chunks of it inline and it all lowers
down to more or less standard instruction sequences.  The Rust
compiler generally does pretty well about optimizing the
abstractions away, meaning you're mostly left with "normal"
CAS instructions, barriers, and loads/stores.

See the end of the deep-dive into a spin-Mutex implementation,
with notes on how that maps to a real ISA.

>> Similarly, a `RwLock` can hand out multiple immutable refs to
>> the object, but keeps track of them, and only lets one borrower
>> access a `mut ref` at a time, and only when there are no
>> outstanding immutable refs to it.
>
>Sounds like reference counting...

Kinda.  The property of a read/write lock is that multiple
readers can access the shared thing at one time, but only one
writer (sounds familiar with respect to the borrow checker rules
with respect to mutability, right?).

Building robust, scalable, production-quality RW locks is
surprisingly hard.

Of course, you have to keep track of the number of readers
actively holding the lock at any given time, but if we naively
admit more readers any time that number is >0, we run the risk
of starving writers; a writer may pend waiting on the lock while
readers just keep appearing.  Similarly, if you've got a high
priority writer blocked behind a bunch of readers, you're open
to priority inversion; what if one of the readers blocks?  The
point is, we also need to keep track of pending writers and the
priorities of whatever is contending for the lock.

>> In fact, it's slightly more complex in that `mutex.lock()`
>> actually returns a proxy object that holds onto the reference;
>> its return type is actually, `LockResult<LockGuard<'_, T>>`,
>> where `'_` is an anonymous lifetime, and `T` is the type of the
>> thing protected by the `Mutex`.  `LockResult` lets someone
>> detect a lock that has been poisoned; the `LockGuard` is the
>> thing that holds the ref.  When it goes otu of scope, it
>> automatically unlocks the mutex, and it implements a trait
>> called `Deref` to forward uses on to the ref to the locked
>> object.
>
>Another level of indirection to handle a more complicated issue...

Well, it's more about correctness than addressing a more complex
issue, per se.  Forgive me if I've already posted this link, but
this is a good explanation of what's going on:
https://cliffle.com/blog/rust-mutexes/

>> This all intersects with the `Send`/`Sync` stuff; `Mutex` is
>> `Sync`, and `Mutex` objects themselves are treated as immutable. 
>> So to share access to a `Foo` between threads, I use something
>> like a `Mutex<Foo>`.  This is an example of "Interior
>> Mutability", where something immutable (the `Mutex` object
>> itself) can hold onto something that is mutable.
>> 
>> This raises a question: if all this machinery is required for
>> safe access to shared data across threads anyway, then why all
>> the language-level rules?  The answer is hinted at by the mutex
>> object itself is immutable, we can hand out references to it
>> easily.  Since it owns the (mutable) object the lock protects,
>> it can decide how to hand out references to the object.
>
>We have the same problems with coherent caches and there are 3
>normal solutions {MESI, MOESI, and Directories}

Right.  Interestingly, little of this solves those problems, but
the way we implement e.g., locking can influence how the
software interacts with those things.  See below.

> [snip]

Acknowleding the mention you made about about how this all maps
to the ISA level, let's take a look at an actual program.  Here
is an implementation of a simple spinlock:

```
//! Spin locks in Rust.

#![no_std]

use core::cell::UnsafeCell;
use core::marker::{Send, Sync};
use core::ops::{Deref, DerefMut};
use core::sync::atomic::{AtomicBool, Ordering};

pub struct Lock<T: ?Sized> {
    held: AtomicBool,
    data: UnsafeCell<T>,
}

impl<T> Lock<T> {
    /// Creates a new `Lock` that owns an object of type T.
    pub const fn new(value: T) -> Lock<T> {
        Lock {
            held: AtomicBool::new(false),
            data: UnsafeCell::new(value),
        }
    }

    /// Consumes the lock and returns the contained object.
    pub fn into_inner(self) -> T {
        self.data.into_inner()
     }
}

impl<T: ?Sized> Lock<T> {
    /// Acquires the lock.  Returns a LockGuard that will
    /// release the lock when dropped.
    pub fn lock(&self) -> LockGuard<'_, T> {
        while self.held.load(Ordering::Relaxed) || self.held.swap(true, Ordering::AcqRel) {
            core::hint::spin_loop();
        }
        LockGuard {
            data: unsafe { &mut *self.data.get() },
            lock: self,
        }
    }

    /// Releases the lock, assuming it is held.  Private, so
    /// that the only way to unlock is through the `drop` method
    /// of a `LockGuard<T>` (that itself can only exist as the
    /// result of a successful call to `lock`), or by calling
    /// the unsafe `force_unlock` method.
    fn unlock(&self) {
        self.held.store(false, Ordering::Release);
    }

    /// Force-releases the lock.
    ///
    /// Suppose that a lock guard holding the lock is leaked
    /// (e.g., via `std::mem::forget()`); its `drop` method
    /// can never be called to unlock.  This function provides
    /// an unsafe escape hatch to release the lock.
    ///
    /// # Safety
    ///
    /// Callers must ensure that the lock is currently locked,
    /// that the underlying object is in a state that it is
    /// safe to unlock, and that nothing else will try to unlock
    /// the current lock-holder later; leaked LockGuards must
    /// be forgotten: their `drop` methods must never be
    /// invoked, and their borrows to the lock-owned data must
    /// be gone.
    pub unsafe fn force_unlock(&self) {
        self.unlock();
    }
}

unsafe impl<T: ?Sized + Send> Send for Lock<T> {}
unsafe impl<T: ?Sized + Send> Sync for Lock<T> {}

pub struct LockGuard<'a, T: ?Sized> {
    lock: &'a Lock<T>,
    data: &'a mut T,
}

impl<T: ?Sized> Deref for LockGuard<'_, T> {
    type Target = T;
    fn deref(&self) -> &T {
        self.data
    }
}

impl<T: ?Sized> DerefMut for LockGuard<'_, T> {
    fn deref_mut(&mut self) -> &mut T {
        self.data
    }
}

impl<T: ?Sized> Drop for LockGuard<'_, T> {
    fn drop(&mut self) {
        self.lock.unlock();
    }
}
```

What's going on here?  A couple of notes.  First, the lock
itself is pretty simple: it uses a single atomic boolean for
the lock bit, and holds the data protected by the lock in an
`UnsafeCell` (which it owns, meaning that it owns the data).

The first Rust-related thing that may be unfamiliar is that the
`Lock` type is "generic" over some type `T`; we say little about
what `T` is, but we use the `?Sized` construct to _remove_ the
constraint that the size of `T` must be a compile-time constant.

Rust has types where this is not the case, like slices (`[T]`),
which it describes as "dynamic views" into a "contiguous
sequence" of objects of some type; since the view is dynamic,
the number is not knowable at compile time (it is a runtime
property).  But we want to be able to lock slices, so we use
`?Sized`.  Because the size of `T` cannot be known at compile
time, the `UnsafeCell` that owns it comes last in the structure
definition.

Note the two `impl`s: these are where we define methods on
`Lock<T>`.  The `.lock()` and `.unlock()` (and `force_unlock()`)
methods don't care what size the type is; they only operate on
the lock bit or references to `T` (via the interface of the
unsafe cell that owns the `T`), so we allow `?Sized` for `T`.

On the other hand, the `.new()` and `.into_inner()` methods _do_
care about the size of T: `.new` is a constructor that takes an
instance of T _by value_, which by default _moves_ the T object;
it moves it into the `UnsafeCell` (again, by value, so now the
`UnsafeCell` owns the T), creates a new `Lock<T>` that takes
ownership of the `UnsafeCell` (...and a new `AtomicBool`
initialized to `false` for the lock bit: false=="unlocked").

`.into_inner()` is a bit more interesting: this takes the `Lock`
by value, which moves it, thus consuming it; it then extracts
the T object from the `UnsafeCell` (via the cell's
`.into_inner()` method) and returns the value; we can do this
when we're done with the lock and want to discard it and
retrieve the value it had protected.

The `unsafe impl Send...` and `unsafe impl Sync...` tell the
language that we are implementing the `Send` and `Sync` traits
I mentioned the other day, for `Lock<T>`.  These are `unsafe`
because we are taking the responsibility for ensuring that the
rules around send and sync are upheld, and not leaving that to
the compiler.

There's also `.force_unlock`, but let me talk about `LockGuard`
first.

Note that `.lock()` doesn't return e.g., a reference to the
locked object in the `UnsafeCell` owned by the lock.  Instead,
it returns an onject of type `LockGuard<T>`, that has two data
members, both of which are references: one (a mutable borrow,
hence unique) to the object protected by the lock, and the
other, an immutable reference to the `Lock` that owns the
object.

A `LockGuard<'a, T>` is a proxy object through which we access
the T object protected by the lock.  We've talked about the
generic "type" parameter, `T`, already, but what is this `'a`
thing?  That is a _lifetime_ parameter: since `LockGuard`'s
data includes _references_, we need to tell the compiler how
long those can live, and what relationship they share (if any).
Here, we say, "these references share some lifetime, that we
call `'a`."

We then provide `impl`'s of three _traits_: a trait is basically
an interface, and describes methods and "associated types".  We
"implement" it for types in order to expose the behavior the
trait describes, for those types.  In this case, we impl
`Deref`, `DerefMut`, and `Drop`.

The first two allow us to use the `*` syntax to indirect through
the `LockGuard<T>` and access the object; hence, when we write,
`let guard = whatever.lock(); dosomething(*guard);`, we are
invoking the `.deref()` method we impl'ed from the `Deref` trait
on guard, and taking _its_ return value and passing that to
`dosomething`: here, that's an `&T`: an immutable borrow of the
T.  `DerefMut` is similar, but used for mutable borrows; the
caveat with `DerefMut` is that the guard object must, itself, be
`mut` to invote `.deref_mut()` on it; the compiler will complain
if not.

The last trait, `Drop`, exposes the `.drop()` method that gets
automatically invoked when the `LockGuard<T>` object is
destroyed (either by going out of scope, or by passing it to the
`drop()` _function_, which takes its argument by value).  In the
case of `LockGuard`, the `.drop` calls `self.lock.unlock();`,
unlocking the lock we've been holding, and giving another thread
a chance to grab the lock: note that `Lock<T>`'s `.unlock()`
method is _not_ marked `pub`: it is a private interface.
`LockGuard` can call it because it's defined in the same
_module_ as `Lock`, however; hence, the only way to invoke
`.unlock()` on the spinlock is via dropping the `LockGuard`.

I said I'd mention `.force_unlock()`, and now's the time:
everything I just said is a shameless lie.  Well, not exactly,
but it is possible to "leak" a `LockGuard` so that it's
`.drop()` method is never called; the first is by passing it to,
`std::mem::forget`:
https://doc.rust-lang.org/std/mem/fn.forget.html

Using `std::mem::forget`, it's possible to "leak" a locked
object.  So, the `.force_unlock` method is provided as an
escape hatch for situations where you know that the guard that
proxied a lock is gone and not coming back, but you still want
to be able unlock the lock.  Thus, it is both _public_ and also
marked `unsafe`: this means that anyone who can get a reference
to the `lock` can call it, but they _must_ do so from inside an
`unsafe` block: the programmer takes on the responsibility of
ensuring that the invariants the lock requires are upheld if
they call it, and the compiler washes its hands of the
consequences.

Let's look at man example program that uses this:

```
fn main() {
    let lock = spinlock::Lock::new(1);
    let mut v = lock.lock();
    *v -= 1;
    std::mem::forget(v);
    unsafe {
        lock.force_unlock();
    }
    let val = lock.into_inner();
    println!("val = {val}");
    let v = threaded_add(16, 128);
    println!("v = {v}");
}

#[inline(never)]
fn threaded_add(nthread: u16, niter: u16) -> u32 {
    let lock = spinlock::Lock::new(0);
    std::thread::scope(|scope| {
        for _ in 0..nthread {
            scope.spawn(|| count(&lock, niter));
        }
    });
    lock.into_inner()
}

#[inline(never)]
fn count(lock: &spinlock::Lock<u32>, niter: u16) {
    for _k in 0..niter {
        let mut v = lock.lock();
        *v += 1;
    }
}

#[cfg(test)]
#[test]
fn threaded_add_works() {
    assert_eq!(threaded_add(16, 1024), 16384);
}
```

Ok, so there are a couple of things going on here; first, I
create a new spinlock around an unsigned 32-bit integer
containing the value `1`, then I lock it and assign the result
to a mutable LockGuard, `v`; I use that to subtract 1 from the
value of the locked object, and then I `std::mem::forget` the
guard.  I unlock the object via calling `.force_unlock()` in an
`unsafe { ... }` block, and then I consume the lock and get
the integer's counter from `.into_inner()` and print it out.

Next, I invoke this `threaded_add`, which creates a locked
counter, creates a few threads, and in each of those threads,
runs a loop that repeatedly locks the counter, adds one to it,
and drops the lock guard (implicitly, by letting it go out of
scope at the at the end of the loop body).  Note that I broke
the counting loop out into a function annotated with the,
`[inline(never)]` _attribute_: this is just so I can find it
easily in assembly language output when I dump out the
instructions with `objdump` below.

All of the threads I create are "scoped", which means that they
are definitely reaped when the scope ends, and thus can't hold
references to the lock after they complete; this way, I can
safely consume the lock in with `.into_inner()` and return the
value of the counter from `threaded_add`.

Back in `main`, I capture the value returned from `threaded_add`
and _bind_ it to a variable I'm calling `v`; you may notice that
is the same name I had used for the `LockGuard` I created
earlier this was deliberate to demonstrate that `let` creates
lexical bindings, which can be replaced.  Ordinarily, one would
not usually do this as a matter of good programming practice,
but it _can_ be useful (for example, when casting a value to
some compatible but different type).

There's also a `#[test]` function that runs automatically when
I build and run in test mode.  It just invokes `threaded_add`
with a fixed number of threads and iterations for each, and
asserts the final output.

When run, this program prints:

val = 0
v = 2048

Which is what I expected. 

So what does this look like at the machine code level?  Let's
take a look at an excerpt from an optimized build, for x86_64.
This is the complete compiled output for `count`, shown above:

```
0000000000019aa0 <spinlock::count::hd8ea4fab4f0cabbe>:
   19aa0:       66 85 f6                test   %si,%si
   19aa3:       74 2a                   je     19acf <spinlock::count::hd8ea4fab4f0cabbe+0x2f>
   19aa5:       55                      push   %rbp
   19aa6:       48 89 e5                mov    %rsp,%rbp
   19aa9:       31 c0                   xor    %eax,%eax
   19aab:       eb 05                   jmp    19ab2 <spinlock::count::hd8ea4fab4f0cabbe+0x12>
   19aad:       cc                      int3
   19aae:       cc                      int3
   19aaf:       cc                      int3
   19ab0:       f3 90                   pause
   19ab2:       0f b6 0f                movzbl (%rdi),%ecx
   19ab5:       84 c9                   test   %cl,%cl
   19ab7:       75 f7                   jne    19ab0 <spinlock::count::hd8ea4fab4f0cabbe+0x10>
   19ab9:       b1 01                   mov    $0x1,%cl
   19abb:       86 0f                   xchg   %cl,(%rdi)
   19abd:       84 c9                   test   %cl,%cl
   19abf:       75 ef                   jne    19ab0 <spinlock::count::hd8ea4fab4f0cabbe+0x10>
   19ac1:       ff 47 04                incl   0x4(%rdi)
   19ac4:       ff c0                   inc    %eax
   19ac6:       c6 07 00                movb   $0x0,(%rdi)
   19ac9:       66 39 f0                cmp    %si,%ax
   19acc:       75 e4                   jne    19ab2 <spinlock::count::hd8ea4fab4f0cabbe+0x12>
   19ace:       5d                      pop    %rbp
   19acf:       c3                      retq
```

Here, `%rdi` is the reference to the `Lock<T>` and `%rsi` holds
`niter`.  The first couple of instructions short-circuit an
argument of zero iterations, then do the usual function prologue
stuff and jump into the spin loop, (aligned on a 16 byte
boundary); there's the relaxed load at 0x19ab2, a test to see
if it's zero, and if not, jump back to the `PAUSE` (the
`std::hint::spin_loop()` call in the code).  Otherwise, we
`xchg` the contents of the lock bit with a 1 (the
`self.lock.swap(true, Ordering::AcqRel)` in the code) and test
again; if we didn't win, it's a jump back to the pause and try
again.  Otherwise, we increment the 32-bit word at offset 0x4
from the beginning of the lock (the shared counter), increment
the iteration count (in `%ax`), compare against the limit, and
either jump back to the locking loop, or do the usual epilogue
and return.

Note that all of the abstraction: the `.lock`, `LockGuard`, and
so on, is inlined and removed by the compiler.  We're left with
pretty reasonable code.

The only other interesting bits of code are in `threaded_add`,
and there's not that much that's relevant there: the `Lock<T>`
holding a `u32` initialized to zero and the lock at is created
on the stack alongside some space for a few other temporary
registers, and the object itself is "created" with two
instructions:

```
   196fd:       48 83 ec 78             sub    $0x78,%rsp
   ...
   19707:       c6 45 b0 00             movb   $0x0,0xffffffffffffffb0(%rbp)
   1970b:       c7 45 b4 00 00 00 00    movl   $0x0,0xffffffffffffffb4(%rbp)
```

Plumbing that into the threads that get created is a little
tedious, but not terribly interesting; it's just a couple of
`mov`s and `jmp`/`callq`s.  The ending `.into_inner()` call is
just:

```
   19892:       8b 45 b4                mov    0xffffffffffffffb4(%rbp),%eax
```

Right before cleaning up the stack, popping callee saved
registers, and the `retq`.

The full code is at https://github.com/dancrossnyc/spinlock.

Hope this helps?

	- Dan C.
Re: FORTRAN, was Comment delimiters
#162
Author: John Levine
Date: Sat, 17 Oct 2026 03:49
28 lines
2518 bytes
According to EricP  <ThatWouldBeTelling@thevillage.com>:
>I am under the impression that many Fortran 77 compilers used
>hand written lexer and a recursive decent parser.
>The parser passes some local context to the lexer to let it know,
>for example, which set of keywords are active at that point.
>Anyway, that is how I would do it.

I wrote a production FORTRAN 77 compiler.  It had a hand written lexer
and a yacc parser.

It made a prepass over each statement to combine continuation cards and to tell
whether it's an assignment statement or statement function (they're
syntactically the same) or something else. Once it knows that, the lexer is
straightforward using feedback from the parser to know what tokens are allowed
at each point.  As I recall there were about a dozen states, most of which were
simple, e.g., after a DO keyword the next thing has to be a digit string
which is a statement number.

The prepass was needed to disambiguate DO10I=1.10 and also to handle stuff like this:

10    FORMAT(I10,A5)       // a format statement

20    FORMAT(I10,A5) = 42  // an assignment statement

-- 
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly
Re: FORTRAN, was Comment delimiters
#163
Author: John Levine
Date: Sat, 17 Oct 2026 03:56
29 lines
2257 bytes
According to Anton Ertl <anton@mips.complang.tuwien.ac.at>:
>The reason why I think of a backtracking parser is that it seems the
>easiest way to be able to handle both
>
>DO101I=1.100
>
>and
>
>DO101I=1,100

At least when I did it, backtracking parsers were big and ugly
compared to little yacc parsers. I used Sale's algorithm
although I didn't know that's what it was called when I reinvented it.

>>There is a method called "Sale's Algorithm" which was published
>>in CACM in the 1960's which describes how to lex up to Fortran 77.
>
>Interesting, but did the FORTRAN team come up with that?

I think we can assume they did since it's by far the easiest way to
parse card image FORTRAN.  If anyone really cares I believe the
assembler source of some early compilers is available online.

R's,
John
-- 
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly
Re: Comment delimiters
#164
Author: John Levine
Date: Sat, 17 Oct 2026 04:01
18 lines
2031 bytes
According to Anton Ertl <anton@mips.complang.tuwien.ac.at>:
>As for convenience, for various compilers I read that either the
>scanner or the parser (or both) were hand-written (I don't remember
>which one was more frequent). ...

Lexers are usually much slower than parsers because they're O(N) in
the number of characters in the source code while parsers are O(N) in
the number of tokens the lexer returned.  So they're worth some effort
to speed up.

There are also tools like re2c which turns regular expressions into
C code which tends to run a lot faster than the table lookup loop
in flex parsers.

-- 
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly
Re: Comment delimiters
#166
Author: John Savard
Date: Sat, 17 Oct 2026 08:51
24 lines
2164 bytes
On Wed, 14 Oct 2026 15:45:41 -0400, EricP
<ThatWouldBeTelling@thevillage.com> wrote:

>People learned a lot of what not to do in language design
>from old FORTRAN.

Oh, yes. My language, EXALT, which I previously called FALCON, before
learning the name was taken (several times), did learn from the

DO 7 I = 1.100

problem.

It still takes stuff from FORTRAN.

In it, a line with _any_ letter in Column 1 is a comment. So the
comments can start two characters earlier!

But assignment statements have to start with the keyword LET... or its
abbreviation, which is just ".".

Also FORTRAN-like: no semicolons needed at the end of the line.

John Savard
Re: Comment delimiters
#168
Author: EricP
Date: Sat, 17 Oct 2026 14:06
98 lines
5339 bytes
On 2026-Oct-16 13:56, Anton Ertl wrote:
> EricP <ThatWouldBeTelling@thevillage.com> writes:
>> On 2026-Oct-15 02:17, Anton Ertl wrote:
>>> My guess as to how this stuff was parsed:
>>>
>>> Deal with the first columns as appropriate.  For the rest: Remove any
>>> white space.  Use a backtracking parser that tries to match a rule at
>>> a time; for the DO statement, simply compare the start with "DO".  If
>>> a rule does not match, look at the next rule.
>>>
>>> The result is messy, especially when you want to extend the language.
>>
>> A backtracking parser sounds like way overkill.
> 
> A backtracking parser is relatively easy and the memory needs for
> parsing just a single statement are small, too.  For an example of how
> short a parser generator for a backtracking parser framework can be,
> look at the second example in
> <https://bernd-paysan.de/screenful.html>.
> 
>> I am under the impression that many Fortran 77 compilers used
>> hand written lexer and a recursive decent parser.
>> The parser passes some local context to the lexer to let it know,
>> for example, which set of keywords are active at that point.
>> Anyway, that is how I would do it.
> 
> The reason why I think of a backtracking parser is that it seems the
> easiest way to be able to handle both
> 
> DO101I=1.100
> 
> and
> 
> DO101I=1,100
> 
> (examples given on
> <https://en.wikipedia.org/wiki/Fortran#Fixed_layout_and_punched_cards>)

F77 already had structured IF THEN ELSE IF THEN ELSE END IF.
DEC F77 enhanced DO drops the loop end statement number and
used END DO instead, and added DO WHILE END DO.
(This one change alone de-rats-nests the source tremendously by
eliminating all the loop label numbers so that label numbers
were only used for unstructured GOTO and FORMAT statements
which are infrequent.)

DEC F77 had a number of enhancements which made the language
more friendly, like tab in column 1 skips to the start of a
statement or ! anywhere is a comment to end of line.
These were adopted by many other F77 compiler vendors
presumably because they wanted to get their customers.
Later many became ANSI standard.

>> There is a method called "Sale's Algorithm" which was published
>> in CACM in the 1960's which describes how to lex up to Fortran 77.
> 
> Interesting, but did the FORTRAN team come up with that?  According to
> <https://fortran-lang.discourse.group/t/has-anyone-played-with-sales-fortran-classification-algorithm-lately/7802>
> the algorithm was published in 1971.
> 
>> After that it is pretty standard AST processing.
>> The only semantic difference I can think of immediately is
>> Fortran's parenthesis rule that forces an order of evaluation
>> and would interact with optimizations like common subexpressions.
> 
> Searching around, I found little about "order of evaluation" when it
> comes to parenthesis in FORTRAN, although I remember hearing or
> reading about the significance of parentheses in FORTRAN several
> times.  But does it have any relevance beyond determining that a+(b+c)
> is evalutated as
> 
> t=b+c
> r=a+t
> 
> rather than
> 
> t=a+b
> r=t+c
> 
> If not, that rule just disallows reassociation, but reassociation is
> not something I have seen in common subexpression elimination (or,
> more generally, partial redundancy elimination) algorithms anyway.

Parenthesis can be used to force an order of execution.
The parenthesis ordering rule is also data type dependent.
It applies to integer, logical (also integer) and real but not strings.

#1  a + b + c    Unordered
#2  (a+b) + c    a+b before +c
#3  a + (b+c)    b+c before +a

This would interact with common subexpression elimination.
Above would not be able to optimize all 3 expressions to 1.
It can replace #1 with #2 or #3, but not both.

I'm not sure but I think parenthesis also could block optimizations
like a*b+a*c => a*(b+c) but (a*b)+(a*c) might not be optimized.
Re: Comment delimiters
#169
Author: EricP
Date: Sat, 17 Oct 2026 14:06
72 lines
6311 bytes
On 2026-Oct-16 13:56, Anton Ertl wrote:
> EricP <ThatWouldBeTelling@thevillage.com> writes:
>> >> There is a method called "Sale's Algorithm" which was published
>> in CACM in the 1960's which describes how to lex up to Fortran 77.
> 
> Interesting, but did the FORTRAN team come up with that?  According to
> <https://fortran-lang.discourse.group/t/has-anyone-played-with-sales-fortran-classification-algorithm-lately/7802>
> the algorithm was published in 1971.

I have a copy of a summary web page saved which seems to have disappeared
but this is what it said:

by Keith Seymour, 1998
"Sale's algorithm

Sale's algorithm (Giles, pers. communication) was published in CACM in the sixties - with an update for Fortran 77 republished in the eighties. Sale's algorithm requires a prepass of each statement to determine whether or not the statement begins with a keyword. The prepass is simple and can be done while scanning to remove comments and white space, and catenating continuation statements together, prior to normal lexical processing.

During the prepass, any characters in a Hollerith, character string (that is, between quotes or apostrophes), and any characters between matching parenthesis are ignored. Those characters are irrelevant to the purpose of the prepass. Of the remaining characters, the scanner must keep track of whether there are any equal signs (=) and whether there are any commas (,). Given the results of the prepass, the lexer should work according to the following rules, illustrated with examples.

     If there was neither a comma nor an equal sign, the statement must begin with a keyword:

     REAL X
         No comma or equal sign, so a keyword must be first and lexer should find the REAL keyword;

     FORMAT(I5,F10.3)
         No comma or equal sign (none outside parenthesis), lexer should find keyword FORMAT.

     If there was an equal sign, but not a comma, the statements must not begin with a keyword:

     REAL X = 5
         No comma, but an equal sign, so no keyword is allowed, lexer should find identifier REALX;

     FORMAT(I5) = 7
         An equal sign, lexer finds identifier FORMAT;

     DO 10 I = 1.10
         Famous, no comma but equal sign is present, identifier DO10I found.

     If there was a comma (equal sign or not), the statement must begin with a keyword:

     DO 10 I = 1, 10
         Both comma and equal sign, keyword DO found.

However, there are still exceptions, This is resolved by collecting more information during the Sale's prepass. If the statement contains parenthetical lists or expressions, look at the first non-blank character after the close of the first parenthetical list/expression and record whether it's a letter. Now add two more rules to the lexer:

     If there was a letter following a parenthetical, then the statement must begin with the keyword IF (very specific rule).

     IF(LOGFLG) X = 5.0
         Has an equal sign, but begins with keyword!

     If there is such a letter, but no equal sign, the statement must end with the keyword THEN (another very specific rule).

     IF(LOGFLG) THEN
         No comma or equal, so IF keyword is found, but there is a second keyword.

Another lexically ambiguous situation occurs with the FUNCTION keyword. To resolve this, it must be known whether this is the first statement of a procedure, or whether it's a subsequent statement. If this is the first statement in the source, or if it's the first statement after an END statement, then the form with an identifier inside the parenthesis is a FUNCTION declaration. In all other circumstances, the statement declares an array.

     This will always declare an array.

     INTEGER FUNCTION A(5)
         An array declaration FUNCTIONA of length 5 (this is not ambiguous).

     If this is the first statement in the source, or if it's the first statement after an END statement, a function is declared.

     INTEGER FUNCTION A(I)
         Either an array or a function is declared.

Except for the keywords inside of an I/O control list (not implemented in f2j), these rules specify how to find all Fortran 77 keywords. Except for THEN and FUNCTION, all non-I/O keywords must be the first token of the statement they're in (with the caveat that they can be the first token of the sub-statement controlled by a logical IF - to which rules 1 to 3 still apply).

Sale's algorithm resolves many of the issues that are frequently cited as major difficulties of lexically scanning Fortran. The algorithm can be implemented during a prepass to quickly identify most of the information that would normally require lookahead when during lexing. From there on, FORTRAN can be quickly and efficiently parsed with the same compiler tools used for more modern languages. The algorithm is easy to code, fast, and the rest of Fortran's syntax is fairly regular once resolved in the lexer."

Re: Comment delimiters
#170
Author: Thomas Koenig
Date: Sat, 17 Oct 2026 14:58
50 lines
3591 bytes
EricP <ThatWouldBeTelling@thevillage.com> schrieb:

> DEC F77 had a number of enhancements which made the language
> more friendly, like tab in column 1 skips to the start of a
> statement

That didn't make it into the language, and also makes calculation
of the line length a bit awkward.  When should the line end?
Remember, collumn 73-80 are ignored.

> or ! anywhere is a comment to end of line.

Was that a DEC extension?  At least it was adapted in Fortran 90.

> These were adopted by many other F77 compiler vendors
> presumably because they wanted to get their customers.

They are a rat's nest.  Yes, many were convenient, but compilers
more or less have to keep supporting them for legacy code.
gfortran has -fdec, which in turn enables around ten extensions,
but not everything is implemented, for example variable formats
or the infamous Q format descriptor.

And, of course, the (in)famous PARAMETER X=20 snafu.

> Parenthesis can be used to force an order of execution.
> The parenthesis ordering rule is also data type dependent.
> It applies to integer, logical (also integer) and real but not strings.

Not sure what use they would be for strings... but where did you get
that information from?
>#1  a + b + c    Unordered
>#2  (a+b) + c    a+b before +c
>#3  a + (b+c)    b+c before +a
>
> This would interact with common subexpression elimination.
> Above would not be able to optimize all 3 expressions to 1.
> It can replace #1 with #2 or #3, but not both.
>
> I'm not sure but I think parenthesis also could block optimizations
> like a*b+a*c => a*(b+c) but (a*b)+(a*c) might not be optimized.

The rule is simple: In Fortran, parameters have to be honored,
otherwise the rules of standard mathematics apply.  So,
a + b - a can be optimized to b.

-- 
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.
Re: FORTRAN, was Comment delimiters
#174
Author: Stefan Monnier
Date: Sat, 17 Oct 2026 15:09
13 lines
2012 bytes
John Levine [2026-10-17 03:56:25] wrote:
> According to Anton Ertl <anton@mips.complang.tuwien.ac.at>:
>> Interesting, but did the FORTRAN team come up with that?
> I think we can assume they did since it's by far the easiest way to
> parse card image FORTRAN.  If anyone really cares I believe the
> assembler source of some early compilers is available online.

Does make one wonder, tho: why didn't they adjust the syntax to avoid
those ambiguities, instead of spending all that effort to try and
resolve them in the compiler?


=== Stefan
Re: FORTRAN, was Comment delimiters
#172
Author: MitchAlsup
Date: Sat, 17 Oct 2026 17:16
33 lines
2283 bytes
John Levine <johnl@taugh.com> posted:

> According to EricP  <ThatWouldBeTelling@thevillage.com>:
> >I am under the impression that many Fortran 77 compilers used
> >hand written lexer and a recursive decent parser.
> >The parser passes some local context to the lexer to let it know,
> >for example, which set of keywords are active at that point.
> >Anyway, that is how I would do it.
> 
> I wrote a production FORTRAN 77 compiler.  It had a hand written lexer
> and a yacc parser.
> 
> It made a prepass over each statement to combine continuation cards and to tell
> whether it's an assignment statement or statement function (they're
> syntactically the same) or something else. Once it knows that, the lexer is
> straightforward using feedback from the parser to know what tokens are allowed
> at each point.  As I recall there were about a dozen states, most of which were
> simple, e.g., after a DO keyword the next thing has to be a digit string
> which is a statement number.
> 
> The prepass was needed to disambiguate DO10I=1.10 and also to handle stuff like this:
> 
> 10    FORMAT(I10,A5)       // a format statement
> 
> 20    FORMAT(I10,A5) = 42  // an assignment statement

Which could be written::

20     FORMAT(I10,A5)
      -
c       comment getting in the way
      -
      - = 42
Re: FORTRAN, was Comment delimiters
#179
Author: John Savard
Date: Sun, 18 Oct 2026 02:03
15 lines
1625 bytes
On Sat, 17 Oct 2026 17:16:39 GMT, MitchAlsup
<user5857@newsgrouper.org.invalid> wrote:

>Which could be written::
>
>20     FORMAT(I10,A5)
>      -
>c       comment getting in the way
>      -
>      - = 42

Yes, but _that_ part is trivial. Take care of continuation cards and
comments in a pass of their own before touching the language proper.

John Savard
Re: Comment delimiters
#182
Author: EricP
Date: Sun, 18 Oct 2026 14:55
89 lines
4614 bytes
On 2026-Oct-17 10:58, Thomas Koenig wrote:
> EricP <ThatWouldBeTelling@thevillage.com> schrieb:
> 
>> DEC F77 had a number of enhancements which made the language
>> more friendly, like tab in column 1 skips to the start of a
>> statement
> 
> That didn't make it into the language, and also makes calculation
> of the line length a bit awkward.  When should the line end?
> Remember, collumn 73-80 are ignored.

That shouldn't be a problem.
A tab in columns 1 to 6 meant jump to column 7, the statement start.

DEC also optionally allowed lines up to 132 characters -
the full width of a VT100 in widescreen mode!

>> or ! anywhere is a comment to end of line.
> 
> Was that a DEC extension?  At least it was adapted in Fortran 90.

Yes

There were lots more. 32 character variables (up from the standard 8).
DEC F77 used a stack and allowed recursion if you were careful
whereas IBM F77 did not (it used static allocation for all local
variables so recursion stomped on their values).

>> These were adopted by many other F77 compiler vendors
>> presumably because they wanted to get their customers.
> 
> They are a rat's nest.  Yes, many were convenient, but compilers
> more or less have to keep supporting them for legacy code.
> gfortran has -fdec, which in turn enables around ten extensions,
> but not everything is implemented, for example variable formats
> or the infamous Q format descriptor.
> 
> And, of course, the (in)famous PARAMETER X=20 snafu.

I don't know that one. Do tell...

>> Parenthesis can be used to force an order of execution.
>> The parenthesis ordering rule is also data type dependent.
>> It applies to integer, logical (also integer) and real but not strings.
> 
> Not sure what use they would be for strings... but where did you get
> that information from?

I have a 1988 copy of the DEC Fortran manual.
I was looking at it for a specific set of parenthesis rules
but no such luck. But it did say that parenthesis do not affect
the value of a character string.

My point being that whereas in many languages the parser can
toss parenthesis, in F77 expressions they may be significant,
and that significance may be semantic dependent.

>> #1  a + b + c    Unordered
>> #2  (a+b) + c    a+b before +c
>> #3  a + (b+c)    b+c before +a
>>
>> This would interact with common subexpression elimination.
>> Above would not be able to optimize all 3 expressions to 1.
>> It can replace #1 with #2 or #3, but not both.
>>
>> I'm not sure but I think parenthesis also could block optimizations
>> like a*b+a*c => a*(b+c) but (a*b)+(a*c) might not be optimized.
> 
> The rule is simple: In Fortran, parameters have to be honored,
> otherwise the rules of standard mathematics apply.  So,
> a + b - a can be optimized to b.
> 

Yes but determining if two expressions are equivalent
and therefore candidates for elimination can require
some massaging first.

#4  a + ((b+c))

the first ( is significant, the second ( is redundant,
and #4 should match #3 and not #2.

But the following string expressions are all equivalent

#5  ('ABC')//('DE')//'F'
#6  'ABC'//('DE'//'F')
#7  'ABC'//'DE'//'F'

Re: Comment delimiters
#196
Author: MitchAlsup
Date: Sun, 18 Oct 2026 17:56
92 lines
4888 bytes
EricP <ThatWouldBeTelling@thevillage.com> posted:

> On 2026-Oct-17 10:58, Thomas Koenig wrote:
> > EricP <ThatWouldBeTelling@thevillage.com> schrieb:
> > 
> >> DEC F77 had a number of enhancements which made the language
> >> more friendly, like tab in column 1 skips to the start of a
> >> statement
> > 
> > That didn't make it into the language, and also makes calculation
> > of the line length a bit awkward.  When should the line end?
> > Remember, collumn 73-80 are ignored.
> 
> That shouldn't be a problem.
> A tab in columns 1 to 6 meant jump to column 7, the statement start.
> 
> DEC also optionally allowed lines up to 132 characters -
> the full width of a VT100 in widescreen mode!
> 
> >> or ! anywhere is a comment to end of line.
> > 
> > Was that a DEC extension?  At least it was adapted in Fortran 90.
> 
> Yes
> 
> There were lots more. 32 character variables (up from the standard 8).
> DEC F77 used a stack and allowed recursion if you were careful
> whereas IBM F77 did not (it used static allocation for all local
> variables so recursion stomped on their values).
> 
> >> These were adopted by many other F77 compiler vendors
> >> presumably because they wanted to get their customers.
> > 
> > They are a rat's nest.  Yes, many were convenient, but compilers
> > more or less have to keep supporting them for legacy code.
> > gfortran has -fdec, which in turn enables around ten extensions,
> > but not everything is implemented, for example variable formats
> > or the infamous Q format descriptor.
> > 
> > And, of course, the (in)famous PARAMETER X=20 snafu.
> 
> I don't know that one. Do tell...
> 
> >> Parenthesis can be used to force an order of execution.
> >> The parenthesis ordering rule is also data type dependent.
> >> It applies to integer, logical (also integer) and real but not strings.
> > 
> > Not sure what use they would be for strings... but where did you get
> > that information from?
> 
> I have a 1988 copy of the DEC Fortran manual.
> I was looking at it for a specific set of parenthesis rules
> but no such luck. But it did say that parenthesis do not affect
> the value of a character string.
> 
> My point being that whereas in many languages the parser can
> toss parenthesis, in F77 expressions they may be significant,
> and that significance may be semantic dependent.
> 
> >> #1  a + b + c    Unordered
> >> #2  (a+b) + c    a+b before +c
> >> #3  a + (b+c)    b+c before +a
> >>
> >> This would interact with common subexpression elimination.
> >> Above would not be able to optimize all 3 expressions to 1.
> >> It can replace #1 with #2 or #3, but not both.
> >>
> >> I'm not sure but I think parenthesis also could block optimizations
> >> like a*b+a*c => a*(b+c) but (a*b)+(a*c) might not be optimized.
> > 
> > The rule is simple: In Fortran, parameters have to be honored,
> > otherwise the rules of standard mathematics apply.  So,
> > a + b - a can be optimized to b.
> > 
> 
> Yes but determining if two expressions are equivalent
> and therefore candidates for elimination can require
> some massaging first.
> 
> #4  a + ((b+c))
> 
> the first ( is significant, the second ( is redundant,
> and #4 should match #3 and not #2.
> 
> But the following string expressions are all equivalent
> 
> #5  ('ABC')//('DE')//'F'
> #6  'ABC'//('DE'//'F')
> #7  'ABC'//'DE'//'F'
> 

I remember concatenation as || not //.
Re: Comment delimiters
#213
Author: Robert Finch
Date: Mon, 19 Oct 2026 02:54
38 lines
2909 bytes
On 2026-10-17 4:51 a.m., John Savard wrote:
> On Wed, 14 Oct 2026 15:45:41 -0400, EricP
> <ThatWouldBeTelling@thevillage.com> wrote:
> 
>> People learned a lot of what not to do in language design
>>from old FORTRAN.
> 
> Oh, yes. My language, EXALT, which I previously called FALCON, before
> learning the name was taken (several times), did learn from the
> 
> DO 7 I = 1.100
> 
> problem.
> 
> It still takes stuff from FORTRAN.
> 
> In it, a line with _any_ letter in Column 1 is a comment. So the
> comments can start two characters earlier!
> 
> But assignment statements have to start with the keyword LET... or its
> abbreviation, which is just ".".
> 
> Also FORTRAN-like: no semicolons needed at the end of the line.
> 
> John Savard

I like the C/C++ style comments. It is handy to have the two types of 
comments. // and /* */. I use // for almost all comments, then /* */ to 
comment out a block of code for debugging. First saw // in COMOL.

On some assemblers a block comment starts with the word “comment” 
beginning in the first character of the line followed by the selected 
delimiter character.

comment ~
This is a comment
~
Re: Comment delimiters
#219
Author: John Savard
Date: Mon, 19 Oct 2026 08:39
19 lines
2433 bytes
On Sun, 18 Oct 2026 22:54:24 -0400, Robert Finch <robfi680@gmail.com>
wrote:

>I like the C/C++ style comments. It is handy to have the two types of 
>comments. // and /* */. I use // for almost all comments, then /* */ to 
>comment out a block of code for debugging.

It should be noted that C originally only had /* and */. // was added
with C++, and then proved so popular that it was then added to some
versions of C.

I included an equivalent of // in my language; I think I used @' or @"
for it, so as to fit into my scheme of strict prefix-property
decoding. That is: since / means divide, it is always and only divide;
* means multiply, so it is always and only multiply. Exponentiation
becomes ^, and @" or whatever becomes the end-of-line comment symbol
since @ always precedes another special character to make a new token.

John Savard
Re: Comment delimiters
#220
Author: John Savard
Date: Mon, 19 Oct 2026 08:42
12 lines
2043 bytes
On Mon, 19 Oct 2026 08:39:10 GMT, quadibloc@invalid.com (John Savard)
wrote:

>I included an equivalent of // in my language; I think I used @' or @"
>for it, so as to fit into my scheme of strict prefix-property
>decoding.

I just checked. I needed @' and @" for handling quotes embedded in
quoted strings, so it is actually @# that was the equivalent of //. /*
and */ have @< and @> as their equivalents.

John Savard
Re: Comment delimiters
#222
Author: Thomas Koenig
Date: Mon, 19 Oct 2026 18:09
146 lines
7150 bytes
EricP <ThatWouldBeTelling@thevillage.com> schrieb:
> On 2026-Oct-17 10:58, Thomas Koenig wrote:
>> EricP <ThatWouldBeTelling@thevillage.com> schrieb:
>> 
>>> DEC F77 had a number of enhancements which made the language
>>> more friendly, like tab in column 1 skips to the start of a
>>> statement
>> 
>> That didn't make it into the language, and also makes calculation
>> of the line length a bit awkward.  When should the line end?
>> Remember, collumn 73-80 are ignored.
>
> That shouldn't be a problem.
> A tab in columns 1 to 6 meant jump to column 7, the statement start.

As long as your editor shows this correctly, and does not indent
up to column 8...

> DEC also optionally allowed lines up to 132 characters -
> the full width of a VT100 in widescreen mode!

Nice way to get vendor lock-in. But it made it into Fortran 90,
but only in free format. Fixed format stayed at the limits of the
IBM 704, which could only read 72 characters from a punched card
because thy used the accumulator and their MQ register for it to
read a line.

>
>>> or ! anywhere is a comment to end of line.
>> 
>> Was that a DEC extension?  At least it was adapted in Fortran 90.
>
> Yes
>
> There were lots more. 32 character variables (up from the standard 8).

Six, actually - the 704 strikes again.  But when Fortran 77
was defined, 36-bit machines with six-bit characters still were
still around, so it was handy to have one word as a symbol
(for compiler writers, not so much for users...)

> DEC F77 used a stack and allowed recursion if you were careful
> whereas IBM F77 did not (it used static allocation for all local
> variables so recursion stomped on their values).

OS/360 calling conventions is one thing they got wrong.

>>> These were adopted by many other F77 compiler vendors
>>> presumably because they wanted to get their customers.
>> 
>> They are a rat's nest.  Yes, many were convenient, but compilers
>> more or less have to keep supporting them for legacy code.
>> gfortran has -fdec, which in turn enables around ten extensions,
>> but not everything is implemented, for example variable formats
>> or the infamous Q format descriptor.
>> 
>> And, of course, the (in)famous PARAMETER X=20 snafu.
>
> I don't know that one. Do tell...

A pre-version of FORTRAN 77 had  PARAMETER X = 20, and DEC
pre-implemented this.  The committee then settled on
PARAMETER (X=20) .

Can't blame them too much, I sort of made the same mistake again.

>
>>> Parenthesis can be used to force an order of execution.
>>> The parenthesis ordering rule is also data type dependent.
>>> It applies to integer, logical (also integer) and real but not strings.
>> 
>> Not sure what use they would be for strings... but where did you get
>> that information from?
>
> I have a 1988 copy of the DEC Fortran manual.
> I was looking at it for a specific set of parenthesis rules
> but no such luck. But it did say that parenthesis do not affect
> the value of a character string.
>
> My point being that whereas in many languages the parser can
> toss parenthesis, in F77 expressions they may be significant,
> and that significance may be semantic dependent.

They are significant, especially in floating point.  Assume (a -
b) + c, where a + c can overflow or cause cancellation.

This allows the progammer control over association where it is
important.

>
>>> #1  a + b + c    Unordered
>>> #2  (a+b) + c    a+b before +c
>>> #3  a + (b+c)    b+c before +a
>>>
>>> This would interact with common subexpression elimination.
>>> Above would not be able to optimize all 3 expressions to 1.
>>> It can replace #1 with #2 or #3, but not both.
>>>
>>> I'm not sure but I think parenthesis also could block optimizations
>>> like a*b+a*c => a*(b+c) but (a*b)+(a*c) might not be optimized.
>> 
>> The rule is simple: In Fortran, parameters have to be honored,
>> otherwise the rules of standard mathematics apply.  So,
>> a + b - a can be optimized to b.
>> 
>
> Yes but determining if two expressions are equivalent
> and therefore candidates for elimination can require
> some massaging first.
>
>#4  a + ((b+c))
>
> the first ( is significant, the second ( is redundant,
> and #4 should match #3 and not #2.
>  
> But the following string expressions are all equivalent
>
>#5  ('ABC')//('DE')//'F'
>#6  'ABC'//('DE'//'F')
>#7  'ABC'//'DE'//'F'

This should actually be the same.  But today's Fortran does
not specia-case strings anyway:

10.1.8

Integrity of parentheses

1 The rules for evaluation specified in 10.1.5 state certain
conditions under which a processor can evaluate an expres- sion
that is different from the one specified by applying the rules
given in 10.1.2 and the rules for interpretation specified in
10.1.5. However, any expression in parentheses shall be treated
as a data entity.

NOTE

For example, in evaluating the expression A + (B – C) where A, B, and
C are of numeric types, the difference of B and C shall be evaluated
before the addition operation is performed; the processor shall not
evaluate the mathematically equivalent expression (A + B) – C.

-- 
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.
Re: Comment delimiters
#233
Author: Dan Cross
Date: Tue, 20 Oct 2026 01:43
26 lines
1990 bytes
In article <6ad5d644.366843@news.eternal-september.org>,
John Savard <quadibloc@invalid.com> wrote:
>On Sun, 18 Oct 2026 22:54:24 -0400, Robert Finch <robfi680@gmail.com>
>wrote:
>
>>I like the C/C++ style comments. It is handy to have the two types of 
>>comments. // and /* */. I use // for almost all comments, then /* */ to 
>>comment out a block of code for debugging.
>
>It should be noted that C originally only had /* and */. // was added
>with C++, and then proved so popular that it was then added to some
>versions of C.

Sorry, a minor historical quibble: `/* ... */` came to C via
PL/1, which the creators of C had used on the Multics project.
The `//` comment delimiters actually came from BCPL, C's
almost-immediate antecedent, but for whatever reason they
preferred the PL/1 style.

C++ picked resurrected the BCPL-style delimiters, up, and as you
noted, they were subsequently added into C.  Incidentally, BCPL
gained the PL/1-style comment delimiters sometime after C became
popular.

	- Dan C.
Re: more Fortran, Comment delimiters
#236
Author: John Levine
Date: Tue, 20 Oct 2026 03:50
19 lines
2105 bytes
According to Thomas Koenig  <tkoenig@netcologne.de>:
>> DEC F77 used a stack and allowed recursion if you were careful
>> whereas IBM F77 did not (it used static allocation for all local
>> variables so recursion stomped on their values).
>
>OS/360 calling conventions is one thing they got wrong.

My PDP-11 Unix F77 used the C compiler's back end, so recursion
worked fine.  I made variables automatic (stack) unless you used
a SAVE statement, which made sense in the PDP-11's limited address space.

It is quite possible to do recursion with the OS/360 calling convention.
Their PL/I compilers did it and I believe the various ALGOL compilers,
which had to support recursion, also used the standard calling sequence.

-- 
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly
Re: more Fortran, Comment delimiters
#252
Author: Bill Findlay
Date: Tue, 20 Oct 2026 19:53
50 lines
2801 bytes
On 20/10/2026 04:50, John Levine wrote:
> According to Thomas Koenig  <tkoenig@netcologne.de>:
>>> DEC F77 used a stack and allowed recursion if you were careful
>>> whereas IBM F77 did not (it used static allocation for all local
>>> variables so recursion stomped on their values).
>>
>> OS/360 calling conventions is one thing they got wrong.
> 
> My PDP-11 Unix F77 used the C compiler's back end, so recursion
> worked fine.  I made variables automatic (stack) unless you used
> a SAVE statement, which made sense in the PDP-11's limited address space.
> 
> It is quite possible to do recursion with the OS/360 calling convention.
> Their PL/I compilers did it and I believe the various ALGOL compilers,
> which had to support recursion, also used the standard calling sequence.
> 

Brian Wichmann (of Whetstone Benchmark fame) gives the following
figures for Ackermann's function, a stress test for recursion.

ALGOL 60, by architecture, mean orders/call, * = estimate

RMCS, VAX                         12.5
XALGOL, B6700                     16.0
RMCS, PE 3200                     17.5
XALGOL B5500                      19.5
ICL, ICL 2900 Series              19.5
Manchester Uni., ICL 1900 Series  33.5

System/3?0, by language and compiler

ALGOL 60, Edinburgh Uni.  /360    21.0
PL/I OPT v1.2.1, IBM      /360    61 *
ALGOL W, Stanford Uni.    /360    74 *
ALGOL 60, Delft Uni.      /360   142 *
PL/I F level v5.4, IBM	  /360   212 *
ALGOL 60, IBM F level     /360   820 *

Make of that what you will.

And for amusement:

DEC VAX: Language, Compiler

Ada, York Ada global function	   8
C optimised                        9
C	                          10
Ada, York Ada nested function	  11
Ada, RMCS compiler                12.5
Re: more Fortran, Comment delimiters
#254
Author: Thomas Koenig
Date: Tue, 20 Oct 2026 20:15
31 lines
2658 bytes
Bill Findlay <findlaybill@blueyonder.co.uk> schrieb:
> On 20/10/2026 04:50, John Levine wrote:
>> According to Thomas Koenig  <tkoenig@netcologne.de>:
>>>> DEC F77 used a stack and allowed recursion if you were careful
>>>> whereas IBM F77 did not (it used static allocation for all local
>>>> variables so recursion stomped on their values).
>>>
>>> OS/360 calling conventions is one thing they got wrong.
>> 
>> My PDP-11 Unix F77 used the C compiler's back end, so recursion
>> worked fine.  I made variables automatic (stack) unless you used
>> a SAVE statement, which made sense in the PDP-11's limited address space.
>> 
>> It is quite possible to do recursion with the OS/360 calling convention.
>> Their PL/I compilers did it and I believe the various ALGOL compilers,
>> which had to support recursion, also used the standard calling sequence.
>> 
>
> Brian Wichmann (of Whetstone Benchmark fame) gives the following
> figures for Ackermann's function, a stress test for recursion.
>
> ALGOL 60, by architecture, mean orders/call, * = estimate

I understand "ALGOL 60", but not the rest.

What orders?

-- 
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.
Re: more Fortran, Comment delimiters
#257
Author: Scott Lurndal
Date: Tue, 20 Oct 2026 20:44
35 lines
2461 bytes
Thomas Koenig <tkoenig@netcologne.de> writes:
>Bill Findlay <findlaybill@blueyonder.co.uk> schrieb:
>> On 20/10/2026 04:50, John Levine wrote:
>>> According to Thomas Koenig  <tkoenig@netcologne.de>:
>>>>> DEC F77 used a stack and allowed recursion if you were careful
>>>>> whereas IBM F77 did not (it used static allocation for all local
>>>>> variables so recursion stomped on their values).
>>>>
>>>> OS/360 calling conventions is one thing they got wrong.
>>> 
>>> My PDP-11 Unix F77 used the C compiler's back end, so recursion
>>> worked fine.  I made variables automatic (stack) unless you used
>>> a SAVE statement, which made sense in the PDP-11's limited address space.
>>> 
>>> It is quite possible to do recursion with the OS/360 calling convention.
>>> Their PL/I compilers did it and I believe the various ALGOL compilers,
>>> which had to support recursion, also used the standard calling sequence.
>>> 
>>
>> Brian Wichmann (of Whetstone Benchmark fame) gives the following
>> figures for Ackermann's function, a stress test for recursion.
>>
>> ALGOL 60, by architecture, mean orders/call, * = estimate
>
>I understand "ALGOL 60", but not the rest.
>
>What orders?

Archaic terminology for "instructions".

The early Burroughs systems (Electrodata 220, Burroughs 300,
B3500) all called them 'orders' rather than instructions.

In fact, the processor test suite for the B3500 and successors
was called all-orders.
Re: more Fortran, Comment delimiters
#263
Author: John Savard
Date: Tue, 20 Oct 2026 22:49
15 lines
1765 bytes
On Tue, 20 Oct 2026 20:44:45 GMT, scott@slp53.sl.home (Scott Lurndal)
wrote:

>Archaic terminology for "instructions".
>
>The early Burroughs systems (Electrodata 220, Burroughs 300,
>B3500) all called them 'orders' rather than instructions.
>
>In fact, the processor test suite for the B3500 and successors
>was called all-orders.

At one time, the _instruction set_ of a computer was instead referred
to as its "order code".

John Savard
Re: Algol, was more Fortran, Comment delimiters
#267
Author: John Levine
Date: Wed, 21 Oct 2026 03:28
21 lines
2211 bytes
According to Bill Findlay  <findlaybill@blueyonder.co.uk>:
>System/3?0, by language and compiler
>
>ALGOL 60, Edinburgh Uni.  /360    21.0
>PL/I OPT v1.2.1, IBM      /360    61 *
>ALGOL W, Stanford Uni.    /360    74 *
>ALGOL 60, Delft Uni.      /360   142 *
>PL/I F level v5.4, IBM	  /360   212 *
>ALGOL 60, IBM F level     /360   820 *

That looks about right. PL/I F was the original compiler which generated lousy
code, later replaced by PL/I OPT. ALGOL F seems to have been written with the
attitude, you want an Algol compiler? Here's an Algol compiler, suck it up. It
did GETMAIN and FREEMAIN system calls to allocate storage whenever it entered or
left a block. Someone at Princeton patched it to do what PL/I did, allocate
large blocks and suballocate within them, which vastly improved its performance.

-- 
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly
Re: Algol, was more Fortran, Comment delimiters
#269
Author: John Savard
Date: Wed, 21 Oct 2026 14:10
20 lines
2159 bytes
On Wed, 21 Oct 2026 03:28:44 -0000 (UTC), John Levine
<johnl@taugh.com> wrote:

>ALGOL F seems to have been written with the
>attitude, you want an Algol compiler? Here's an Algol compiler, suck it up.

Yes. Unlike ALGOL W you had to indicate the keywords by putting quote
marks around them - although some halfway-serious ALGOL 60 compilers
for other architectures also did this.
I presume that while ALGOL was not in any way a priority at IBM, they
felt that some European customers, at least, might insist on an ALGOL
compiler being available for the computer in order to consider
purchasing a System/360.
Given this, it's somewhat odd that the IBM 7030 or STRETCH went to the
length of including the special characters of publication-level ALGOL
in its character set. But perhaps in the years between the STRETCH and
the 360, the bright hopes for ALGOL that may have existed at its
inception had dimmed.

John Savard
Re: Algol, was more Fortran, Comment delimiters
#276
Author: Dan Cross
Date: Wed, 21 Oct 2026 20:11
19 lines
1676 bytes
In article <6ad8c6dc.5749031@news.eternal-september.org>,
John Savard <quadibloc@invalid.com> wrote:
>On Wed, 21 Oct 2026 03:28:44 -0000 (UTC), John Levine
><johnl@taugh.com> wrote:
>
>>ALGOL F seems to have been written with the
>>attitude, you want an Algol compiler? Here's an Algol compiler, suck it up.
>
>Yes. Unlike ALGOL W you had to indicate the keywords by putting quote
>marks around them - although some halfway-serious ALGOL 60 compilers
>for other architectures also did this.

I don't believe that is true.  The descriptions of AGOL W that
are publicly available do not indicate that quote marks were
required around keywords; I have only seen that on Algol 60
code.

	- Dan C.
Re: Algol, was more Fortran, Comment delimiters
#278
Author: Dan Cross
Date: Wed, 21 Oct 2026 20:38
24 lines
1880 bytes
In article <11bb69i$j4n$1@reader2.panix.com>,
Dan Cross <cross@spitfire.i.gajendra.net> wrote:
>In article <6ad8c6dc.5749031@news.eternal-september.org>,
>John Savard <quadibloc@invalid.com> wrote:
>>On Wed, 21 Oct 2026 03:28:44 -0000 (UTC), John Levine
>><johnl@taugh.com> wrote:
>>
>>>ALGOL F seems to have been written with the
>>>attitude, you want an Algol compiler? Here's an Algol compiler, suck it up.
>>
>>Yes. Unlike ALGOL W you had to indicate the keywords by putting quote
>>marks around them - although some halfway-serious ALGOL 60 compilers
>>for other architectures also did this.
>
>I don't believe that is true.  The descriptions of AGOL W that
>are publicly available do not indicate that quote marks were
>required around keywords; I have only seen that on Algol 60
>code.

Oops, I misread: you said _unlike_ Algol W, and you are
completely correct.  Apologies!

	- Dan C.
Re: more Fortran, Comment delimiters
#280
Author: Bill Findlay
Date: Wed, 21 Oct 2026 22:06
16 lines
1767 bytes
On 20/10/2026 23:49, John Savard wrote:
> On Tue, 20 Oct 2026 20:44:45 GMT, scott@slp53.sl.home (Scott Lurndal)
> wrote:
> 
>> Archaic terminology for "instructions".
>>
>> The early Burroughs systems (Electrodata 220, Burroughs 300,
>> B3500) all called them 'orders' rather than instructions.
>>
>> In fact, the processor test suite for the B3500 and successors
>> was called all-orders.
> 
> At one time, the _instruction set_ of a computer was instead referred
> to as its "order code".
The US-centrism is strong in these replies.
Sigh. (I have taken that over from Nick.)
Re: more Fortran, Comment delimiters
#282
Author: Scott Lurndal
Date: Thu, 22 Oct 2026 00:02
20 lines
1854 bytes
Bill Findlay <findlaybill@blueyonder.co.uk> writes:
>On 20/10/2026 23:49, John Savard wrote:
>> On Tue, 20 Oct 2026 20:44:45 GMT, scott@slp53.sl.home (Scott Lurndal)
>> wrote:
>> 
>>> Archaic terminology for "instructions".
>>>
>>> The early Burroughs systems (Electrodata 220, Burroughs 300,
>>> B3500) all called them 'orders' rather than instructions.
>>>
>>> In fact, the processor test suite for the B3500 and successors
>>> was called all-orders.
>> 
>> At one time, the _instruction set_ of a computer was instead referred
>> to as its "order code".
>The US-centrism is strong in these replies.
>Sigh. (I have taken that over from Nick.)

Perhaps you might, then, enlighten your yank
cousins by providing the UK viewpoint.
Re: more Fortran, Comment delimiters
#288
Author: Bill Findlay
Date: Thu, 22 Oct 2026 22:43
23 lines
2104 bytes
On 22/10/2026 01:02, Scott Lurndal wrote:
> Bill Findlay <findlaybill@blueyonder.co.uk> writes:
>> On 20/10/2026 23:49, John Savard wrote:
>>> On Tue, 20 Oct 2026 20:44:45 GMT, scott@slp53.sl.home (Scott Lurndal)
>>> wrote:
>>>
>>>> Archaic terminology for "instructions".
>>>>
>>>> The early Burroughs systems (Electrodata 220, Burroughs 300,
>>>> B3500) all called them 'orders' rather than instructions.
>>>>
>>>> In fact, the processor test suite for the B3500 and successors
>>>> was called all-orders.
>>>
>>> At one time, the _instruction set_ of a computer was instead referred
>>> to as its "order code".
>> The US-centrism is strong in these replies.
>> Sigh. (I have taken that over from Nick.)
> 
> Perhaps you might, then, enlighten your yank
> cousins by providing the UK viewpoint.

I do, from time to time, and am generally ignored.
Re: more Fortran, Comment delimiters
#291
Author: MitchAlsup
Date: Fri, 23 Oct 2026 00:27
28 lines
2267 bytes
Bill Findlay <findlaybill@blueyonder.co.uk> posted:

> On 22/10/2026 01:02, Scott Lurndal wrote:
> > Bill Findlay <findlaybill@blueyonder.co.uk> writes:
> >> On 20/10/2026 23:49, John Savard wrote:
> >>> On Tue, 20 Oct 2026 20:44:45 GMT, scott@slp53.sl.home (Scott Lurndal)
> >>> wrote:
> >>>
> >>>> Archaic terminology for "instructions".
> >>>>
> >>>> The early Burroughs systems (Electrodata 220, Burroughs 300,
> >>>> B3500) all called them 'orders' rather than instructions.
> >>>>
> >>>> In fact, the processor test suite for the B3500 and successors
> >>>> was called all-orders.
> >>>
> >>> At one time, the _instruction set_ of a computer was instead referred
> >>> to as its "order code".
> >> The US-centrism is strong in these replies.
> >> Sigh. (I have taken that over from Nick.)
> > 
> > Perhaps you might, then, enlighten your yank
> > cousins by providing the UK viewpoint.
> 
> I do, from time to time, and am generally ignored.

That is ALMOST the Casandra Syndrome:: "always tell the truth, 
nobody ever believes"
Re: more Fortran, Comment delimiters
#293
Author: Bill Findlay
Date: Fri, 23 Oct 2026 02:46
34 lines
2545 bytes
On 23/10/2026 01:27, MitchAlsup wrote:
> Bill Findlay <findlaybill@blueyonder.co.uk> posted:
> 
>> On 22/10/2026 01:02, Scott Lurndal wrote:
>>> Bill Findlay <findlaybill@blueyonder.co.uk> writes:
>>>> On 20/10/2026 23:49, John Savard wrote:
>>>>> On Tue, 20 Oct 2026 20:44:45 GMT, scott@slp53.sl.home (Scott Lurndal)
>>>>> wrote:
>>>>>
>>>>>> Archaic terminology for "instructions".
>>>>>>
>>>>>> The early Burroughs systems (Electrodata 220, Burroughs 300,
>>>>>> B3500) all called them 'orders' rather than instructions.
>>>>>>
>>>>>> In fact, the processor test suite for the B3500 and successors
>>>>>> was called all-orders.
>>>>>
>>>>> At one time, the _instruction set_ of a computer was instead referred
>>>>> to as its "order code".
>>>> The US-centrism is strong in these replies.
>>>> Sigh. (I have taken that over from Nick.)
>>>
>>> Perhaps you might, then, enlighten your yank
>>> cousins by providing the UK viewpoint.
>>
>> I do, from time to time, and am generally ignored.
> 
> That is ALMOST the Casandra Syndrome:: "always tell the truth,
> nobody ever believes"

Quite so.
However, it all goes into an archive and will continue
being available to those with curiosity and broad minds.
Re: more Fortran, Comment delimiters
#296
Author: Michael S
Date: Fri, 23 Oct 2026 08:21
45 lines
3209 bytes
On Fri, 23 Oct 2026 03:46:14 +0100
Bill Findlay <findlaybill@blueyonder.co.uk> wrote:

> On 23/10/2026 01:27, MitchAlsup wrote:
> > Bill Findlay <findlaybill@blueyonder.co.uk> posted:
> >   
> >> On 22/10/2026 01:02, Scott Lurndal wrote:  
> >>> Bill Findlay <findlaybill@blueyonder.co.uk> writes:  
> >>>> On 20/10/2026 23:49, John Savard wrote:  
> >>>>> On Tue, 20 Oct 2026 20:44:45 GMT, scott@slp53.sl.home (Scott
> >>>>> Lurndal) wrote:
> >>>>>  
> >>>>>> Archaic terminology for "instructions".
> >>>>>>
> >>>>>> The early Burroughs systems (Electrodata 220, Burroughs 300,
> >>>>>> B3500) all called them 'orders' rather than instructions.
> >>>>>>
> >>>>>> In fact, the processor test suite for the B3500 and successors
> >>>>>> was called all-orders.  
> >>>>>
> >>>>> At one time, the _instruction set_ of a computer was instead
> >>>>> referred to as its "order code".  
> >>>> The US-centrism is strong in these replies.
> >>>> Sigh. (I have taken that over from Nick.)  
> >>>
> >>> Perhaps you might, then, enlighten your yank
> >>> cousins by providing the UK viewpoint.  
> >>
> >> I do, from time to time, and am generally ignored.  
> > 
> > That is ALMOST the Casandra Syndrome:: "always tell the truth,
> > nobody ever believes"  
> 
> Quite so.
> However, it all goes into an archive and will continue
> being available to those with curiosity and broad minds.
> 

Archives?
Google's usenet archives became very unpleasant to use in recent months.
Are there alternatives?



Re: more Fortran, Comment delimiters
#300
Author: David Brown
Date: Fri, 23 Oct 2026 10:49
50 lines
3852 bytes
On 23/10/2026 04:46, Bill Findlay wrote:
> On 23/10/2026 01:27, MitchAlsup wrote:
>> Bill Findlay <findlaybill@blueyonder.co.uk> posted:
>>
>>> On 22/10/2026 01:02, Scott Lurndal wrote:
>>>> Bill Findlay <findlaybill@blueyonder.co.uk> writes:
>>>>> On 20/10/2026 23:49, John Savard wrote:
>>>>>> On Tue, 20 Oct 2026 20:44:45 GMT, scott@slp53.sl.home (Scott Lurndal)
>>>>>> wrote:
>>>>>>
>>>>>>> Archaic terminology for "instructions".
>>>>>>>
>>>>>>> The early Burroughs systems (Electrodata 220, Burroughs 300,
>>>>>>> B3500) all called them 'orders' rather than instructions.
>>>>>>>
>>>>>>> In fact, the processor test suite for the B3500 and successors
>>>>>>> was called all-orders.
>>>>>>
>>>>>> At one time, the _instruction set_ of a computer was instead referred
>>>>>> to as its "order code".
>>>>> The US-centrism is strong in these replies.
>>>>> Sigh. (I have taken that over from Nick.)
>>>>
>>>> Perhaps you might, then, enlighten your yank
>>>> cousins by providing the UK viewpoint.
>>>
>>> I do, from time to time, and am generally ignored.
>>
>> That is ALMOST the Casandra Syndrome:: "always tell the truth,
>> nobody ever believes"
> 
> Quite so.
> However, it all goes into an archive and will continue
> being available to those with curiosity and broad minds.
> 

What do you think is going in the archives here?  All I see is an 
unsubstantiated claim of "US centrism" for something that doesn't really 
matter very much anyway.  I have no idea what terms were used at that 
time, so I have no idea if you are right or not - but you should justify 
your accusations with verifiable facts, or at the very least, anecdotes 
and personal experience.

I am quite confident that our friends across the pond are not being 
intentionally US-centric about their history, but it is natural that 
their own experiences and what they have heard is somewhat biased - just 
like it is for the rest of us.  I occasionally get corrected for my UK 
bias of history, and I appreciate such corrections - I think most people 
appreciate corrections more than unhelpful accusations.
Re: Algol, was more Fortran, Comment delimiters
#823
Author: Tim Rentsch
Date: Fri, 20 Nov 2026 05:58
26 lines
2408 bytes
John Levine <johnl@taugh.com> writes:

> According to Bill Findlay  <findlaybill@blueyonder.co.uk>:
>
>> System/3?0, by language and compiler
>>
>> ALGOL 60, Edinburgh Uni.  /360    21.0
>> PL/I OPT v1.2.1, IBM      /360    61 *
>> ALGOL W, Stanford Uni.    /360    74 *
>> ALGOL 60, Delft Uni.      /360   142 *
>> PL/I F level v5.4, IBM    /360   212 *
>> ALGOL 60, IBM F level     /360   820 *
>
> That looks about right.  PL/I F was the original compiler which
> generated lousy code, later replaced by PL/I OPT.  ALGOL F seems to
> have been written with the attitude, you want an Algol compiler?
> Here's an Algol compiler, suck it up.  It did GETMAIN and FREEMAIN
> system calls to allocate storage whenever it entered or left a
> block.  Someone at Princeton patched it to do what PL/I did,
> allocate large blocks and suballocate within them, which vastly
> improved its performance.

PL/I(F) certainly wasn't the best compiler the world has ever seen.
But it did have the remarkable property of being able to compile
full PL/I, including the macro language, in only 44k bytes of
memory.
Page 2 of 2 • 89 total messages
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads