The goal of this course is to make you understand computer 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 machines and understand trade-offs in programming language design.
The second part concerns a compiler for a programming language. There are two aspects of learning this part: theory and practice. The theory will be given in the lectures. The practice is carried on as classwork. To teach effectively I choose to design a toy language and implement its compiler. You will be studying actual compilers and modify them.
. . .
2 grammar
5 code generator
Code Generation Som v2.0 virtual machine S-code6 bottom up parser
Compiler, Grammar, Context Free Grammar
https://youtu.be/6jOBVCbNw8w?si=lIMDJsK0QedJjAdy
Parsing 1
https://youtu.be/O_nMvMUEFkw?si=d5EFon8rcXvZqy8m
Parsing 2
https://youtu.be/tEy7ZfpKZt0?si=T3aNS6365GiMfWzE
Activation record: Demo code and data https://youtu.be/xhAh2bpFLJs
Garbage collection https://youtu.be/vhTpUz3W4LQ
The main text is Jaruloj. It covers larger topics than required in this class. Our presentation follows this textbook. Aho,Sethi, Ullman is the standard textbook on compiler. It has been used in more than 100 universities in North America. It is a bit difficult to read as it contains a lot of theory. Louden is much easier to read. The latest edition is 1997, you can find it at Amazon.
$
./xparser test.txt Use rz36 to compile
and run your programs. Here is what a session looks
like. Go to rz36/test directory (that you unzip the package
to). There are three executable files: rz36.exe,
as21.exe, sim21.exe . Try to compile "fac.txt". It is
shown here:
//
factorial
fac(n)
if( n == 0 ) return 1
else return n * fac(n-1)
main()
print(fac(6)) D:\rz36\test>rz36
fac.txt
fac
main
(fun main (print (call fac 6 )))
(fun fac (else (== #1 0 )(return 1 )(return (* #1 (call fac (- #1 1
))))))
... D:\rz36\test>sim21
fac.obj
720