HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

What defines a tool as a "compiler"

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
compilertooldefineswhat

Problem

I've been trying to figure out what technically makes a tool or program a compiler.

For example, I know that gcc will compile source code to object files or assembly, hence transforming a programming language to a different form by breaking it down into "words" with some lexer and reading the "grammar" of the words with some parser, and finally compiling it.

But is the term compiler limited to transforming specifically programming languages?

For example, there's a tool called doxygen that will read all of the documentation from source code files, break them down, and generate output based on the documentation. Is this considered to be a compiler?

Solution

A compiler translates code written in one programming language into code in another language -- normally, with the semantics of the output code being the same as the input code (or with a strong relationship).

Personally, if you asked me to use the word strictly, I wouldn't call Doxygen a compiler. The output isn't executable code, and doesn't have anything like the same semantics as the input source code.

See also Wikipedia's definition/explanation.

That said, there are many situations where we use a word loosely, when from context it will be understood what we're referring to -- so I'm not sure how useful it will be to look for a super-precise definition of the word. If the specific definition is important in your writing, then it might be best to define how you plan to use the term.

Context

StackExchange Computer Science Q#55600, answer score: 9

Revisions (0)

No revisions yet.