Year 3 Semester 2 Results

Today I received my final set of grades for my BSc (Hons) in Computer Science from the University of Hull – This included my two second semester modules, Mobile Devices and Application and Distributed Systems Programming, as well as my Final Year Project.

I achieved a grade of 85% in Mobile Devices and Applications, and 89% in Distributed Systems Programming.

The final year project was worth twice as many credits as each second semester, and so had more of an effect on the final grade. Thankfully I did quite well in the final year project, achieving a grade of 86%.

My overall weighted average for this year, including my first semester modules grades, is 86.5%.

This grade, weighted with my second year grades, means that my final grade for my degree as a whole is 86% – a very high first! I am of course over the moon with this.

I’d like to again say thank you to everyone who has made my time at university not only great for learning, but truly the best three years of my life (so far! :P). Particularly, but not limited to:

  • Rob Crocombe
  • Simon Watkins
  • Hayley Hatton
  • Russell Billingsley
  • Toby Russell
  • Jon Rich
  • Tom “Jeff” Procter
  • Special mention to “our American foreign exchange students”


  • Dr Martin Walker
  • Eur Ing Brian Tompsett
  • Rob Miles
  • Dr David Parker
  • Dr Peter Robinson

And of course anyone I spent time with in the labs or any of the many, many nights out in the first two years. Last but by no stretch of the imagination least thanks to my Mum, Dad, Brother and Sister for supporting me throughout the last 3 years.

I’m looking forward to trying to maintain this good score next year at York! Of course I will continue to do this blog throughout my time there too.


University - Masters

University of York – MSc in Advanced Computer Science

Today I recieved word that I have been accepted for an award of a £5000 academic performance scholarship at The University of York.

This offer, alongside the high standard of teaching & research, beautiful new department facilities (pictured above) means that I have decided that I will be spending next year studying a Masters of Science degree in Advanced Computer Science at The University of York.

It is my intention, once the masters degree is complete, to continue on with a PhD. The masters degree should give me all the knowledge and experience I need to choose a partciular field in which I wish to do my research.

In the near future I will be formally accepting the offer, which I can do once I have recieved my final transcript from here in Hull, choosing my accomodation and selecting my module choices for next year. I will of course keep the blog updated with any developments.

I would like to take this time to thank Dr. Martin Walker and Rob Miles at the University of Hull for writing me two fantastic references, which no doubt helped me get accepted onto the course and in the application process for the scholarship award.

Similarly I would like to thank Jonathan Stokoe for the making the application process so pain-free, and Dr. Jeremey Jacobs for giving both myself and Rob Crocombe a tour of the Computer Science facilities at York.



Initial and Interim Report Results – 72% and 85%

The Interim Report is quite big, this is just under half of it

As part of the process of completing the final year project you have to submit two, smaller iterative, reports before your final report. These are a great opportunity to get in-depth feedback on your work before submitting your final report — they’re also a good way to evaluate your progress.

Initial Report

The initial report — which is produced early on in the project, in September — outlined the introduction and context of the project, for me this consisted of explaining what PHP is, what an integrated development environment (IDE) is and then discussing what other PHP IDE solutions are on the market today.

Initial ideas of what technologies and methodologies would be used for the project were also briefly discussed based on research I did over the summer, which had to be referenced in Harvard style.

Perhaps most importantly the initial report was the time when my project title, aims and objectives were set in stone for the first time. A time plan and associated gantt chart were produced to outline which work should be taking place at which time in order to deliver a finished product by the due date for the report.

The initial report was marked by Professor Ping Jiang and he awarded me a mark of 72%, which I was pretty happy with for my first mark of the third year. 🙂

Interim Report

Yesterday I got back my mark for my Interim Report. The Interim Report is used to detail your progress since the initial report, and is submitted in January, about half way through your development time.

All the reports are iterative, in other words based off of the previous one. So I added in more detail about which methodologies I have been using to develop my project, updated my time plan to be more realistic and discussed the risks and ethical issues associated with the production of my IDE.

Dr. Martin Walker marked this report and I’m very happy to say that I got 85%. This gives me a good base on which to produce a good final project, especially with the in-depth feedback I received.

I will of course keep the blog updated with future developments on the final year project.



