Posts About C++

Loxx: Implementing Bob Nystrom's Lox in C++14

Last autumn I discovered Crafting Interpreters, a book by Bob Nystrom that gives readers a comprehensive guide to writing interpreters for a toy programming language, Lox. To me the world of compilers and interpreters has always been a total mystery. Okay, so I know what a syntax tree is, and I've occassionally even been brave enough to look at the assembly output for a program I've written. Also doesn't parsing need to happen at some point? Anyway, I was pretty intrigued, so in I dived.

Bob's book is divided into two parts. The first details how to write a tree-walking interpreter in Java. Code is parsed and a syntax tree is generated from it, which is then evaluated in-place. By his own admission, this isn't a particularly efficient way to evaluate code, so the second part of the book describes how to write a stack-based virtual machine in C, which … Read more

Posted by Matt Spraggs on

Last edited on

Tags: Compilers, C++

"New" Job!

So the title of this post was originally going to be "New Job!", but since I've been in my current post since September I figured that might be a bit misleading, so I added some lovely quotes to make it feel less like a blatant lie.

Since the end of my PhD I've been working in the department of Electronics and Computer Science at the University of Southampton, doing software engineering as part of a project called SMARTmove. The project aims to rehabilitate the upper limbs of stroke patients using a technique known as functional electrical stimulation (FES). By electrically stimulating the arm muscles of stroke patients as they attempt a series of functional tasks it is anticipated that they will recover some control over the arm that was debilitated by the stroke.

The electrical stimulation is provided via an electrode array printed onto a wearable sleeve, and the patient's … Read more

Posted by Matt Spraggs on

Last edited on

Tags: Employment, C#

LEGO and Arduino: This Is the Droid You're Looking For

Like any self-respecting geek, as soon as I heard about the Arduino, I wanted one. Admittedly I was pretty late to the party, way past what could pass for fashionably late, as I only found out about it a year and a half ago. But anyway, no sooner had I heard about it than I was adding an Arduino Uno to my basket and checking out on Amazon.

I diligently worked my way through the first few projects in the book that came with the Uno, which provides a nice and gentle introduction to electronic circuits. Inevitably I started dreaming up grand designs for what I was going to do with my new toy. I had visions of some artificially intelligent robot that could rove amiably around my flat without smashing into anything, learning the layout as it went, and perhaps letting me know if it's going to rain later … Read more

Global Game Jam 2015 (Part II)

Click here for part I.

Much of Saturday was spent laying down the game code. I worked on some of the game backend, creating an object-orientated interface to the game world and levels. The world would be split into several rooms, and each room would contain a series of blocks, some of which the player could interact with. Inspired by Spelunky, we decided to store our level layouts in ASCII files to simplify level editing.

At 6pm on Saturday a mini-showcase was held. This was supposed to be an intermediate deadline to work towards to try and get something playable that could be worked with over the next 21 hours. By this point we had code that compiled and a character that could be moved around the screen. But the rest of world and all the game physics were missing, so we still had some way to go. In actuality … Read more

Global Game Jam 2015 (Part I)

It's 10pm on Friday night and I'm sat in the computer lab in ECS at the University of Southampton. My mind is racing, full of what needs to be done and what I have to do; it's hard not to feel a little overwhelmed. No, this isn't some desperate slog in the last chance saloon to make a university assignment deadline. Earlier this year I signed up to take part in the Global Game Jam 2015.

I'd never written a computer game before, and the opportunity to get stuck in and work with others to produce something like a game really grabbed me. So, perhaps naively, I signed up. But still, I couldn't help but feel a little apprehensive. I wouldn't describe myself as a hardcore gamer. I play TF2, Minecraft and WoW on occasion, but I've never really got past the casual stage of gaming. Did I have enough … Read more