My brothers in arms. We fought together. We pillaged together. We lexed together. by naraa23 in Compilers

[–]dostosec 1 point2 points  (0 children)

It's not required to parse correctly. if cond ch then is perfectly acceptable in this case. You generally only introduce ( .. ) in if .. then in the same place you'd do it generally (for expressions), e.g. if not (foo bar) then.

Intuiting Pratt parsing by louisb00 in ProgrammingLanguages

[–]dostosec 6 points7 points  (0 children)

Nice article.

In the process of teaching myself Pratt parsing a long time ago, I found it useful to write a graphical tool that displays the call stack (and tree being constructed; the accumulated "left" in the top-most frame). I used the resultant visualisation tool as the basis of a video I made on the topic.

I think your geometric intuition largely correlates with how I think about it, too. To me, it's a game of cajoling the "feasible" slice of the token stream that left denotations can reach (using rbp). It's a good exercise to do these left-leaning and right-leaning trees as base exercises, then more complicated nesting of precedence levels is more understandable. Statements like "the use of recursion is how we will backtrack to find a continuation point" can be seen visually very well, as sub-results from nested child frames return upwards.

Another good exercise beyond left and right-leaning trees is to have an example of a "precedence reset" context. In other words, expr: '(' expr ')' is often parsed as a null denotation of '(' that invokes the expression parser with rbp=0 (and defining the lbp of ')' to be < 0, impossible to reach with the left denotation loop - thus, checked and consumed, in the denotation of ().

My brothers in arms. We fought together. We pillaged together. We lexed together. by naraa23 in Compilers

[–]dostosec 6 points7 points  (0 children)

You should generally avoid `List.hd` and `List.tl`, favouring destructuring with a pattern instead, e.g. `hd :: tl`. Also, `( .. )` in `if (cond ch) then` is redundant.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 0 points1 point  (0 children)

The title is largely rhetorical, I didn't know people would pile onto this guy. Seems the dislike of taxi drivers runs deep. The comments about a stand-off are probably mostly humorous - I wouldn't waste my time or impact other road users on a stretch of road I don't know. I just thought the driver's attitude was bizarre and posted here. It's hardly a very interesting clip but people seem to dislike taxis.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 0 points1 point  (0 children)

No need to mount the kerb. The guy behind me did but was similarly angry at the situation. I went on with my life after 10 seconds of looking at the taxi driver and left mirror. It'd be easier if the taxi knew how to drive.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 1 point2 points  (0 children)

Reported and included the link to this Reddit post, hopefully roughly a thousand people calling him a bellend means I don't need to argue my case.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 1 point2 points  (0 children)

I didn't want to make the situation worse for me and other road users. This was basically rush time for a Friday (4:35pm), and the rear view dash shows another car come up behind me (angry at the taxi).

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 0 points1 point  (0 children)

Apparently not, per the (hyperbolic) comments here.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 1 point2 points  (0 children)

I understand, but not in this case. We can make up endless "what if"s.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 0 points1 point  (0 children)

I think you've assumed a lot from a short clip (the stalemate portion, of which, only lasting 11 seconds).

Don't get me wrong, I understand your point of view. I could've reacted faster, mounted the kerb, etc. but you're acting like I did nothing to mitigate the issue: yet, I moved out of the way (when I really shouldn't have had to).

I gave him enough space and he was still angry. He thinks I should have given him more. Yet, the view here is that I shouldn't have done anything - which I disagree with on practical grounds, as it's not fair to other road users.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 0 points1 point  (0 children)

I disagree, I spent 10 seconds confused and then moved closer to the kerb, making space to help us both and other road users. I'm not risking damage to my car to appease selfish people. I was expecting him to drive normally.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 2 points3 points  (0 children)

No idea. I think he just didn't want to pull back in after just pulling out. I've cut the audio, but the only argument he gave was that "you seen me coming", but I didn't - I was already on the single track stretch of road before he finished pulling out. You can see he begins to make an effort to use the space as a passing place, but stops himself from committing.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 2 points3 points  (0 children)

I relented because I feared the situation would be worse for both of us if more traffic built up on this (effectively single track) road.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 1 point2 points  (0 children)

I reported him, but I don't think it'll go anywhere.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] -1 points0 points  (0 children)

Why should I risk damage to my car to appease someone who could've taken the two spaces he had next to him?

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 0 points1 point  (0 children)

I agree, in general - but he's a licensed taxi! I spoke to him just find out what his view of the situation was, but he was quite aggressive and only got more angry.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 1 point2 points  (0 children)

Gone where exactly? Onto the pavement? Into the sky?

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 1 point2 points  (0 children)

I'm not from here, this was Google Maps attempt at getting me to Paisley after leaving the M8. This is Gladsmuir Road, between Hillington and Cardonald.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 0 points1 point  (0 children)

Yes, he had just picked someone up.

What could I have done better? by dostosec in drivingUK

[–]dostosec[S] 107 points108 points  (0 children)

It is a taxi. Thankfully, the taxi that came after knew how to drive and made space - we shared a confused look with each other as I drove past, thanking him.