Languages and Their Compilers ACW Result – 80%

You may have noticed that my blog hasn’t been updated nearly as much this semester as it has been in those last year and the year before. One of the reasons for this has been the Languages and Compilers assessed coursework, which has taken up quite a bit of time.

The aim of the coursework was to build a compiler, a bit of software which converts from a “high level” human readable language to a “low level” language a computer can execute, for a completely made up language called SPL – which stands for Simple Programming Language.

Formalizing the Grammar of the Language

SPL If Then Else Syntax Diagram
SPL If Then Else Syntax Diagram

The first thing we had to do was formally specify the grammar of the language — the grammar of a language specifies what is, and isn’t, valid in said language — we did this by reading some syntax diagrams provided to us by our lecturer, such as the one above, and then writing out Backus-Naur form notation to describe it. The image above in Backus-Naur form is notated as:

<if_statement> ::= IF <conditional> THEN <statement_list> ENDIF |
                   IF <conditional> THEN <statement_list> ELSE <statement_list> ENDIF

Items in <brackets> are other rules, so there would be another rule which describes the syntax of “conditional” and “statement list”. Using multiple rules together allows us to build up a complete syntax for the language.

The Tokenizer

Once we had developed a complete BNF grammar for the language we could move on to building the compiler itself, this was especially interesting for me because my final year project uses a lot of the same concepts.

The first stage of building the compiler was building a tokenizer. A tokenizer, as I’ve spoken about before, is a system which recognizes certain keywords, or patterns, and gives them a label which can then be used later on in the compilation. For example the C# code:

public static void main()
     int a = 10 / 2;

Consists of the following tokens:

  • Public Keyword
  • Static Keyword
  • Void Keywork
  • Identifier Pattern main
  • Open Bracket (sometimes referred to as BRA)
  • Close Bracket (sometimes referred to as KET)
  • Open Curly Bracket
  • int keyword
  • Identifier Pattern a
  • Symbol =
  • Integer Pattern
  • Symbol /
  • Integer Pattern
  • Semi Colon
  • Close Curly Backet

We used an open source version of the Unix program lex, called flex, to build our tokenizer (in my FYP I’m building a tokenizer from scratch). In our flex file we recognized tokens using regular expressions. Matching something like a keyword is rather simple, you just look for that literal string, however looking for an integer is a tad more interesting. Below you can see a few examples:

/* Primitives */
digit                  [0-9]
number                 {digit}+
/* End: Primitives*/

//Public keyword
public                 TOKEN(public);

//Integers (e.g. whole numbers)
{number}               TOKEN(integer);

//Reals (e.g. Numbers with decimal point)
{number}.{number}      TOKEN(float);

On the left hand side of the token recognition is the pattern that has to be matched. For the word public it is the literal string public, for integers it is a {number} and for a real it is a {number} a full stop and then another {number}. {number} has been declared previously to be 1 or more digits, and a digit has been declared before that to be any number between 0 and 9.

The tokenizer takes a .spl file, which contains spl code written by a programmer, and spits out an array of tokens which we can then use in the next stage.

The Syntax Parser

Once we’ve finished building our tokenizer we could then go on to building a syntax parser. The job of the syntax parser is to ensure that the array of tokens provided by the tokenizer are in an order which makes sense. To produce the syntax parser we used a free program called Bison, which is based on the Unix program YACC.

This is where we go back to the Backus-Naur Form we made previously. Using that, with some alteration, we produced a .y file which, once passed through Bison, could identify correct grammars in the list of tokens passed to it — and tell the programmer there was an issue with their code if anything was detected as incorrect.

Correct grammars were added to a parse tree, in hierarchical order. As we saw earlier, an IF statement contains a conditional, so that became one of the branch nodes of the tree which represented an IF statement.

At this point we could print out the parse tree, my software could print both to the console and to an interactive animated viewer. Below you can see both:

a.spl Parse Tree as shown in the Command Prompt
a.spl Parse Tree as shown in the Command Prompt
a.spl Parse Tree as Interactive Animated Viewer (Click to enlarge)
a.spl Parse Tree as Interactive Animated Viewer (Click to enlarge)

Code Generation

