Category: Uncategorized

  • Working through ‘Writing A C Compiler’ – Introduction

    The introduction covers a lot of important stuff about implementing the compiler. Platforms The book is setup to work on Linux and Mac. I am a primarily Windows dev (ex MSFT employee), I do a fair amount of contributions to rust projects and so do stuff on all three platforms, but Windows is where I…

  • Working through ‘Writing A C Compiler’

    Some time ago I decided I wanted to create a c compiler for the Hack processor in the nand2tetris book. After several dead end attempts that I might describe later I found this book : Writing a C Compiler | No Starch Press I decided to work my way through it. I plan to do…

  • FPGA journey part 2

    FPGA journey part 2

    In the previous post I talked about my experience with ICE40 based FPGA boards. In the end I abandoned them because they did not have enough block RAM (I need 128kb). After looking at the Alcrity Au Alchitry Au FPGA Development Board (Xilinx Artix 7) – DEV-16527 – SparkFun Electronics and Au+ I decided on…

  • FPGA journey

    FPGA journey

    As mentioned in a previous post one of the things triggered by my descent into the nand2tetris hole was the decision start working with FPGAs. I will not explain what FPGAs are , there are plenty of resources online for that. THe one I started with was Nandland: FPGA, VHDL, Verilog Examples & Tutorials. Instead…

  • Disappearing down the ‘Nand to Tetris’ rabbit hole

    A few months ago I read an article on Medium that recommended a few books, amongst them was ‘The elements of computing systems’, better known by its nickname ‘From Nand to Tetris’. This book describes how computers work from basic logic gates all the way up to compilers and walks you through building these systems.…

  • Interfacing C With Rust To Build a Debugger

    Photo by Markus Spiske on Unsplash Introduction I decided to write a debugger for the sim65 6502 emulator that’s part of the cc65 tool suite (cc65 — a freeware C compiler for 6502 based systems). The cc65 toolset is written in c, but I was not going to even attempt to code a debugger in pure c (I…

  • Common Stack Overflow Errors #3 C error handling

    Or rather the complete lack of it. New c programmers coming from Python, Java, C#, JavaScript etc. expect to be told when something goes wrong. Exceptions get thrown, runtime engines complain, … For example f = open(“demofile.txt”, “r”)print(f.read()) On my machine (the file doesnt exist) pm100@paul-think:~$ python3 so.pyTraceback (most recent call last): File “so.py”, line 1,…

  • Common StackOverflow errors #2 scanf

    Ah yes, the evil that is scanf. I always try to avoid using it because of its quirks. Many , many common misuses of it. #1 Not passing pointers float f;scanf(“%f”, f); This is instant UB, the program usually crashes right there. Spotted by most compilers so1.c:13:15: warning: format ‘%d’ expects argument of type ‘int *’, but…

  • Common StackOverflow Errors #1 returning pointer to stack data

    I like to help beginner programmers on StackOverflow. I thought I would do a series of articles on common errors, mainly in C but with some c++ and maybe a few other languages. Why? Its interesting to see the things that people get stuck on Maybe potential posters to SO will look here and find…

  • Common StackOverflow errors

    I answer lots of beginner questions on StackOverflow. The same issues come up over and over again so I thought I would post articles about the commonly seen ones. There are several ‘meta’ issues; questions that are not answerable, lack data, etc. I thought I would start with some of those. These are mainly FYI…