Related articles |
---|
From: | Kaz Kylheku <480-992-1380@kylheku.com> |
Newsgroups: | comp.compilers |
Date: | Wed, 22 Jun 2022 01:31:41 -0000 (UTC) |
Organization: | A noiseless patient Spider |
References: | 22-06-047 |
Injection-Info: | gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="24906"; mail-complaints-to="abuse@iecc.com" |
Keywords: | macros |
Posted-Date: | 21 Jun 2022 21:48:57 EDT |
On 2022-06-18, Roger L Costello <costello@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
Return to the
comp.compilers page.
Search the
comp.compilers archives again.