official
course description
this course description
This course is divided into three equal parts. Three parts are taught by
three different lecturers.
1) Programming Language concepts, Twittee
MO 13:00-16:00 Eng3 418
2) Real programming languages,
Vishnu MO
13:00-16:00 Eng3 420
3) Language and implementation, Prabhas MO
13:00-16:00 Eng3 403
Principal lecturer: Twittee
The goal of this course is to make you understand the languages you use. To
make you appreciate diversity of ideas in programming and prepare you for new
programming methods and paradigms. Theoretical foundations will be presented.
You will know properties of language, not just syntax. Moreover, you will
recognize the cost of presenting an abstract view of machine and understand
trade-offs in programming language design.
Each part will be taught separately and independently. It is logical that the
assessment will also be arranged according to this structure. There is no
midterm exam (besides whatever assess by the lecturer at that time) and the
final exam will contain all materials taught in the course.
each part 20% by
3 = 60%
final
exam
40%
the lecture schedule:
section 1: A, B, C
section 2: B, C, A
section 3: C, A, B
A) Programming Language concepts, Twittee
B) Real programming languages, Vishnu
C) Language and implementation, Prabhas
Final Mock exam is out please have a look 14 Sept 2009
1) 12 Aug -- We will have a mini-exam next week, Monday 17th Aug 2009, a 30 minutes quiz. The question is how to do code generation. You will be given a piece of Nut-program. You have to write abstract syntax trees from this source and a listing in S-code.
each week has 3 hrs, max 5 weeks
plan for 4 weeks, with one to spare
each week has 2 sessions of 1 1/2 hrs. each.
a homework will be handed out each week.
one project will be issued on week 6.
1 small project
2 mini exams
4 homeworks, running the code
1 structure of a compiler
Overview of the course
(from Stanford slide) Compiler
(ppt)
HLL to LLL to processor architecture Nut language manual
2 lexical
analyser
Scanner (ppt)
automaton
actual
code
Session on how to use the tools
Overview of Nut compiler
--------------
3 parser
4
grammar
Context Free Grammar (ppt)
mini-exame1
----------------
5 recursive
descent
Parsing (ppt) we are
interested only in top-down parsing (no need to read bottom-up)
6 actual
parser
pseudo code of nut parser
recursive
evaluator
pseudo code of the evaluator
-----------------
7 code
generator
HLL to
LLL
example of parsing Nut program to N-code
s-code
Code Generation (with examples)
How to do code generation
8 actual code generator summation: quiz in class
mini-exam2
-----------------
9
sx-chip
microprogramming sx-chip
instruction set
how
to microprogram sx-chip sx-microp
data path
execution cycle
10 additional topics
submit project
homework 5% 2 quizes 5+5% one project 5% total 20%
Old homework (section 3)
4) (10 Aug) Your home work is to try to compile and generate S-code (read how to do codegeneration) with the example program from the class:
(def isnull a () (< a 0))
(def tail a () (vec a 1))
(def len (a) ()
(if (isnull a) 0
(+ 1 (len (tail a)))))
Produce the S-obj from this input source and then proceed to "disassemble" the S-obj by hand into a human readable S-code. (Don't try to run this piece of S-obj as the program is not complete, it requires the input of len to be a list). You can try to compile and generate code and run some other program that use simple input.
I have include "ex-ch2.lst" in the directory "codegen" so that you can see what to be expected as a listing of a S-code listing file.
The nature of the project is to
read and write a report based on topics in programming language
processing. The report is a short one (5-6 pages) and should take around
one week to complete. You should take about 10 hours reading. Then,
write in your own words, not more than 4-5 pages, analyse and summarise what
you "know" about it.
Section 2 (start with Vishnu)
We will focus on Java Virtual Machine (JVM). There are many interesting
topics concerning JVM many of which concentrate on making JVM faster (such as Jalapeņo project by
IBM) and many others. Or to convert from Java byte code to odinary
programming languages. Or Concurrent JVM, or many other extensions such as
functional etc. The least is to compare S-code to Java byte code, or their
differences in internal structure (such as Stack frame arrangement). In
short, anything that you fancy (or and get your hands on) the topic of
implementation of JVM and related topics. Have fun! (hand-in before
next Monday 24 Aug when you change section).
The first one is the standard text book on compiler. It has
been used in more than 100 universities in
Chapter 2 Nut language manual
Chapter 3 Nut compiler
Chapter 4 Code generator
Chapter 5 Microprogramming
1. Nut compiler
(executable) nut32.exe
2. Full Nut compiler in
Nut nut.txt
3. Nut virtual machine to be used to run
Nut object code nsim32.exe
4. Source for my nut32 compiler and nsim32
in C (for those who want to dig deep). nut32-source.zip
5. build-your-own-compiler
excercise
6. Nut S-code code generator in Nut gen2.txt (for section 3) gen21.txt (for section 2) all tools to do homework 4
7. Som-v2 virtual machine
(executable) som.exe
Read
about Som virtual machine
Prabhas Chongstitvatana
contact address: prabhas at chula dot ac dot
th
office room 18-13 Engineering Building 4, floor 18. tel 02-2186982
research lab: Intelligent Systems, floor 20.
Last update 14 Sept 2009