UNIT one particular
1 What is compiler?
Ans: - A compiler can be described as program that translates individual readable supply code in computer executable machine code. To do this effectively the human readable code must c omply with the format rules of whichever coding language it truly is written in. The compiler is only a plan and cannot fix the programs for you personally. If you buy the wrong thing, you have to correc t the syntax or it won't put together
2 review NFA and DFA?
Ans: DFA- solitary value move function is represented
- it consider more storage
- quantity of state is somewhat more
- it not support null move
-- backtracking is achievable
-dfa is definitely faster recognizer
NFA- multi value transition function can be represented
- it consider less memory space
- quantity of state is less
- it support null moves
-- backtrakin is achievable some cases
- nfa is usually slower recognizer
3 Define bootstrap and cross compiler?
Ans: -- Bootstrap: In computing, bootstrapping (from a classic expression " to pull one self up by simply one's bootstraps" ) is known as a technique by which a simple pc program triggers a more challenging system of programs. In the start-up process of a pc system, a little program (such as BIOS) initializes and tests that the basic requirement of hardware, peripherals and external memory equipment are linked. Cross compiler: A compiler that works on one pc but makes object code for a diverse caterogy of computer system. Cross compilers are used to generate software that can run on personal computers with a new structure or upon specialpurpose products that are not able to host their particular compilers. 4 Define expression lexeme routine?
Ans: - Token-A lexical token is actually a sequence of characters which can be treated like a unit in the grammar with the programming 'languages'.
Example of bridal party:
Type expression (id, num, real,... )
Punctuation bridal party (IF, emptiness, return,... )
Alphabetic bridal party (keywords)
Sort of non-tokens:
Remarks, preprocessor savoir, macros, blanks, tabs, newline,...
Lexeme-A lexeme is a series of heroes in the resource program that is matched by the pattern for a token.
For example , the design for the RELOP token contains six lexemes ( =, < >,, > =) hence the lexical analyzer should return a RELOP token to parser anytime it perceives any one of the half a dozen. Pattern-There can be described as set of strings in the type for which the sam e token can be produced because output. It of strings is defined by a rule called a routine associated with the expression. Regular expression are an essential notation intended for specifying patterns. For example , the pattern intended for the Pascal identifier symbol, id, can be: i g в†’ page (letter | digit)*. a few What is compilation? Describe phase of compiler with diagram. Compilation: - 1 the action or process of compiling.
2 a specific thing, especially an e book or record, compiled from different resources. Phase of compiler: - There are six phases a standard compiler will certainly implement. The reason why independent a compiler into six phases might be simplicity. Compiler design is thus packed with ``Divide and Conquer'' technique, component-level style, reusabililty and gratification optimization. Lexical Analysis
Programmer (source code
Scanner (performs lexical analysis)
вЂA', вЂ=', вЂB', вЂ+', вЂC', вЂ; '
And mark table with names
Parser (performs syntax analysis
based upon the grammar of the
Parse tree or perhaps abstract
Semantic analyzer (type checking out,
Annotated parse shrub or
subjective syntax forest
Intermediate code generator
Three-address code, quads,
& t1 C t2
: sama dengan t2
Three-address code, quads,
+ t1 #2. 3 A
MOVF #2. 3, r1
ADDF2 r1, r2
MOVF r2, A
Peephole windows optimizer
ADDF2 #2. 3, r2
MOVF r2, A