Modelling A Head Tube Lug In OpenSCAD

Recently I have been working on a project to build 3D printable lugs for a custom bike frame. I am using OpenSCAD to build this because I find the software to align very well to how I enjoy building things. As a software developer it is quite intuitive for building customizable 3D objects.

In this post I want to walk through my process of building the lower head tube lug using OpenSCAD. I do assume that you have an understanding of OpenSCAD, this is more of a guide than a beginner tutorial.

Read More...
Written 08/01/2022

Compiler Weekly: LLVM to AVR

Now that we have a working LLVM backend, I wanted to make one small step forward this week. Right now, the LLVM backend setup targets x86_64 based machines. That means the program that it creates will run on my laptop. But what if I want to run my program on something different?

I have a lot of AVR microcontrollers. They are small 8-bit chips that are good for controlling small circuits. If you have ever used an Arduino the AVR chip is the main chip inside it. My goal for this week is to have my compiler produce a hex file that I can upload and run directly on one of these chips. More specifically I want to run it on an ATmega328P.

Read More...
Written 07/11/2021

Compiler Weekly: LLVM Backend

All of my compiler projects so far have been focusing on the frontend. I spent a lot of time focusing on parsing languages but the runtime is usually very small. Now it’s time to take a closer look at the backend and build up some new tools.

I chose to work with LLVM because it has some great properties. I wanted a tool that could create native binaries. In my opinion, there is a huge advantage of having native code over using an interpreter or vm. I also know that LLVM has a well supported and known API. It’s a great way to get started building compilers that you know will work because other people have done it.

This week, my project will use LLVM to produce hello world binaries. There wont be much flexibility but it will show the basics needed to setup your own LLVM compiler.

Read More...
Written 30/10/2021

Compiler Weekly: Truth

This week I took yet another look at improving the parser logic that I have been using. In the past I tried to use parser-combinators to build up my parsers with the idea that they might be smaller, simpler or better. This time I decided to simply write the parser from scratch.

Read More...
Written 26/10/2021

Compiler Weekly: BrainF*** Interpreter

This week I set out to solve my parser woes from my last post. I worked really hard to build a library that would match my needs. In the end I came up with a project called pebble_parser. Its a similar parser combinator library to pom but with a better syntax and it works on iterators rather than arrays.

My project for this week was to build a BrainF**k compiler. Its a simple language with very little syntax. I figured it would be a great way to test out my parser without having too hard a project to complete.

Read More...
Written 17/10/2021