Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What programming languages are simply abstractions on top of another programming language?

38 views
Skip to first unread message

Roger L Costello

unread,
Jun 20, 2022, 6:06:46 PM6/20/22
to
Hi Folks,

I am reading "Software Tools" by Kernighan and Plauger. One of the things that
I've learned is that Ratfor is a simple abstraction on top of Fortran. For
example, Ratfor provides a while loop. The while loop can be mechanically
converted to Fortran if-then and goto statements. Really cool!

That got me to wondering, "What other programming languages are simply
abstractions on top of an existing programming language?"

/Roger
[The infamous m4 macrogenerator is used to build what are in effect new
languages like the sendmail configuration and GNU Autoconf. -John]

gah4

unread,
Jun 21, 2022, 12:22:44 PM6/21/22
to
On Monday, June 20, 2022 at 3:06:46 PM UTC-7, Roger L Costello wrote:

(snip)
> That got me to wondering, "What other programming languages are simply
> abstractions on top of an existing programming language?"

About the same time as Ratfor, there was MORTRAN, more
specifically MORTRAN2.

https://www.slac.stanford.edu/vault/collvault/greylit/cgtm/CGTM165.pdf

The MORTRAN2 processor is written in ANSI standard Fortran 66,
with the exception of the need to assign and compare character data.
(Yes, Fortran 66 doesn't guarantee that ability.)

The processor works along with a set of macros that implement structured
programming similar to ratfor.


Not so long after MORTRAN2, and from the same group, is STEP which I
recently posted about. The STEP processor can fully parse its input, mostly
so that error messages are generated correctly.

http://www.bitsavers.org/pdf/stanford/slac/The_STEP_Processor.pdf

As well as I know, STEP is also ANSI standard Fortran 66 with the same
requirement.

As more structured programming was added to Fortran, there was less
need to try to improve it with such processors.

The original C++ was a processor, cfront, that would generate C code, that
was then compiled by a C compiler. I believe not so much later, though,
an actual C++ compiler was available. I don't know if cfront is still around.

The TeX text processor has many built-in operations, but much of plain TeX
is implemented in a standard set of macros. Then LaTeX was implemented
with a different, and larger, set of macros. I believe it satisfies you question.

Then there is WEB, the literate programming system D. Knuth used to write
TeX, which mixes the code (in Pascal) and documentation (in TeX) in
one file. One then processes it with Tangle (to get the code), or Weave
(to get documented and supposed to be more readable source code).


I suspect that there were many programs written for a single use, and
not generally released.

And then there are parser generators, a favorite topic of this group,
which read input that describes the grammar to parse, and generates
C or Java, or some other language, code to actually do it.

I will leave out assemblers, including macro assemblers, and programs
to preprocess assembly code, though they might also satisfy the question.

George Neuner

unread,
Jun 21, 2022, 3:50:06 PM6/21/22
to
On Sat, 18 Jun 2022 19:42:55 +0000, Roger L Costello
<cost...@mitre.org> wrote:

>... "What other programming languages are simply
>abstractions on top of an existing programming language?"

In addition to gah4's excellent list, I would include Lisp in which a
significant fraction is implemented as macros which build on a simpler
version of Lisp. And of course, Lisp's metalanguage is Lisp.

Some amount of Scheme also is macros building on simpler Scheme,
however Scheme's metalanguage is not Scheme but a hybrid that includes
Scheme. How much is implemented using macros depends on the particular
implementation.

YMMV,
George

Christopher F Clark

unread,
Jun 21, 2022, 7:23:02 PM6/21/22
to
There are more than a few languages which compile to the JVM (Java Virtual
Machine).

Lombok for Java, presuming you consider it a language fits that example.

My impression is that Kotlin is an evolution of that.
Scala is another possible example.
I'm sure there are more.

The lisp/scheme people do that quite often with "hygenic macros" and the
"Racket" (or "Dr Racket") parser generator is built using that idea.


--
******************************************************************************

Chris Clark email:
christoph...@compiler-resources.com
Compiler Resources, Inc. Web Site: http://world.std.com/~compres
23 Bailey Rd voice: (508) 435-5016
Berlin, MA 01503 USA twitter: @intel_chris
------------------------------------------------------------------------------

Kaz Kylheku

unread,
Jun 21, 2022, 9:48:59 PM6/21/22
to
On 2022-06-18, Roger L Costello <cost...@mitre.org> wrote:
> Hi Folks,
>
> I am reading "Software Tools" by Kernighan and Plauger. One of the things that
> I've learned is that Ratfor is a simple abstraction on top of Fortran. For
> example, Ratfor provides a while loop. The while loop can be mechanically
> converted to Fortran if-then and goto statements. Really cool!
>
> That got me to wondering, "What other programming languages are simply
> abstractions on top of an existing programming language?"

In the Ratfor spirit, in April 2022, I introduced a new one: cppawk.

https://www.kylheku.com/cgit/cppawk/about/

Using the GNU C preprocessor, with C99 semantics, I managed to build,
for instance, a loop macro that supports multiple clauses that
combine for parallel or nested (cross product) iteration.

Not only are there some userful predefined clauses, but they
are user-definable.

Even the Common Lisp LOOP macro deosn't have user-definable clauses.
I made it possible in five #define statements.

"LOL"

:)

There is a "Mock Lisp" data abstraction layer as well: cons cells
are represented and such. Lists can be passed around and mapped
over (if you have GNU Awk, which has indirect functions).

cppawk provides a case statement which "compiles" either to
a GNU Awk switch (nonstandard extension) or else portable
constructs that work in other Awks.

> /Roger
> [The infamous m4 macrogenerator is used to build what are in effect new
> languages like the sendmail configuration and GNU Autoconf. -John]

GNU m4 underlies the Bison implementation: it's what glues together
the parser skeleton templates with the grammar tables and whatnot
to produce the output.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
0 new messages