After successfully generating some barely readable C# code from a GW-BASIC program, I mentioned how it would make a good basis for a legacy code refactoring exercise. Today I will share the results of this exercise with a brief survey…
Refactoring recipes: remove goto
As a result of my GW-BASIC to C# code generation project, I was left with a barely readable (though properly executing) program. Given its source material, it of course featured Dijkstra’s most maligned construct quite heavily — goto statements. Being…
BASIC solutions: code generation!
It’s been a long slog, but the quest is over. I now have a functional-enough GW-BASIC to C# code translator. Using adventure.bas as a guide, I implemented enough features to produce a working version of it reimagined in C#. The…
Know your (large) numbers
As a child, I was fascinated by large numbers. I recall being unbelievably excited when my dad gave me a clipping of a newspaper trivia column which listed the names of numbers from a million up to decillion. While most…
BASIC solutions: statements
My last post showcased what I thought was a complete GW-BASIC expression parsing solution. Hence, I pushed forward with a new project to implement statement parsing. This went fine for a bit, but I quickly encountered overly complicated situations. Without…
BASIC solutions: expressions
Previously, I showed the beginnings of a GW-BASIC expression parser. As of now, the parser is essentially feature complete! I fixed the unary minus bug and went on to implement all the remaining features — mainly relational, logical, and functional…
BASIC complications: expressions
My GW-BASIC saga continues. I’m on the third rewrite now of this “simple” translation app. I keep encountering problems that ultimately challenge core design decisions I made early on. Given the time scale and the fact that this is a…
BASIC complications: parser combinators
When I wrote about creating a GW-BASIC translator, I admit I didn’t fully grasp what I was getting myself into. Even a simple language like BASIC has a relatively involved syntax, which makes parsing a challenge (doubly so because I…
More four fours
Astute readers may have noticed in my previous post about the four fours that I neglected to include exponents in the set of supported mathematical operations. Well, that is fixed now. Perhaps these imagined readers also noticed that my recursive…
Four fours
Back in elementary school, I became aware of the four fours puzzle. It is a seemingly simple mathematical exercise where you must generate all the integers from 1 to 100 using arithmetic expressions and the digit 4 exactly four times.…