Skip to content

bozsahin/ceng444

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ceng444: Language processors

Middle East Technical University CENG introductory compiler course

This is the website of the course when I teach it.

Term: Fall 2022 (for the academic year 2022-2023)

Instructor: Cem Bozsahin (Cogsci). TA: Cem Onem (CEng).

Office hours: Open door except lecture days TWTh (my office is B-209 at Informatics, tel: 7758)

Course hours: W 14.40-16.30, Th 15.40-17.30 Room BMB-2 (CENG building).

The course is 3 lecture hours, not 4. I asked for two two-hour slots for flexibility.

We will probably do 75 minutes without break each day, something like W14.40-15.55 Th15.40-16.55.

If there is course clash, we can try 2+1 or 1+2 on WTh. We'll discuss this in FIRST class.

(So please attend first class, whether you are registered or not.)

Textbook: Compilers: Principles, Techniques and Tools. Aho, Lam, Sethi, Ullman (2007). Addison-Wesley/Pearson. 2nd Edition of the Dragon Book.

The first edition was a classic in CS, and 2nd edition adds more to the legend.

Catalog description: Formal description and classification of programming languages. Syntactic specification. The parsing problem. Top-down and bottom-up parsing. Attaching semantics to syntax. Translator writing systems. Translator writing case study.

Course objectives: Assuming familiarity with formal grammars, i.e., Ceng280 material, we emphasize modern tools and techniques for compiler construction, which can be used for any task of mapping from one formal representation to another.

Course prerequisite: Officially, none, according to METU catalog. Unofficially, you need to feel comfortable with programming, data structures, and formal languages. 3rd-year standing in CS, or CENG280 in the bag, or COGS501 and COGS502 will suffice.

Informatics Students: Please contact me DURING REGISTRATION so that I can tell you whether you are eligible for the course, and to inform CENG department in time for them to open a quota for you.

Course outline

  1. Introduction: a walk through all stages of compiling (1 week)
  2. Scanning (lexical analysis) (1)
  3. Parsing (syntactic analysis) (3)
  4. Intermediate code (1)
  5. Virtual machines (1)
  6. Code generation (syntax-directed derivation/description---SDD) (1)
  7. Scope handling and run-time (1)
  8. A preview of compiling functional languages (2)

Course conduct: 11 weeks of lecture, 2 weeks of in-class labs; 1 week in-class exam; 2 programming projects; no extra homework.

We will use TWO tools for compiler design: (1) sly.py (which is lex and yacc in python; see the bottom of this page for sly install), (2) Spike for RISC-V code generation.

In-class labs introduce sly.py and RISC-V.

We will give you a newly designed PL. You will write a compiler for it.

The first part of the project uses sly to do lexical analysis and parsing into abstract syntax trees.

The second part of the project includes code generation and execution, in RISC-V, using Spike. (We also accept LLVM, MIPS, x86 code generation; however, these you have to do without expecting too much help from us.)

Grading:

  1. Mid-term exam: %20 ( in class)
  2. mini-project 1 (lex analysis and parsing into abstract syntax trees): %25
  3. mini-project 2 (code generation and execution): %35
  4. Final exam: %20
  5. Gazozuna Kompaylır Ödülü : priceless!!
    Highest honour we give out to best successful completion of the second project.
    It is, ehm, officially recognized,
    and those who are in the know reading your CV at least in Turkey would know what you achieved.
    Usually handed by the end of first spring term after completion, with a ceremony!
    You will be a proud owner of 4 bottles of a yerli ve milli soft drink,
    with a certificate in a low-budget print, namely my handwriting.

2022-2023 Gazozuna Kompaylır ödülü:

  • Lütfullah Erkaya: Vox -> sly -> RISC-V

Tebrikler!

  • Cem Bozşahin, Cem Önem