diff -r 516240b57cfb -r e69c7e03bbd1 bsc-projects.html --- a/bsc-projects.html Wed May 08 15:22:31 2024 +0100 +++ b/bsc-projects.html Mon May 13 00:34:09 2024 +0100 @@ -1,12 +1,18 @@
-Parsing is an old nut. Generations of software developers need to do parsing of data or text. @@ -200,22 +206,24 @@
-Description: Compilers translate high-level programs that humans can read and write into efficient machine code that can be run on a CPU or virtual machine. - A compiler for a simple functional language generating X86 code is described - here. + A compiler for a simple functional language generating assembly code is described + here. I recently implemented a very simple compiler for an even simpler functional programming language following this paper (also described here). - My code, written in Scala, of this compiler is - here. - The compiler can deal with simple programs involving natural numbers, such - as Fibonacci numbers or factorial (but it can be easily extended - that is not the point). + My code, written in Scala, for this compiler is + here. + The compiler can only deal with simple programs involving natural numbers, such + as Fibonacci numbers or factorial function (but it can be easily extended - that is not the point). + The interesting feature in this compiler is that it can also deal with closure conversions and hoisting of + nested functions.
@@ -223,11 +231,11 @@ my compiler only produces some idealised machine code. For example I assume there are infinitely many registers. The goal of this project is to generate machine code that is more realistic and can - run on a CPU, like X86, or run on a virtual machine, say the JVM. + run on a CPU, like X86, or run on a virtual machine, say the JVM. + You could also compile to the LLVM-IR. This gives probably a speedup of thousand times in comparison to - my naive machine code and virtual machine. The project - requires to dig into the literature about real CPUs and generating - real machine code. + my naive machine code and tiny virtual machine. The project + requires to dig into the literature about real machine code.
An alternative is to not generate machine code, but build a compiler that compiles to @@ -240,13 +248,13 @@ very optimised subsets of JavaScript that can be used for this purpose: one is asm.js and the other is emscripten. Since - last year there is even the official Webassembly + a few year ago there is even the official Webassembly There is a tutorial for emscripten and an impressive demo which runs the Unreal Engine 3 in a browser with spectacular speed. This was achieved by compiling the C-code of the Unreal Engine to the LLVM intermediate language and then translating the LLVM - code to JavaScript. + code to JavaScript/Webassembly.
@@ -271,7 +279,8 @@ what machine code looks like you can compile your C-program using gcc -S.
- If JavaScript is chosen as a target instead, then there are plenty of tutorials on the Web. + If JavaScript is chosen as a target instead, then there are plenty of + tutorials on the Web. Here is a list of free books on JavaScript. A project from which you can draw inspiration is this Lisp-to-JavaScript @@ -297,10 +306,18 @@
PS: Compiler projects consistently received high marks in the past. - I have supervised eight so far and most of them received a mark above 70% - one even was awarded a prize. + I have supervised eight so far and many of them received a mark above 70% - one even was awarded a prize. + However in order to achieve anything better than a passing mark, you need to go beyond the + compiler presented in the CFL-module. For example you could implement + +
Webassembly is a recently agreed standard for speeding up web applications in browsers. In this @@ -319,6 +336,7 @@ Skills: See [CU1].
+