The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] Re: uphill both ways, was Re: What would early alternatives to C have been?
@ 2025-03-11 19:24 Bakul Shah via TUHS
  2025-03-11 20:11 ` John R Levine
  0 siblings, 1 reply; 3+ messages in thread
From: Bakul Shah via TUHS @ 2025-03-11 19:24 UTC (permalink / raw)
  To: John Levine; +Cc: tuhs


On Mar 10, 2025, at 7:26 PM, John Levine <johnl@taugh.com> wrote:
> 
> In my 1971 compiler course at Yale, Alan Perlis made us try to write a compiler
> that translated a subset of APL into Basic. He suggested we write it in APL,
> which was a terrible idea, so I wrote it in Trac, for which I happened to have
> written my own interpreter.
> 
> I think my compiler was the only one that worked, and it was pretty clever,
> turning the APL array expressions into structures with array boundaries and
> example expressions, with no array temporaries. It only generated the loops to
> evaluate the expressions when storing into another array.
> 
> Someone got a PhD in 1978 for a similar compiling technique but in 1971 I was a
> 17 year old twerp so what did I know?
> 
> R's,
> John

Pretty impressive for a 17yo!

Isn’t APL syntax rather context sensitive[1]? Neither yacc nor
a RD parser would’ve helped! Unless the subset was limited to a
context free subset.

Tim Budd in his 1978 work made quite a few changes to APL to
ease compilation and used yacc. [I have the book somewhere....]

[1] I do not recall if Iverson's original APL had a context sensitive
grammar but modern APLs do.
 
Given an expression ‘x y z’, its parse depends on the types of
x, y & z. Example: y(x,z) if y is a dyadic verb, x & z are values,
x(y(z)) if x & y are monadic verbs, z a value etc.

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

* [TUHS] Re: uphill both ways, was Re: What would early alternatives to C have been?
  2025-03-11 19:24 [TUHS] Re: uphill both ways, was Re: What would early alternatives to C have been? Bakul Shah via TUHS
@ 2025-03-11 20:11 ` John R Levine
  0 siblings, 0 replies; 3+ messages in thread
From: John R Levine @ 2025-03-11 20:11 UTC (permalink / raw)
  To: Bakul Shah; +Cc: tuhs

On Tue, 11 Mar 2025, Bakul Shah wrote:
>> I think my compiler was the only one that worked, and it was pretty clever,
>> turning the APL array expressions into structures with array boundaries and
>> example expressions, with no array temporaries. It only generated the loops to
>> evaluate the expressions when storing into another array.
>>
>> Someone got a PhD in 1978 for a similar compiling technique but in 1971 I was a
>> 17 year old twerp so what did I know?
>>
>> R's,
>> John
>
> Pretty impressive for a 17yo!
>
> Isn’t APL syntax rather context sensitive[1]? Neither yacc nor
> a RD parser would’ve helped! Unless the subset was limited to a
> context free subset.

APL at the time had a very simple syntax, once you got past all the 
special characters.  I wrote my compiler on a PDP-10 with ASCII terminals 
so I just used keywords like IOTA.

> Tim Budd in his 1978 work made quite a few changes to APL to
> ease compilation and used yacc. [I have the book somewhere....]

There's a copy at the Internet Archive.  He and I were at Yale at the same 
time and we knew each other a little, but neither of us was aware that 
we'd come up with such similar techniques.

> Given an expression ‘x y z’, its parse depends on the types of
> x, y & z. Example: y(x,z) if y is a dyadic verb, x & z are values,
> x(y(z)) if x & y are monadic verbs, z a value etc.

You do need to know whether a symbol is a variable or some kind of 
function, but that's not hard.

Regards,
John Levine, johnl@taugh.com, Taughannock Networks, Trumansburg NY
Please consider the environment before reading this e-mail. https://jl.ly

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

* [TUHS] Re: uphill both ways, was Re: What would early alternatives to C have been?
  2025-03-10  2:28 ` Charles H. Sauer
@ 2025-03-11  2:26   ` John Levine
  0 siblings, 0 replies; 3+ messages in thread
From: John Levine @ 2025-03-11  2:26 UTC (permalink / raw)
  To: tuhs

It appears that Charles H. Sauer <sauer@technologists.com> said:
>In 1971 compiler construction course at UT-Austin, we had to use CDC Fortran to build a compiler for a subset of Algol 60. Undergraduates
>used punch cards and RJE to the 6600/6400 shared by all but the privleged few.

In my 1971 compiler course at Yale, Alan Perlis made us try to write a compiler
that translated a subset of APL into Basic. He suggested we write it in APL,
which was a terrible idea, so I wrote it in Trac, for which I happened to have
written my own interpreter.

I think my compiler was the only one that worked, and it was pretty clever,
turning the APL array expressions into structures with array boundaries and
example expressions, with no array temporaries. It only generated the loops to
evaluate the expressions when storing into another array.

Someone got a PhD in 1978 for a similar compiling technique but in 1971 I was a
17 year old twerp so what did I know?

R's,
John

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

end of thread, other threads:[~2025-03-11 20:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-11 19:24 [TUHS] Re: uphill both ways, was Re: What would early alternatives to C have been? Bakul Shah via TUHS
2025-03-11 20:11 ` John R Levine
  -- strict thread matches above, loose matches on Subject: below --
2025-03-10  2:03 [TUHS] " Douglas McIlroy
2025-03-10  2:28 ` Charles H. Sauer
2025-03-11  2:26   ` [TUHS] Re: uphill both ways, was " John Levine

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