Currently working on the error productions question in @munificentbob's 'Crafting Interpreters.'

Because I am a fool, I am doing it on the finished interpreter and not on the chapter-incremental one where the question is actually presented.

One thing I am learning is that...
@munificentbob ...error productions are a difficult thing to do in a partial way, particularly if you are replacing a very common error (in this case 'Expect expression,' the base error at the bottom of the Parser tree).

I traded throwing an exception there for returning a new expression type.
@munificentbob 18 tests, not including mine, expect an exception there.

I am resolving this by going to each test, figuring out what parse error it's supposed to be checking for, and adding an error production there, too.

Am I making this too hard? Is there an incremental way to do this?
@munificentbob Fun discovery: the AST Generator doesn't like it when you try to make an expression type that takes no constructor inputs, which I got around by having Expr.Nothing accept a string I don't use

So we've got

return new Expr.Nothing("Nothing, there's nothing here, nothing");
Here's the code, if that helps anybody understand what I'm asking here

github.com/chelseatroy/cr…
UPDATE: the longer I work on these error productions, the more fermented my parse error messages become Image

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Chelsea Troy 🏳️‍🌈

Chelsea Troy 🏳️‍🌈 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @HeyChelseaTroy

Feb 8
Oooh!

I'm seeing a fair amount of agreement on this, and "catching parse errors" has sort of become a thing of mine lately. So lemme try to answer this question in a way that an 8 year old might appreciate.

1/
FIRST: I see these "There's no semicolons in Python" replies

I suspect the kid's ACTUAL example was some Python-specific thing, so Joe switched it for something more programmers would recognize and y'all seized the opportunity to get pedantic. You must be a riot at parties.
SECOND: if you're gonna deliberately miss the point of a lighthearted tweet to well-actually someone about how there's no semicolons in Python, you deserve this:

There are semicolons in Python. You delineate multiple statements on the same line with semicolons.

ANYWAY, ONWARD
Read 24 tweets
Feb 6
Today I'd like to speak briefly about the differences I have experienced between full-time employment, freelance, and consulting interview processes.

I'll also comment, for each case, on what the actual work asked of me was once I got to the place.
Who am I to talk about this:

- I've done countless tech interviews, and some of them I even passed. I work at Mozilla FT.
- I do contracts, mostly mobile or data/ML work. 4 active clients, 2 additional awaiting grant awards.
- I give workshops 10-15x/year
I have needed to know how to use a binary tree countless times in my career. I have needed to know how to implement one twice. Both were FT interviews.

I have needed to use recursion twice in my career. I have needed to demonstrate that I could nine times in interviews.
Read 33 tweets
Feb 4
Let's talk about why this is hard and how to do it well.

I suspect you're going to hate what I'm about to suggest. It's not my snap reaction either, and I have had to train myself to do it.

/1
But it's worth it because ultimately what we're doing, as that tweet explicitly states, is learning to treat thoughtful people we trust differently than we treat Nazis.

Y'all, I hope it's really f**king easy to distinguish people with a humanitarian track record from Nazis.

/2
SO, I want to acknowledge the things that make it harder. And I'm warning you, this is not going to be fun to read.

/3
Read 14 tweets
Jan 31
Last week I tweeted for help deploying updates to a mobile app on the app/play stores. Thank you, folks who RT’d!

No one came forward. I’m taking that to mean even FT mobile devs aren’t confident they know how to do it.
So I figured it out myself. Here’s what I learned.

1/
Before I start, lemme reiterate that I did this alone after asking for help.

So any Android or iOS reply guys out there who are getting ready to make a name for themselves well-actuallying me in the replies can instead read this thread.

Let’s set the scene. You have to deploy an update to an existing mobile app, but every single provisioning profile, keystore, everything you ever generated to upload it the first time is somehow missing or expired.

Your mobile app is the jeep scene from Jurassic World. Congrats.
Read 28 tweets
Jan 30
Okay you know what I'm coming back to Calendly.

I don't want to talk about Calendly. I want to talk about the way people treated each other in that discussion.

This is gonna start out kinda draggy, and then I promise we'll get to some...skills that could use some work.
1. I already said this but I'm saying it again. This is not a thread about Calendly. Do not get in here and start yelling at me, each other, or God about Calendly.

Because there is basically one appropriate perspective on Calendly and it is "This is a tool with a use case."
The conversation was not "Folks have different experiences with the use case. Why? What can we learn from that?"

The conversation was somehow very quickly a lot of adults I know who have built their whole, like, brand on having empathy, being absolute shitheads to each other.
Read 22 tweets
Jan 23
So, the cringe Psaki quote.

It's not that I think it needs more dunking.

In fact, I think it exemplifies something I've been thinking about lately on a smaller scale than "Press Secretary."

And frankly, that thing? Is worth considering for all of us.

1/
So, there are two reasons folks are mad here. I wanna acknowledge the first one even though this thread is really about the second one, so let me do that.

1. The quote talks about legislation that will be life-and-death for some with 'my sports team lost' level of urgency.
Why is that a big deal? It's not an unusual error of perspective for someone like Psaki to make because that's about the stakes for a well-off (wh*te, and I'd also add het) person.

BUT, this administration won on the promise to this country that they WOULDN'T make this error.
Read 32 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

:(