Once we have determined that the input file from the programer is syntactically correct we need to generate executable code. For this coursework instead of generating an executable directly we generated ANSI C code, and passed that to the GNU C Compiler. We did this for a few reasons:

  • Generating machine code directly wouldn’t be as portable
  • Generating machine code would take a lot longer!
  • Learning ANSI C was really useful, as its the number 1 most used programming language in the world

Generating code was a simple case of walking the parse tree and generating code for each node… for example, if you reach an IF THEN ELSE node you could simply output the following:

if(/*Generate code for the CONDITIONAL here*/)
    /*Generate code for the IF statement list here*/
    /*Generate code for the ELSE statement list here*/

Ensuring you generate code for the conditional and statement lists in the correct sequence. Certain types of grammar throw up a few problems, such as FOR LOOPS (which way should the iteration go?) but the concept of code generation from a tree in itself is simple.


The final part of the coursework was to add some optimization to the compiler. Some optimizations you could implement included:

  • Don’t compile the code if it doesn’t contain and input or output (if a program has no input or output, it looks the same as having no program at all!)
  • If a programmer increments a variable by 1 generate the ++ operator rather than +1
  • Constant Folding: If a variable is assigned to the outcome of a constant set of values. e.g.  a = 4/2, then generate a = 2 because this will always be the case

I chose to do both the incrementation optimization and the no input or output optimizations. I was going to add constant folding too, but didn’t think I had enough time.


Today I got my grade for the coursework and achieved 80%, which is a strong first class. I’m really happy with this. 🙂

I would recommend that any second year thinking about what modules he or she should take next year seriously consider Languages and Compilers, it is by far the best module I have taken. It combines knowledge from all your previous modules and really cements that information in your head.

I’d like to thank both Dr. Martin Walker and Eur Ing Brian Tompsett for setting such an interesting coursework, and providing me with the help that they did along the way.

If I’m allowed I might upload my compiler and some documentation for SPL for people to have a play with it.



Third Year Project Allocation

Today my third year project allocation was finalized, and so I am very excited to start talking about it.

A third year project, sometimes known as a final year project (though not by me because I’m on a four year Masters course), is a software development and documentation project spanning from now until the end of the third year. In that time we have to write about how we plan to make a piece of software, make said piece of software and then review how we did, what we created and how we would do things differently if we had our time over.

It is intended to be an exercise in real development for us all, rather than a piece of coursework that lasts only a few short weeks it will last a whole year, have real deadlines and been completely our own idea and run under our own steam. This means we set out own timetable for when work is expected to be completed by and us and us alone make sure said work gets done.

My personal aim with this project is to produce the piece of software that I am most proud of. A hope would be to have something that I could either sell commercially, or release as an open source product that would develop an active community.

So, onto the project I’ve been allocated. Below you can see the project description, originally written by Dr. Martin Walker

Code editor with syntax highlighting & autocomplete      

Although it is possible to program using nothing more than Notepad and a compiler, it is much easier to use an Interactive Development Environment (IDE) as the GUI for programming. Typical features include syntax highlighting, so that the keywords are readily visible, and autocomplete (e.g. like Visual Studio’s Intellisense) to improve efficiency or gain context dependent help.

This project would involve creating your own IDE, such as a simple Notepad++ style program ( Primary features would include syntax highlighting and autocomplete, but other possibilities include compiler integration (to run the compiler from within your IDE) and feedback on errors, e.g. highlighting lines with errors in red. You could choose to make the IDE specific to a single programming language, or configurable so that it can be used with multiple languages.

My plan to work within this frame, but also add to it, is to create an IDE for the server side programming language PHP – The Hyperscript Pre-processor. This is the programming language I first learnt, and therefore one of the languages — alongside C# — that I am most comfortable with. This means that hopefully, with my years of experience with the language, I will know what developers want in their IDE and be able to implement it in a good way, in fact I already have a few good ideas.

I do know, from years of doing PHP that there isn’t an IDE that makes developers as comfortable as say Visual Studio does for C# or C++ developers. I hope to change this.

One of the other interesting things about this project is that it will go really well with one of the modules I’ve chosen for next year, which is titled “Languages and Their Compilers”.

Expect to hear a lot more about this in the future!