Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Presentation1
1.
2. 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, object code, or machine code) to create an executable
program.
It is computer software that transforms computer code written in one
programming language (the source language) into another programming
language (the target language).
Compilers are a type of translators that support digital devices, primarily
computers.
3.
4. high-level languages is usually
r transpiler.
ogram that translates the form of
guage.
to tools used to create parsers that
un on a computer whose CPU or
om the one on which the compiler
mpiler.
n in the language that it intends to
m a low-level language to a higher
5. Program is free from lexical error
Program is free from semantics error
Program is free from syntax error
Even a complex program can be compiled in a small interval of time
In programs related to database accessing, many risks are reduced.
6. • In addition to the development of a compiler, the techniques used in
compiler design can be applicable to many problems in computer
science.
– Techniques used in a lexical analyzer can be used in text editors,
information retrieval system, and pattern recognition programs.
– Techniques used in a parser can be used in a query processing
system such as SQL.
7. – Many software having a complex front-end may need techniques
used in compiler design.
– Most of the techniques used in compiler design can be used in
Natural Language Processing (NLP) systems.
8. Major parts of a compiler:
Analysis:An intermediate representation is created from the source program.
Synthesis:The equivalent target program is created from this intermediate
representation.
• Each phase transforms the source program from one representation into
another representation.
• They communicate with error handlers.
• They communicate with the symbol table.
9.
10. • Lexical Analyzer reads the source program character by character and
returns the tokens of the source program.
• A token describes a pattern of characters having same meaning in the
source program. (such as identifiers, operators, keywords, numbers and so
on)
• Puts information about identifiers into the symbol table.
11. Ex: newval := oldval + 12 => tokens:
newval
:=
oldval
+
12
identifier
assignment operator
identifier
add operator
a number
• Regular expressions are used to describe tokens (lexical
constructs).
• A (Deterministic) Finite State Automaton can be used in the
implementation of a lexical analyzer.
12. • A Syntax Analyzer creates the syntactic structure (generally a parse tree)
of the given program.
• A syntax analyzer is also called as a parser.
• A parse tree describes a syntactic structure.
• In a parse tree, all terminals are at leaves.
• All inner nodes are non-terminals in
a context free grammar.
13. • The syntax of a language is specified by a context free grammar (CFG).
• The rules in a CFG are mostly recursive.
• A syntax analyzer checks whether a given program satisfies the rules
implied by a CFG or not.
– If it satisfies, the syntax analyzer creates a parse tree for the given
program.
14. • Ex: We use BNF (Backus Naur Form) to specify a CFG
assignment -> identifier := expression
expression -> identifier
expression -> number
expression -> expression + expression
15.
16. • A compiler may produce an explicit intermediate codes representing the
source program.
• These intermediate codes are generally machine .But the level of
intermediate codes is close to the level of machine codes.
• Ex: newval := oldval * fact + 1
id1 := id2 * id3 + 1
MULT id2,id3,temp1 Intermediates Codes (Quadraples)
ADD temp1,#1,temp2
MOV temp2,,id1
17. • The code optimizer optimizes the code produced by the intermediate code
generator in the terms of time and space.
• Ex:
MULT id2,id3,temp1
ADD temp1,#1,id1
18.
19.
20. Errors by compilation:
1.The compiler highlights all the possible errors which are obstacle in
the program to provide a good meaning.
2. Logical errors could be found only at runtime of the program.
21. Basic error in C:
Array bound missing
Array size too large
Bad file name
Call of on function
Declaration missing
Compound statement missing
Illegal accessions
23. Output:
Print the area and perimeter of the rectangle in a line.
The two integers should be separated by a single space.
Constraints:
1 ≤ a, b ≤ 100
24. Source code:
#include <stdio.h>
int main ()
{
int a,b,perimeter,area;
scanf ("%d %d",&a,&b);
perimeter=2*(a+b);
area=a*b;
printf ("%d %dn",area,perimeter);
}
26. https://www.urionlinejudge.com.br/judge/en/problems/view/1036
Read 3 floating-point numbers. After, print the roots of
bhaskara’s formula. If it's impossible to calculate the roots because
a division by zero or a square root of a negative number, presents
the message “Impossivel calcular”.
Input:
Read 3 floating-point numbers A, B and C.
27. Output:
Print the result with 5 digits after the decimal point or the
message if it is impossible to calculate.