0% found this document useful (0 votes)
76 views6 pages

Type Checking (1)

Uploaded by

jash.gudhka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views6 pages

Type Checking (1)

Uploaded by

jash.gudhka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

TYPE CHECKING

● Type checking is checking and enforcing the constraint of types assigned to values in a
program.
● The compiler has to follow the type of rules as per the language
● Each language follows its own rule

1. The design of the type checker depends on

a. Syntactic structure
b. The type expression of language
c. The rules for assigning types to construct

Position of checker in compilation


Rules for type-checking
E-> E+E /I'd
Static type checking
1. Checking will be done at compile time
2. Obtained via declaration and stored in a master symbol table
3. After this information is collected the type involved in each
operation is checked out

Static type checks


● Flow control
● Uniqueness check
● Name related checks

Benefits of the static type checker


1. Early error detection - it catches various types of errors in the early
development cycle.
2. Faster execution - compile code from statistically typed Programs to
execute faster because the compiler can produce optimized machine
code
3. Improve developer's workflow - By adding features like autocomplete,
code hinting, and incremental array checking.
4. Easier Collaboration - the code makes it easy for developers on a
large codebase.
5. Explicit documentation - explicit declare type acts as a form of
documentation making it easier to understand code written by others

Run time environment

Compiler creates runitme environment to somebody to smoothly execute


rhe program
Type Checking in Compiler Design - GeeksforGeeks

You might also like