GAP is a computer algebra system (CAS) that Wikipedia tells me is written in C, a procedural programming language. Does this mean we can say GAP's language is procedural? Or is this characterization a misunderstanding of what a CAS is, and what programming paradigms are?
2 Answers
Yes, GAP as a programming language is a procedural language.
"The simplest test to apply is that a language is procedural if it has assignable (mutable) variables", Michael Kay pointed out. The quote below from section 4.8, "variables" of the reference manual of GAP shows GAP can be a procedural language. (I cannot find evidences that show GAP can be classified as a functional language or multi-paradigm language.)
After a variable has been bound to a value an assignment can also be used to bind the variable to another value.
Note that, for most programming languages including many functional languages (or what I know), the runtime/compiler is mostly/partially written in C, mostly because of the requirement of high performance and the need to interact with hardware. Whether the runtime/compiler is written in C has nothing to do with whether the languages themselves are procedural languages or functional languages.
For example, the runtime for GHC, a popular environment for the flagship functional language Haskell is implemented by a mixture of C, assembly and C--.
It looks most of computer algebra systems provide/use procedural programming languages. Many of them such as Maple provide/use multi-paradigm programming languages.
I'd like to focus on this part of the question because it is not answered, yet:
GAP is ... is written in C ...
Does this mean we can say GAP's language is procedural?
No
The sentence "[some language] is written in C" means that the interpreter or compiler is written in C. The sentence does not say anything about the programming language itself.
You may invent any programming language and write a compiler for that language.
If the compiler for your language is written in C programming language, your language is "written in C".
If your language does not know the concept of procedures and/or functions, your language is not "procedural".
Does it make sense to call GAP a "procedural" language?
I can't answer this question because I don't know GAP.
However, if it is a "procedural" language, the reason for being a "procedural" language is because GAP knows the concept of functions and procedures.
The fact that GAP is written in C is not a criterion for saying that GAP is "procedural".
-
$\begingroup$ Despite the name, I don't think that having functions or procedures is the main test of whether a language is procedural (indeed, "procedural language" is usually contrasted with "functional language"). The simplest test to apply is that a language is procedural if it has assignable (mutable) variables, and a quick glance at GAP suggests that it does. $\endgroup$ Commented Dec 22, 2022 at 15:00
-
$\begingroup$ @MichaelKay If I understand Wikipedia correctly, the difference you are thinking of is "imperative programming" versus "declarative programming". "Procedural programming" is only a subset of "imperative programming". Java is an example of an "imperative" programming language that is not "procedural". $\endgroup$ Commented Dec 22, 2022 at 16:12
-
$\begingroup$ I don't think the Wikipedia article is especially good in capturing the way people actually use the term "procedural programming" or "procedural language" today. But I'm not equipped to do the research to rewrite it. $\endgroup$ Commented Dec 23, 2022 at 12:11