Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #3355

Re: Are there different programming languages that are compiled to the same intermediate language?

Path csiph.com!1.us.feeder.erje.net!3.us.feeder.erje.net!feeder.erje.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From gah4 <gah4@u.washington.edu>
Newsgroups comp.compilers
Subject Re: Are there different programming languages that are compiled to the same intermediate language?
Date Tue, 31 Jan 2023 22:59:17 -0800 (PST)
Organization Compilers Central
Sender johnl@iecc.com
Approved comp.compilers@iecc.com
Message-ID <23-02-001@comp.compilers> (permalink)
References <Adkz+TvWa4zLl8W9Qd6ovtClKZpZrA==> <23-01-078@comp.compilers>
MIME-Version 1.0
Content-Type text/plain; charset="UTF-8"
Injection-Info gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="6571"; mail-complaints-to="abuse@iecc.com"
Keywords translator, comment
Posted-Date 01 Feb 2023 14:36:58 EST
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
In-Reply-To <23-01-078@comp.compilers>
Xref csiph.com comp.compilers:3355

Show key headers only | View raw


On Sunday, January 29, 2023 at 8:58:58 AM UTC-8, Roger L Costello wrote:

(snip)

> Sally Smith creates Programming_Language_2. Sally wants to leverage the
> compiler work done on Programming_Language_1. She considers two approaches:

> 1. Create a compiler front-end for Programming_Language_2 which compiles
> instances to Intermediate_Code_1.

> 2. Create a translator which converts instances of Programming_Language_2 into
> Programming_Language_1 instances.

The complication with this question is the definition of intermediate language.

Some compilers have a front end, middle end, and back end, with some form of
intermediate code between each. They might be more or less general.

Depending on the compiler writer (or writers), there may be thought and time
to make them more general, allowing for other languages.

But okay, choice 2, especially if the language 1 has a standard, can be useful.
(I was almost going to shorten "Programming_Language_1" to PL-1, but
then realized that some might read that wrong.)

That allows it to be used with other compilers, even ones not written yet.
On the other hand, it is restricted by the features of that language, which
sometimes make things complicated.

In the case of choice 1, you might be able to add new features to the
intermediate language, especially if you can join with its project.

Usually, though, there are some features that don't translate to
language 1.  Or translate in an extremely complicated way.

Usually the translated language is unreadable to most people who
actually know the language.

Some examples.  TeX was written in Pascal.  Well, not really.
It was written in Web, a language and preprocessor that generates
Pascal code to be compiled.  At some point, it was desired to have
it in C instead.  A program was written to translate much of
Pascal into C, but some things were not so easy.  So instead,
the features of the Web preprocessor were used, to convert to
a Pascal-like language, easier to convert to C.  This was made
possible by the macro facilities of Web, and with its change
file feature.

Another one is f2c, which translates Fortran to C, but uses
special library routines and otherwise not so readable output.

Could we have a standard intermediate language, with all
features needed, or that ever will be needed?
[The answer to that last question is no.  It's a very old bad idea,
with the first failed attempt UNCOL in 1958. -John]

Back to comp.compilers | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Are there different programming languages that are compiled to the same intermediate language? Roger L Costello <costello@mitre.org> - 2023-01-29 15:49 +0000
  Re: Are there different programming languages that are compiled to the same intermediate language? Thomas Koenig <tkoenig@netcologne.de> - 2023-01-29 22:14 +0000
    Re: Are there different programming languages that are compiled to the same intermediate language? arnold@freefriends.org (Aharon Robbins) - 2023-01-30 08:03 +0000
  Re: Are there different programming languages that are compiled to the same intermediate language? William Fahle <billfahle@gmail.com> - 2023-01-30 02:00 -0800
  Re: Are there different programming languages that are compiled to the same intermediate language? Roger L Costello <costello@mitre.org> - 2023-01-30 14:36 +0000
  Re: Are there different programming languages that are compiled to the same intermediate language? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-01-30 17:36 +0000
  Re: Are there different programming languages that are compiled to the same intermediate language? gah4 <gah4@u.washington.edu> - 2023-01-31 22:59 -0800
    Re: Are there different programming languages that are compiled to the same intermediate language? gah4 <gah4@u.washington.edu> - 2023-02-02 16:24 -0800
      Re: Are there different programming languages that are compiled to the same intermediate language? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2023-02-03 11:44 +0000
        Re: OoO, VLIW, Are there different programming languages that are compiled to the same intermediate language? gah4 <gah4@u.washington.edu> - 2023-02-03 19:13 -0800
          Re: OoO, VLIW, Are there different programming languages that are compiled to the same intermediate language? gah4 <gah4@u.washington.edu> - 2023-02-04 02:55 -0800
          Re: OoO, VLIW, Are there different programming languages that are compiled to the same intermediate language? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2023-02-07 08:35 +0000
            Re: OoO, VLIW, Are there different programming languages that are compiled to the same intermediate language? gah4 <gah4@u.washington.edu> - 2023-02-08 01:04 -0800

csiph-web