Compiler definition in the game dictionary.

Started by
10 comments, last by __ALex_J_ 21 years, 11 months ago
I'm making this post to continue the discution about the strange definition of compiler in the game dictionary. Please don't explain me for the 100th time how a compiler works with all the stages involved in the process of creating a binary file. I know them: source file(.c, .pas...) --compiler--> assembly language (.s, .asm) assembly(.s, .asm) --assembler--> object file(.o, .obj) object file(.o, .obj) --linker--> executable file(.exe, ...) What bother me are some terms used in the definition that makes me feel it is wrong but somehow everybody say it is right and they explain me what I alredy know with words that I would have used. Here is the definition:
quote:Game Dictionary Compiler A program that translates a computer language into object code which can then be assembled into machine language . This is necessary for programming in all high level languages (like C/C++ and Pascal) which are not interpreted (like BASIC).
What I do think when I hear object code is about object files (.obj). Then the definition say that the object code can be assembled into machine language. It makes no sense since an .obj alredy come from the assembler. What I would have expected is that we link the .OBJs. Someone sugested that assemble is used in the sense of "put together", another word for link. It is unlikely since the definition say: "assembled into machine language". I'm completly lost. Or. Maybe, "object code " have diferent meaning that the term "object file " (.obj). Look at this other definition.
quote:American Heritage Dictionary object code n. The code produced by a compiler from the source code, usually in the form of machine language that a computer can execute directly, or sometimes in assembly language.
Sometimes in assembly language!? Maybe with some archaic compilers, what I call "object files "(.obj) was stored in textual assembly code? Or more likely, the intermediate "assembly (.asm) file" generated by most moderm compilers is also object code " but not "oject file "? If the latter is true, the first definition "object code which can then be assembled " could make some sense. But I don't know anything for sure (except of course that we can't assemble an obj), so please help. Is this definition correct? [edited by - __ALex_J_ on May 3, 2002 7:27:57 PM]
Advertisement
Assembled, because an object file just gives information on what''s in the object file. Most programs have multiple C++ files, which create multiple object files.. it takes these multiple files (plus any libraries that you''ve included) and "assembles" it into machine code (aka, takes all the information from each object file, and assembles it into the file) using the Linker (which is correct on your part). This is probably the reason they chose to use the word assemble instead of link (both can have VERY similar meanings depending on how you interpret each). Using the word Linker is deceiving because it not only links the files, but it organizes them depending on the information contained in the object files... aka, assembles it.

