School of Computing Science and Engineering
Course Code : R1UC101B Name: Programming for Problem Solving using C
Program Name:B.Tech(CSE)
UNIT I
Translators
Objectives
• Language Processing System
• Low Level Language
• High Level Language
• Translators
• Compiler
• Interpreter
• Assembler
•Characteristics of LOW Level Languages:
• They are machine oriented: an assembly language program written
for one machine will not work on any other type of machine unless
they happen to use the same processor chip.
• Each assembly language statement generally translates into one
machine code instruction, therefore the program becomes long and
time-consuming to create.
Language Processing System
Program Name: B.Tech (CSE)
•Characteristics of HIGH Level Languages:
• They are not machine oriented: in theory they are portable, meaning that a program
written for one machine will run on any other machine for which the appropriate compiler
or interpreter is available.
• They are problem oriented: most high level languages have structures and facilities
• appropriate to a particular use or type of problem. For example, FORTRAN was
developed for use in solving mathematical problems. Some languages, such as PASCAL
were developed as general-purpose languages.
• Statements in high-level languages usually resemble English sentences or mathematical
expressions and these languages tend to be easier to learn and understand than
assembly language.
• Each statement in a high level language will be translated into several machine code
instructions.
Language Processing System
Program Name: B.Tech (CSE)
Computer Language Evolution
Program Name: B.Tech (CSE)
• Translator is one that converts high level Language to low level
language
Types of Translator are:
• Assembler
• Compiler
• Interpreter
Translator
Program Name: B.Tech (CSE)
Translator
Program Name: B.Tech (CSE)
• An assembler is a program that converts assembly language into machine code.
• It takes the basic commands and operations from assembly code and converts them
into binary code that can be recognized by a specific type of processor.
• Assemblers are similar to compilers in that they produce executable code. However,
assemblers are more simplistic since they only convert low-level code (assembly
language) to machine code.
• Since each assembly language is designed for a specific processor, assembling a
program is performed using a simple one-to-one mapping from assembly code to
machine code.
• Most programs are written in high-level programming languages and are compiled
directly to machine code using a compiler. However, in some cases, assembly code may
be used to customize functions and ensure they perform in a specific way.
Therefore, IDEs often include assemblers so they can build programs from both high
and low-level languages.
Assembler
Program Name: B.Tech (CSE)
• A compiler is a software program that compiles program source code files
into an executable program.
• The compiler takes source code files that are written in a high-level language,
such as C, BASIC, or Java, and compiles the code into a low-level language,
such as machine code or assembly code.
• If there is any occurrence of error in source code so compiler won’t be able to
convert that to low level so on compilation errors if any are displayed.
Compiler
Program Name: B.Tech (CSE)
• An interpreter converts high level language into low level machine
language, just like a compiler.
• But they are different in the way they read the input.
• The Compiler in one go reads the inputs, does the processing
and executes the source code whereas the interpreter does the
same line by line.
• Compiler scans the entire program and translates it as a whole
into machine code whereas an interpreter translates the program
one statement at a time.
• Interpreted programs are usually slower with respect to compiled
ones.
Interpreter
Program Name: B.Tech (CSE)
Comparison
Program Name: B.Tech (CSE)
C Program Working
Program Name: B.Tech (CSE)
• E. Balagurusamy 7th Edition, Programming ANSI C, McGraw-Hill
• Brian W. Kernighan and Dennis M. Ritchie, The C programming Language,
Prentice-Hall in 1988
• Byron Gottfried, Programming with C, Schaum's Outline
References
Program Name: B.Tech (CSE)
Computer Science guide to C Unit-I Translator.pptx

Computer Science guide to C Unit-I Translator.pptx

  • 1.
    School of ComputingScience and Engineering Course Code : R1UC101B Name: Programming for Problem Solving using C Program Name:B.Tech(CSE) UNIT I Translators
  • 2.
    Objectives • Language ProcessingSystem • Low Level Language • High Level Language • Translators • Compiler • Interpreter • Assembler
  • 3.
    •Characteristics of LOWLevel Languages: • They are machine oriented: an assembly language program written for one machine will not work on any other type of machine unless they happen to use the same processor chip. • Each assembly language statement generally translates into one machine code instruction, therefore the program becomes long and time-consuming to create. Language Processing System Program Name: B.Tech (CSE)
  • 4.
    •Characteristics of HIGHLevel Languages: • They are not machine oriented: in theory they are portable, meaning that a program written for one machine will run on any other machine for which the appropriate compiler or interpreter is available. • They are problem oriented: most high level languages have structures and facilities • appropriate to a particular use or type of problem. For example, FORTRAN was developed for use in solving mathematical problems. Some languages, such as PASCAL were developed as general-purpose languages. • Statements in high-level languages usually resemble English sentences or mathematical expressions and these languages tend to be easier to learn and understand than assembly language. • Each statement in a high level language will be translated into several machine code instructions. Language Processing System Program Name: B.Tech (CSE)
  • 5.
  • 6.
    • Translator isone that converts high level Language to low level language Types of Translator are: • Assembler • Compiler • Interpreter Translator Program Name: B.Tech (CSE)
  • 7.
  • 8.
    • An assembleris a program that converts assembly language into machine code. • It takes the basic commands and operations from assembly code and converts them into binary code that can be recognized by a specific type of processor. • Assemblers are similar to compilers in that they produce executable code. However, assemblers are more simplistic since they only convert low-level code (assembly language) to machine code. • Since each assembly language is designed for a specific processor, assembling a program is performed using a simple one-to-one mapping from assembly code to machine code. • Most programs are written in high-level programming languages and are compiled directly to machine code using a compiler. However, in some cases, assembly code may be used to customize functions and ensure they perform in a specific way. Therefore, IDEs often include assemblers so they can build programs from both high and low-level languages. Assembler Program Name: B.Tech (CSE)
  • 9.
    • A compileris a software program that compiles program source code files into an executable program. • The compiler takes source code files that are written in a high-level language, such as C, BASIC, or Java, and compiles the code into a low-level language, such as machine code or assembly code. • If there is any occurrence of error in source code so compiler won’t be able to convert that to low level so on compilation errors if any are displayed. Compiler Program Name: B.Tech (CSE)
  • 10.
    • An interpreterconverts high level language into low level machine language, just like a compiler. • But they are different in the way they read the input. • The Compiler in one go reads the inputs, does the processing and executes the source code whereas the interpreter does the same line by line. • Compiler scans the entire program and translates it as a whole into machine code whereas an interpreter translates the program one statement at a time. • Interpreted programs are usually slower with respect to compiled ones. Interpreter Program Name: B.Tech (CSE)
  • 11.
  • 12.
    C Program Working ProgramName: B.Tech (CSE)
  • 13.
    • E. Balagurusamy7th Edition, Programming ANSI C, McGraw-Hill • Brian W. Kernighan and Dennis M. Ritchie, The C programming Language, Prentice-Hall in 1988 • Byron Gottfried, Programming with C, Schaum's Outline References Program Name: B.Tech (CSE)