From Structured Computer Organization by Tanenbum
A program is a sequence of instructions describing how to perform a
certain task.
-
When trying to see a programming language as a formal languages added with semantics, I heard that a programming language is a set of valid programs (valid according to the syntax and other aspects of the language).
-
When reading Structured Computer Organization by Tanenbum, I understood that a programming languages is a set of instructions, from
Each machine has a machine language, consisting of all the instructions that the machine can execute.
So I wonder if a programming language is a set of programs or a set of instructions? Thanks.
Best Answer
From the perspective of programming language theory
I would say neither. A programming language is 3 things
You can't just call the set of programs a programming language because we, as programmers, care very deeply about how you interpret that program. If I told you I constructed a new language called Nothyp which had the same syntax as Python (accepted the same set of programs) but ran everything backwards (different dynamic semantics) it'd be characterized as the same language if we just looked at the programs they accept!
Plus, in this form proving something like type safety, termination guarantees, or the canonical values lemma is actually reasonably pleasant.
*The static semantics capture the essence of type checking and all the other things a compiler will catch before runtime