2
votes

Note:I don't mean some theoretical question which don't have any implementation just languages that don't have both!!!!!


These days there exists a c/c++ interpreter(cint) and a python compiler(to python bytecode).

I understand that the simplest definition is that a compiler just converts code from language a to language b, and then you have a machine which runs b it together with input, while an interpreter is simply something that takes input plus code in language a and runs it. And that using these definitions if something has an interpreter or compiler its fairly simple to get the other by immediately running the output of the compiler or embedding the compiler w/ the source code to get an interpreter.

So ignoring those which languages don't have both a compiler (which compile source code in A to B preferably an intermediate language) and an interpreter that run large chunks of code without compiling them?

11
what?...........Mitch Wheat
I think the question is whether there is any other method of producing machine instructions besides compiling or interpreting code... I'm a little curious if anyone has a definitive answer.Dagg Nabbit
I imagine there could be a language used in some proof in theoretical programming theory that is only used as a concept, not to actually run. I know of none, though.Jens
the question "Why?" springs to mind.Mitch Wheat
English, apparently. Many languages do not have both interpreter or a compiler, having merely one or the other. Now, if you were to ask if any languages have neither an interpreter or a compiler ... (sorry, I go out of bed on the wrong side this morning)Mawg says reinstate Monica

11 Answers

2
votes
  Compiler vs. Interpreter

An interpreter translates some form of source code into a target representation that it can immediately execute and evaluate. The structure of the interpreter is similar to that of a compiler, but the amount of time it takes to produce the executable representation will vary as will the amount of optimization. The following diagram shows one representation of the differences. graphic Compiler characteristics:

* spends a lot of time analyzing and processing the program
* the resulting executable is some form of machine- specific binary code
* the computer hardware interprets (executes) the resulting code
* program execution is fast

Interpreter characteristics:

* relatively little time is spent analyzing and processing the program
* the resulting code is some sort of intermediate code
* the resulting code is interpreted by another program
* program execution is relatively slow

alt text
(source: gpollice at web.cs.wpi.edu)

9
votes

There are several esoteric languages that lack either a compiler or interpreter, as they have been designed merely as intellectual exercises, and are waiting for someone to actually implement them.

8
votes

Latin and Aramaic. Two dead languages with translators but insufficient live speakers to warrant any interpreters. You could add Klingon, but I suspect that there actually interpreters for that now.

5
votes

How about translator based languages? Example: pretty much any machine assembly. The assembler just translates code into the machine opcodes.

3
votes

If by interpreter you mean a tool that executes part of the code interactively, then hardware description languages (VHDL, Verilog, ...) I think don't have these. Mostly people simulate VHDL and Verilog descriptions as monoliths to check the net (ahem) effect. Verilog and VHDL are compiled ultimately into gates (for FPGAs) and transistor circuits for implementation as chips.

Similarly, I don't think you'll find many interactive constraint-solver languages. Like the hardware design langauges, constraint programs are mostly executed as monoliths, because a partial constraint will produce too many answers. Constraint solver languages are often compiled to a lower level representation which is "processed" more than interpreted by propagating constraints based on dependences.

As a general rule, neither of these produces "machine instructions".

2
votes

The ladder language for programmable logic controllers (PLC) has no compiler or interpreter. The ladders are converted into boolean conditions to manage inputs, outputs and memory states. Ladders are evaluated thousands times a second to actually run the code on the hardware.

Good luck!

Reference: Programmable logic controller on Wikipedia

1
votes

So I preface this with a claim: any language that has a fixed semantics that can express computable functions is implementable. I'm hedging my bets here by not saying specifically what I mean by the "semantics", but I generally mean something that is either an operational semantics (big or small step), a denotational semantics, or axiomatic semantics.

So, with that out of the way, there remain two questions: Are there languages which don't have any semantics at all (and are therefore not implementable by any of the usual means), or are there languages which haven't been implemented, despite it being possible to do so?

The latter case is obviously true, but it's not very interesting. Just because people dream up a language doesn't mean it's a good idea. I could think of a language right now, and it wouldn't have a compiler or an interpreter. Not very interesting.

The former case is a little more interesting. There are languages that are actually logics and (via the Curry-Howard correspondence) proofs in these logics are also programs (and vice-versa). If the logic is not decidable, or if the language includes some kind of higher-order constructs that are not strongly normalising (such as some very expressive type system), then compilation or interpretation becomes a slightly scary affair. This might start to verge into the territory of "not compiling or interpreting", but that's a slightly spurious claim, because if we can make a computer manipulate these symbols, we can write an interpreter. Similarly, if it has no semantics, then it's probably not operating over computable functions - it's probably just natural language of some kind at that point, no longer a "programming language".

This is especially true because we can argue that the Church-Turing thesis says that it will always be possible to write an interpreter for a Turing-complete language, even if that interpreter ends up being another Turing machine.

I see some other answers have made claims about machine language. There is nothing magical about machine language except that it has a very compact representation. One could very easily write an interpreter for it, and many exist (e.g. the various virtual machines that faithfully implement the execution semantics of a hardware processor in software).

The languages that meet your criteria are likely to be ones that have no execution semantics, i.e. they do not express computable functions. Here are a couple languages with fixed semantics I know of that are not directly executable by either an interpreter or by compiling them to anything else without enriching these programs with additional information:

0
votes

A few small RISC machine codes don't have either, since all they do is push bits around. There's no interpretation since there is no possible lower level to run it at, and there's no compilation since it's already 0s and 1s.

0
votes

One of my classmates can write a complete mic-in to speaker program on an APPLE ][ by punching all the hex codes after a CALL -151. So the answer can probably be: machine code.

0
votes

HTML is a language, but a markup language. I don't know how browsers really parse them, but I assume they interpret them line by line, building up the DOM and rendering elements, etc.

Natural languages, such as English, have a large and ever increasing grammar and are not always expressed in a formal notation (such as BNF) unless you use an exact, precise form. I think.

So I say that you can't really build an interpreter for English, and many natural languages, based on the fact that it's always evolving - look at chatspeak and textspeak even.

I don't think all languages can have a compiler, based on this.

-1
votes

A compiler converts the entire of the source code to some other code, usually machine code or some kind low level intermediate language like java bytecode or .net IL. An interpretter converts the source code line by line as it executes the program. You have to do one or the other unless you write in assembly language, and even that needs turning from assembly language nmemonics into binary machine code.