Sunday | 23 JUN 2024
[ previous ]
[ next ]

BASIC Linter

Date: 2022-11-27

A fun distraction was writing a linter for BASIC programs. This was relatively straightforward but the big thing I learned and really solidified was doing recursion using internal subroutines.

This involves saving all the information to an array. I was using this technique in the editor already but this was a simpler implementation and it makes it clear what I'm really doing.

I also really like how dumb of a linter it is. For each rule that I want to check, I go through the entire file from scratch. This is extremely wasteful but also the quickest way I could get the linter working. The next step would be to get rid of the looping and just call each of the rules for each line. It's a very simple change but I didn't want to accidentally make this project harder than it was.

Currently I ran it against a few different files and it seems to be quite helpful. The big issue is that most of our code is definitely not passing the linter so I wonder if it'll be good to have the program conform to the linter as we make even small changes. Long term, my gut feeling is yes but it is going to add a lot of small clean up work.