Languages and compilers
Tuesday, Thursday 1:00-2:30 in ITB/222.
I have used (part of) the following set of slides:
Programming Languages: Principles and Paradigms Allen Tucker and Robert Noonan.
Types and Programming Languages Benjamin C. Pierce
There is some very useful material at the following pages:
When in the mood to look at weird languages, I definitely recommend
I recently found a nice comparison of the
extension benefits of OO vs functional. Clearly lays out the tradeoffs involved.
I could also talk about how FP is (mostly) based on initial algebras and OO on
co-algebras, but that might not enlighten many amongst you!
For specific languages, I recommend:
All the sites above contain executables and lots of documentation.
- GNU Prolog
- Prolog tutorial
- Use gcc for C code. Turn on all warnings.
- Haskell. I recommend using Hugs for learning Haskell.
- Ocaml. Note that ocaml 3.04 is
installed on the CAS servers (in /usr/local/bin); this is fine for
getting the assignments done. The latest version of ocaml is 3.07+2,
but it is not necessary to use this.
- Java. Java 1.4 is already
installed on all CAS machines.
- You can use either free pascal
or use one of the undergraduates machine with Pascal installed on it.
This is now installed on birkohff (a Sun) and penguin (linux). To
run this properly you should
- add /usr/local/mercury-0.11.0/bin to your PATH,
This can be done (if you use a csh-based shell) via
set path = ($path /usr/local/mercury-0.11.0/bin)
in your .cshrc (in your home directory). Something similar can
be put in your configuration
if you use a sh-based shell.
- add /usr/local/mercury-0.11.0/man to your MANPATH,
- and add /usr/local/mercury-0.11.0/info to your INFOPATH.
- You may also want to add the following lines to the `.emacs' file in your home directory (if you are an emacs user):
(setq load-path (cons (expand-file-name
(autoload 'mdb "gud" "Invoke the Mercury debugger" t)
Lambda calculus interpreter
Domain Theory (pdf)
semantics of arrays & pointers (ppt)
Some questions on “Semantics of Arrays & Semantics of pointers” presentation:
- What are three categories of memory and what are their usages?
- Two sets (Environment and Memory) are used to manage memory, explain how their elements are produced and changed.
- What part(s) of memory are used, when a program requests (allocates) some bytes of memory with a pointer to it?
- What part(s) of memory are used, when a program requests (allocates) an array?
- Explain ‘new’ and ’allocate’ functions, when a program request memory for an array.
- Why do we change relation from t->t’ to t|mu -> t’|mu’
(mu and mu’ are the starting and ending states of memory), when we
are explaining operational semantics of pointer-evaluation?
Basic OO (pdf)
- What are the differences between subtyping and inheritance? What links them together?
- Clearly explain the advantages of using prototyping over classical object-oriented programming? Give an example of a prototype based language?
- Explain why traits is a more flexible solution compared to the other common forms of inheritance (ie. single, multiple, interfaces, and mixins).
- Explain the following OO principle “We aim for Strong Cohesion and weak coupling”. In your explanation include examples to be clear.
OO - overloading, overridding, etc (pdf)
- What are the benefits that AOP adds to OOP? What are the potential
- Describe the following AOP constructs: aspect, advice, join point,
- What is an aspect? What are the differences and similarities between
aspects and classes?
Compiling functional languages (pdf)
- Define and contrast the push/enter and eval/apply models of compiling higher-order functions.
- Describe a way of handling polymorphism (when compiling a functional language). What are the advantages/disadvantages?
- What is a thunk, how can it be represented, and what does "updating" mean?
- How are heap objects represented in the Spinelass Tagless G (STG) Machine? What are the advantages/disadvantages of this design choice?
- Describe the informal operational semantics of "let" and "case" in the STG language.
Lectures 0-5 (see bottom of page for links)
are very useful and topical. The slides from
this course on programming languages are also topical.
Googling for "introduction to lambda calculus" and
"lambda calculus interpreter" yield a lot of useful resources