Billy - BillyB@mrsnj.com
(Hey, I''''m no longer anonymous!)
You may be right...

But it says: "assembled into machine language"

Object files ARE in machine alnguage, they only miss some information for adressing and calling of external modules.

To me, "assembled into machine language" looks like taking a list of mnemonic and translating them to binary (what an assembler do).

Yet I may be wrong.

Another thing that bother me is the definition of "object code" where they say that object code is something that "can execute directly, or sometimes in assembly language."

Have you ever seen "object code" in assembly form? What does it means.
It depends on the object file. Not all object files are 100% machine code. In Borland Turbo C/C++ 3.0, you had the option to compile VIA assembly (not just output to assembly), but I beleive this just created a temporary assembly file, and then compiled that to an object file, then linked it. Some compilers (java) compile to byte code, and this is then compiled to machine langauge by the "JIT" compiler. I don''t know what kind of object files aren''t already compiled to machine language, but I''m sure some 1/2 a$$ compiler has done this before (more of an intermediate file than an object file, but i guess it''d still be an object file, as an object file is simple a file that stores information to generate an executable).

I beleive it is assembling, because it takes multiple object files, and puts the Data and Code in the proper locations, and has to fill in the information about where the data is located (so, it''s not 100% machine code yet, as it doesn''t know where/how much data is going to be there, so it doesn''t have things like ds:[bp+X], as it doesn''t know what X is until it has the information from all the .obj files).

Billy - BillyB@mrsnj.com
(Hey, I''''m no longer anonymous!)
Object code will be produced for the target language. In a compiler that often is, but doesn't have to be, machine language. It is perfectly acceptable for a compiler to generate another language (often C) as its target language, and therefore as its object code. You seem to be confused that files with the .obj extension contain machine code. That is just a convention used on Windows, and it doesn't mean object code is always machine code. Some compilation techniques blur the boundaries of what each of these terms mean, so you shouldn't take them to be strict rules.

So, the quote probably does not mean that the compiler generates assembly language. You could read "assembled into machine language" as "does whatever is required to translate the object code to machine code".

[ C++ FAQ Lite | ACCU | Boost | Python | Agile Manifesto! ]

[edited by - SabreMan on May 3, 2002 8:14:23 PM]
Yes. I know that many compilers use a temporary assembly file before the object file is created. This is why I included it in my diagram.

GNU C does it all the time. "as" apear high on the task list when I compile packages on linux. There are also good chances that borland do so as well.

If, as you guess, the assembly file is "still an object file", this make things a bit clearer.

It is also true that linking could be more like assembling objects together.

Still I like it more when peoples use the terms:

assembly language file for .s and .asm files
byte code for .class files
object file for .o and .obj files
link for the process of generating an executable from object files.



Ho. I'm also quite surprise that the American Heritage Dictionary include the case assembly in the definition of object code.

Do you think that "java byte code" and "C" could be added as well?

Anyway it has to be complicated, the firts post of this thread is probably the longuest I ever made to a forum.



[edited by - __ALex_J_ on May 3, 2002 8:26:40 PM]
quote:Original post by __ALex_J_
Do you think that "java byte code" and "C" could be added as well?

To what? The definition of object code? That would be pointless, as it does not add to a generic definition. If you did that, you could argue that you should list every single possible object code representation.
quote:
Anyway it has to be complicated, the firts post of this thread is probably the longuest I ever made to a forum.

It''s really quite simple. Whatever a compiler generates is the object code. That object code might be source code for another compiler, it might be assembly language, or it might be machine code.

[ C++ FAQ Lite | ACCU | Boost | Python | Agile Manifesto! ]
thank you.

What an enlightening conversation
think of it this way. object code is not directly executable by the OS (many times not even by the pc because of "fixups" that need to be handled when dealing with intertwined object code). its just a collection of instructions, symbol table for functions that will be linked, etc. an object file contains some machine code, some function names, plus other extra data for the linker, could not be turned into a machine excutable file by simply renaming the file (or applying the approiate permissions). object code also may not even have all the "memory" allocated for decalred varibles (ie globals and static). things like that are better determined at link time because you can have external varibles used in multiple object files, but the actual storage location is not known until linking.

also assemble means:
quote:
as·sem·ble (-smbl)
v. as·sem·bled, as·sem·bling, as·sem·bles
v. tr.
To bring or call together into a group or whole: assembled the jury.
To fit together the parts or pieces of: assemble a machine; assemble data.


there is no "in the sense". thats what the word means. its not being used as another word for link. link means:

quote:
v. linked, link·ing, links
v. tr.
To connect with or as if with a link: linked the rings to form a chain. See Synonyms at join.


as you can see there is a subtle difference. assmeble is a better description. the problem is that object code is only executable by the cpu if there exists NO outside dependences. because of this you cant really refer to object code in seperate files as a finished compiled program. there is a fine line between object code and an excutable program. while i agree the defination needs some work.

maybe:
quote:
compiler

A program that converts another program from some source language (or programming language) to machine language (object code). Some compilers output assembly language which is then converted to machine language by a separate assembler.

A compiler is distinguished from an assembler by the fact that each input statement does not, in general, correspond to a single machine instruction or fixed sequence of instructions. A compiler may support such features as automatic allocation of variables, arbitrary arithmetic expressions, control structures such as FOR and WHILE loops, variable scope, input/ouput operations, higher-order functions and portability of source code.

AUTOCODER, written in 1952, was possibly the first primitive compiler. Laning and Zierler''s compiler, written in 1953-1954, was possibly the first true working algebraic compiler.

See also byte-code compiler, native compiler, optimising compiler.

(1994-11-07)


Source: The Free On-line Dictionary of Computing, © 1993-2001 Denis Howe


because the reality is that object code is considered excutable to some extent by the cpu, even if the not directly by the OS.

This topic is closed to new replies.

Advertisement