Updates on the Weir Language

In my last blog post, I de­scribed the why, what, and how of the Weir pro­gram­ming lan­guage. I sug­gest you read that first.

Before sign­ing off for the day, I just wanted to give a few up­dates on the pro­ject. For those in­ter­ested in the tech­ni­cal side of things, I’ve opened a draft PR for your read­ing plea­sure.

Updated Keywords

After hav­ing a con­ver­sa­tion with Jason Adams, I came to the re­al­iza­tion that declare and set are pretty sh*tty key­words. They aren’t self-de­scrib­ing and you’d be hard-pressed to find any real pro­gram­ming lan­guage that uses them.

I’ve in­stead re­placed them with let and expr.

Here’s what the rule from my last blog post looks like with these up­dated key­words:

expr main [(G [Suite, Suit]), (Google Apps for Work)]
let message "Use the updated brand."
let description "`G Suite` or `Google Apps for Work` is now called `Google Workspace`"
let kind "Miscellaneous"
let becomes "Google Workspace"
let strategy "Exact"

Note that I’ve also added the strategy set­ting. This al­lows rule au­thors to de­scribe which strat­egy Harper will use when ap­ply­ing the re­place­ments. Right now, the only two op­tions are Exact or MatchCase, which ap­ply ei­ther the ex­act text, or the ex­act text but match­ing the cap­i­tal­iza­tion of the text it re­places. In the above ex­am­ple, we use Exact be­cause it is a proper noun, and it does­n’t mat­ter what the orig­i­nal text looked like: we want to cap­i­tal­ize it prop­erly.

Deprecation of the phrase_corrections Module

I’ve also gone ahead and con­verted the en­tirety of the phrase_corrections mod­ule, as well as all as­so­ci­ated tests, to the Weir lan­guage. If you’re read­ing this and you’re a con­trib­u­tor, know that we will no longer be adding new rules to that mod­ule once Weir is merged into master. When the merge hap­pens, I’ll han­dle the con­ver­sion of any lag­ging phrase cor­rec­tions that haven’t al­ready been con­verted.

That un­for­tu­nately means that my pre­vi­ous guide on the sub­ject is no longer rel­e­vant.

What’s Next?

Before Weir gets merged, I plan to sup­port the match­ing of UPOS tags, in ad­di­tional to some other qual­ity of life up­dates. Ex­pect an­other blog post.

In the mean­time, please let me know if you have any ad­di­tional in­put!

Published December 17, 2025 at 7:00 AM

Proofread by Harper.

Comments