Results 1 to 9 of 9

Thread: What is a complier??

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Bad address email on file ioconnell's Avatar
    Join Date
    Aug 2001
    Location
    Ireland
    Occupation
    Other Eyecare-Related Field
    Posts
    344

    What is a complier??

    hello, i'm currently studying a reseach project on microcomputers, I'm am struggling to come up with a rigid detailed definiton of a complier, i know it is a specific type of program that translates code into machine language (ie binary numbers.) and is needed to make a working program.

    Would anyone have a knowledge of C++ and or the workings of compliers??

    Cheers, Ian

  2. #2
    Master OptiBoarder rbaker's Avatar
    Join Date
    May 2000
    Location
    Gold Hill, OR
    Occupation
    Other Optical Manufacturer or Vendor
    Posts
    4,401
    Well, yah, Ian . . .but it would take up too much bandwidth to go into here. And, I don’t have the time as the salmon are running. Perhaps you have some specific questions. You might want to go to www.borland.com or pick up Borland’s latest compiler (still just about giving them away with academic licenses) and start thrashing away like everyone else.

    Briefly, a compiler translates program code written in a high level programming language such as C or C++ (source program) into a low level language, either assembly language or even the machine language of a particular processor (object program.) This translation consists of three steps – scanning, parsing and code generation.

    Next question please.

  3. #3
    OptiBoard Apprentice
    Join Date
    Jun 2006
    Location
    Oregon, USA
    Occupation
    Consumer or Non-Eyecare field
    Posts
    23
    A compiler is something that takes source code and (for lack of a better term) crunches it into an executable file (the programs you use everyday, as opposed to things like MS Word documents).

    C is probably the most popular programming language out there. It's available on every kind of computing platform and it's (relatively) easy to port it to other platforms. (Example: You write a program for Windows. But you want that same program to run on Linux. You have to make changes to get it run on Linux.)

    Wikipedia is a good source for computer related stuff, as half the editors there are geeks of one stripe or another.
    "Violence is the last refuge of the incompetent."
    -Isaac Asimov

  4. #4
    Bad address email on file
    Join Date
    May 2006
    Location
    USA
    Posts
    81
    C is the most popular programming language still? Wow, I would have thought otherwise seeing as its not strictly required to learn C++.
    When in need of a definition, always go to google :finger:

    "A compiler is a computer program that translates a computer program written in one computer language (called the source language) into an equivalent program written in another computer language (called the output, object, or target language)"

  5. #5
    Brian Park
    Guest

    compilers, assemblers, interpreters, and emulators

    As stated by the others, the compiler translates between the "source" language (code), and the "object language (code)". Assemblers also do that. The specific difference between the 2 is the nature of the languages.

    The source (input) language (structure/syntax) of the compiler is created/defined completely independently of the object language. For example, the C language has no relation to the internal structure of the computer it programs (such as the number of registers, or the memory buss format: Harvord architecture, Von-Nuemann architecture, etc.) So a language like C is a "universal" language, in that compilers can be had to enable running a given C program on any computer possessing sufficient memory capacity/speed for the task, and once written and debugged to run on one computer, can (at least in theory) be compiled on a different compiler to run on another computer without modification.

    The assembly language is structured after the architecture of the processor it is to provide code for. The assembler "assembles" the source code to "machine code", the 1's and 0's that are loaded into the memory. Basically there is a one-to-one correspondence between each line of assembly and a single machine instruction. If a computer with a different structure is to be programmed, a different assembly language/assembler is needed. The advantage of assembly is the ability to optimize the performance of the machine (often by speed factors of 100, and smaller code by factors of 1000). Also, the timing of C-code is hard to control/predict, while assembly can code precise timing functions, but is more difficult to write. For example, on a free-form lens grinder, C running on a PC could calculate the curves, and assembly running on a microcontroller would control the actual cutting of the lens curve by the stepper/servo motors.

    Assembly routines requiring only 2000 bytes can do some rather awesome things, in the day and age where programs are measured in megabytes.

    Many programs are written as combinations of both; assembly for the intensive parts of the code, carefully hand-tuned for speed, and C for the less speed intensive/more difficult to write parts.

    A third type of "code converter" is the interpreter. This does not strictly "convert" the code at all. Instead, the code is stored in the computer exactly as written, and an "interpreter" is running, processing each line of code in turn. So the source code is not really "running"; it is a data stream feeding the interpreter. The early Basics that ran on PC's (such as Quickbasic) were interpreters. Although,they run about 100 to 1000 times slower than assembly, they are more bugproof (the interpreter is running and checking the code for correctness continuously. If an infinite loop or a math overflow occurs, the interpreter flags it.) They are useful when you want to calculate something with a quickly whipped out program. Presently, they have fallen out of use because "the common person no longer programs". They resort to "apps" such as Matlab and spreadsheets for calculations. But Basic is handy when a calculation is required that does not fit an app or one is not willing to pay a fortune for an app for a simple calculation. An example is a converter to take some sort of a CAD file, and convert it into a form that will be accepted by a non-compatible machine, say to lay out a lens edging cam from an eyeglass frame. Put eyeglass frame on scanner face down. Scan to BMP file. import BMP into CAD program, and draw around the eyewires with CAD elements. Basic program digests the CAD file, and provides a G-code (standard milling machine driver file) to cut the cam on a milling machine. Perhaps the "patternless lens edger" died, and the new one is not compatible with the old expensive CAD software. So a Basic program patches the new and the old.

    An emulator program makes the object code written for one computer run on another. An example is the "maim" code (you arcade fanatics probably know about this), which accepts the original object code for the video games, such as Packman, and allows them to run on the PC, verses the "old clunker" computers they originally run on. Each and every instruction cycle is perfectly replicated. The emulator, like the compiler, runs 10 to 100 times slower (on a given computer) than assembly, but are useful when an old system dies, there is a lot of investment in the software, and the newer computers are so much faster.

    My main area of expertise is on the "small end" of the code spectrum (assembly and Basic).

  6. #6
    OptiBoard Novice
    Join Date
    Sep 2010
    Location
    chennai
    Occupation
    Optical Laboratory Technician
    Posts
    1

    What is a complier??

    A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable program.
    The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine code). If the compiled program can only run on a computer whose cpu or operating system is different from the one on which the compiler runs the compiler is known as a cross-compiler. A program that translates from a low level language to a higher level one is a decompiler. A program that translates between high-level languages is usually called a language translator, source to source translator, or language converter. A language rewriter is usually a program that translates the form of expressions without a change of language.

    ____________________________________________________________ _

    Want to get-on Google's first page and loads of traffic to our website? Hire a SEO Specialist from Ocean Groups seo pecialist

  7. #7
    OptiBoard Novice
    Join Date
    Jan 2021
    Location
    Missouri
    Occupation
    Other Eyecare-Related Field
    Posts
    1
    Quote Originally Posted by Brian Park View Post
    As stated by the others, the compiler translates between the "source" language (code), and the "object language (code)". Assemblers also do that. The specific difference between the 2 is the nature of the languages.

    The source (input) language (structure/syntax) of the compiler is created/defined completely independently of the object language. For example, the C language has no relation to the internal structure of the computer it programs (such as the number of registers, or the memory buss format: Harvord architecture, Von-Nuemann architecture, etc.) So a language like C is a "universal" language, in that compilers can be had to enable running a given C program on any computer possessing sufficient memory capacity/speed for the task, and once written and debugged to run on one computer, can (at least in theory) be compiled on a different compiler to run on another computer without modification.

    The assembly language is structured after the architecture of the processor it is to provide code for. The assembler "assembles" the source code to "machine code", the 1's and 0's that are loaded into the memory. Basically there is a one-to-one correspondence between each line of assembly and a single machine instruction. If a computer with a different structure is to be programmed, a different assembly language/assembler is needed. The advantage of assembly is the ability to optimize the performance of the machine (often by speed factors of 100, and smaller code by factors of 1000). Also, the timing of C-code is hard to control/predict, while assembly can code precise timing functions, but is more difficult to write. For example, on a free-form lens grinder, C running on a PC could calculate the curves, and assembly running on a microcontroller would control the actual cutting of the lens curve by the stepper/servo motors.

    Assembly routines requiring only 2000 bytes can do some rather awesome things, in the day and age where programs are measured in megabytes.

    Many programs are written as combinations of both; assembly for the intensive parts of the code, carefully hand-tuned for speed, and C for the less speed intensive/more difficult to write parts.

    A third type of "code converter" is the interpreter. This does not strictly "convert" the code at all. Instead, the code is stored in the computer exactly as written, and an "interpreter" is running, processing each line of code in turn. So the source code is not really "running"; it is a data stream feeding the interpreter. The early Basics that ran on PC's (such as Quickbasic) were interpreters. Although,they run about 100 to 1000 times slower than assembly, they are more bugproof (the interpreter is running and checking the code for correctness continuously. If an infinite loop or a math overflow occurs, the interpreter flags it.) They are useful when you want to calculate something with a quickly whipped out program. Presently, they have fallen out of use because "the common person no longer programs". They resort to "apps" such as Matlab and spreadsheets for calculations. But Basic is handy when a calculation is required that does not fit an app or one is not willing to pay a fortune for an app for a simple calculation. An example is a converter to take some sort of a CAD file, and convert it into a form that will be accepted by a non-compatible machine, say to lay out a lens edging cam from an eyeglass frame. Put eyeglass frame on scanner face down. Scan to BMP file. import BMP into CAD program, and draw around the eyewires with CAD elements. Basic program digests the CAD file, and provides a G-code (standard milling machine driver file) to cut the cam on a milling machine. Perhaps the "patternless lens edger" died, and the new one is not compatible with the old expensive CAD software. So a Basic program patches the new and the old.

    An emulator program makes the object code written for one computer run on another. An example is the "maim" code (you arcade fanatics probably know about this), which accepts the original object code for the video games, such as Packman, and allows them to run on the PC, verses the "old clunker" computers they originally run on. Each and every instruction cycle is perfectly replicated. The emulator, like the compiler, runs 10 to 100 times slower (on a given computer) than assembly, but are useful when an old system dies, there is a lot of investment in the software, and the newer computers are so much faster.

    My main area of expertise is on the "small end" of the code spectrum (assembly and Basic).
    Fantastic Post! This explains it perfectly!

  8. #8
    OptiBoard Apprentice
    Join Date
    Apr 2013
    Location
    ireland
    Occupation
    Other Optical Manufacturer or Vendor
    Posts
    10
    compiler is a simple computer program which converts source code of programs into computer understandable language at compile time because computer understands only binary language i.e. 0's or 1's. compiler will convert high level language input by user into machine language. It is also done by interpreter but it will generate an intermediate code first after that it will convert input to binary or machine language.

  9. #9
    OptiBoard Apprentice
    Join Date
    Sep 2021
    Location
    USA
    Occupation
    Optical Wholesale Lab (other positions)
    Posts
    20
    Basically Complier convert whole program into binary then show output. Any higher language using same have good read write speed.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •