You are on page 1of 14

‫‪CS-465,463‬‬

‫‪Compiler Construction‬‬
‫تركيب البرامج المترجمة ‪ -‬المترجم‬
‫ تركيب البرامج المترجمة‬Compiler Construction
 Course Outlines :
 Components of a Compiler
 ‫يكَٕاخ انًتزجى‬

 Constructing a lexical analyzer (scanner)


 )‫ (انًاطح‬, )‫تزكية انًحهم انقايٕطي(اإليالئي‬

 Programming languages
 ‫نغاخ انثزيجح‬
‫ تركيب البرامج المترجمة‬Compiler Construction
 Syntax free grammars
 ٕ‫انًعزب نقٕاعذ انُح‬

 Grammar for expressions


 ‫نقٕاعذ انُحٕ(اإلعزاب) نهتعثيزاخ‬

 Top down parsing


 ‫انًعزب يٍ أعهي اني أطفم‬
Compiler Construction
 Course Outlines (Cont.):
 Removing left recursion and grammar
transformation
 ٕ‫حذف تكزار انيظار ٔتحٕيم انُح‬
 Attributed grammars
 )‫اإلعزاب‬, ٕ‫خصائص انُحٕ (قٕاعذ انُح‬
 Translation grammars‫تزجًح قٕاعذ األعزاب‬
 Syntax directed definition and translation
schemes
 ‫تعزيفاخ نهًحهم انُحٕي ٔيخططاخ انتحٕيم‬
Compiler Construction
 Course Outlines (Cont.):
 Semantic actions.
 Translating expressions ‫تعثيزاخ نهتحٕيم‬
 IF statements if ‫قاعذج‬
 Loop statements ‫تعثيز انتكزار‬
 Run time memory management
Compiler Construction
 Symbol table processing ‫جذٔل انزيٕس‬
ّ‫ٔانعًهياخ عهي‬
 Implementing arrays and subscripting
 Runtime interpreter of intermediate
language
 A case study ‫حانح دراطيح‬
Compiler Construction
 References
 1-“Compiler Construction” , Principles and
Practice , By Kenneth C. Louden
 2-”Compilers – Principles , Techniques ,
and Tools : , By Alfred V. Aho , Ravi Sethi
, and Jeffrey D. Uliman.
Compiler Construction
Prerequisites 

 CS-204(203) ‫تزيجح يتقذيح‬


 CS- 305 (345( ‫نغاخ انثزيجح‬
 CS- 332 (345)‫َظزيح انحظاتاخ‬
Compiler Construction

‫أنظر خطة التدريس‬


Introduction
 Compilers are computer programs that translate
one language to another.
‫ انًتزجًاخ عثارج عٍ تزايج حاطة ٔانتي يتى فيٓا تحٕيم أحذ‬
‫انهغاخ اني نغح أخزي‬
 A compiler takes as its input a program written in
its source language and produces an equivalent
program written in its target language.
‫ يذخهٓا تزَايج يكتٕب تهغح انًُثع ٔيتى اَتاج‬: ‫ انًتزجًاخ‬
‫تزَايج يُاظز تهغح انٓذف‬
Introduction
 Usually , the source language is a high-
level language , such as C or C++ ,and the
target language is object code (sometimes
also called machine code)
‫عادج فإٌ نغح انًُثع ْي يٍ نغاخ انحاطة تيًُا نغح انٓذف ْي نغح األنح‬ 

 We can view this process schematically as


follows:-
Source Program Compiler Target Program
Introduction
 A compiler is a fairly complex program
that can be anywhere from 10,000 to
1,000,000 lines of code.
ٍ‫ ٔحقيقح فإٌ انًتزجى عثارج عٍ تزَايج يعقذ تّ ي‬
‫ ططز‬1000000 ‫ اني‬10000
 Writing such a program ,or even
understanding it, is not a simple task . ‫ٔكتاتح ْذا‬
ٍ‫انثزَايج أٔ فًّٓ نيض تاأليز انٓي‬
 Anyone professionally involved with
computers should know the basic
organization and operation of a
compiler.
‫إٌ أي يتخصص في انحاطثاخ يجة أٌ يكٌٕ يهًا تأطاطياخ انتزاكية‬ 
‫ٔانعًم نثزايج انًتزجى‬
Introduction
 It is the purpose of this course not only to provide
knowledge about compiler and its techniques ,
but also to give the students all the necessary
tools and practical experience to design and
program an actual compiler
ٍ‫ إٌ انٓذف يٍ ْذِ انًادج نيض فقط يعزفح انًتزجى ٔتقُياتّ ٔنك‬
‫أيضا إعطاء انذارص كم أدٔاخ ٔانخثزاخ انعًهيح نكي يقٕو‬
‫تتصًيى أجشاء يٍ يتزجى حقيقي‬

You might also like