Hacker Newsnew | past | comments | ask | show | jobs | submit | badgar's commentslogin

My undergrad thesis advisor, Bill McKeeman, wrote his parsers in this fashion. I implemented a parser using this model and extended its existing lexer.

The token stream is an array of 32 bit integers, each of which is the token type bitmasked onto an index into the input file of the start of the token. If you need the token text, you reparse. Caches can be implemented as small hash maps from token index to cached value.

The canonical AST is the CFG parse tree with fixups to convert recursion to children of a node type for a variable number of children. It is stored as an array of integers. The node is a sequence of integers, with one integer for the root followed by each child in sequence. Each internal node's value is the index of the CFG rule evaluated to produce the node, and the children of the node correspond to the CFG rule's right hand side (minus keywords). Terminals are stored as integer indexes into the token stream. Nonterminals are the integer index of the child internal node.

Bill has been a big name in compilers for the better part of 5 decades now, and he said he's been using this pattern for almost as long. It's ridiculously fast, which is why he used it decades ago for DEC.


Nobody in this thread knows what they're talking about. You might as well have said "As entertainment, food is no worse or distracting than television."

Look, not everybody gets addicted to pot, in fact most folks don't. But it's psychologically addictive like everything chemically active you put in your body, and being constantly stoned because you're addicted is a miserable way to live.

I know, because I've been trying to quit all year. I've failed twice since February and I'm on my third go of it right now. And I only smoked a half-ounce a week for a year or so. That's probably a lot to the people reading this, but it's really not much as far as potheads go.

I'm sick of thinking so much slower than I know I can, being so much dumber than I used to be. I can't do my job nearly as well and I take pride in my work, so being too dumb to do my job has been really upsetting. I almost wish I were still addicted to cocaine, because at least then I kicked ass and took names when it came to thinking/analyzing/working in general.

I'm tired of being too lazy to leave my apartment all weekend, of the food I eat when I'm stoned, of not being present around my friends, family and co-workers, of needing to smoke when I wake up because it's so uncomfortable to be lucid. My motivation to pursue new ideas, to eat healthy and go to the gym, to meet new friends and pursue new women is all through the floor. My body desperately wants pot right now and I'm anxious and depressed as hell and my body is tugging at me to reach for any alternative, like alcohol or cigarettes.

Every drug taken to extreme can seriously hurt your life. Even weed. Stop trivializing it because you smoked a few joints in college.

Edit: and now I'm slowbanned, for sticking up for myself when someone kicked me while I was down. Time to roll a new account, I guess.


I don't know why you're so angry at r0s; the potential felony really is the thing most likely to fuck up your life with respect to weed.

A half-ounce a week is a pretty hefty habit. I can barely imagine the constant cognitive impairment, paranoia, and anxiety that are likely to come with that on a daily schedule. You aren't using the drug, you're abusing it.

> My body desperately wants pot right now

No, it doesn't. Your mind does. Your situation is not even remotely comparable to an opiate addict going cold turkey.

> Every drug taken to extreme can seriously hurt your life.

The drug isn't seriously hurting your life. You are. The psychological addiction you are experiencing is yours to walk away from - or get medication for, since there are probably serious compulsive or depressive problems in the mix if the hold is that strong. I wish you the best in conquering it and feeling 1000% better - and you surely will - but I really don't see what you're trying to say here, or what everybody else in the thread supposedly has got wrong. Weed is a remarkably benign drug by any measure, and the author of this piece is far too naive of his subject matter for anyone to be thinking too hard on anything he has to say.


What is the difference between a pharmacologically mediated 'psychological' addiction and a pharmacologically mediated 'physical' addiction? It is all physical. Of course marijuana is not identical to heroin, e.g. in withdrawal symptoms. But withdrawal is not the only way that habits are sustained and this does fail to demonstrate that every addiction to a drug other than heroin is simply 'yours to walk away from' or (as other posts have suggested) equivalent to any repeated benign behavior. Even if a drug like alcohol or cannabis is generally benign and can be used in a disciplined way, that doesn't mean every problem involving a substance other than heroin is trivial.


> What is the difference between a pharmacologically mediated 'psychological' addiction and a pharmacologically mediated 'physical' addiction? It is all physical.

That's basically nonsense. A heavy weed smoker can stop smoking immediately, and while he will certainly be in anguish, bored and anxious and miserable without it, there remains no true physical component to his 'withdrawal', if that term could even be credibly used in the context of marijuana.

The heavy opiate user has developed a full-blown physical dependence on the drug, and their body will go into excruciating revolt upon it's sudden absence. Most ex-addicts spend years tapering off on suboxone, methadone, etc for a reason.

The point is, hard drug dependence vs soft drug 'addiction' is utterly apples and oranges, comparing them is meaningless. I am not sure why people insist on blurring the lines between these two very different conditions. Like it or not, Bagdar has far more in common with the guy upthread who was talking about cold sweats from ceasing his overeating, than he does a Subutex fiend in Georgia.


> The heavy opiate user has developed a full-blown physical dependence on the drug, and their body will go into excruciating revolt upon it's sudden absence.

Yes. Sudden withdrawal from some substances (alcohol, barbiturates) can cause death because physical addiction is so destructive.


Physical dependence is not caused by cannabis. This is a well known and scientifically studied (well studied, I might add) fact.


From my personal experience, it takes about 21 days to get rid of the psychological issues regarding to cannabis addiction. Just hang in there, and you will make it.

I understand that cannabis can cause a _real_ addiction, although many people deny this. I've been there. It's not fun, when all you can think of is getting high.

Yoga, swimming and sauna were the savers for me. Without kundalini yoga I would not have realized that I have the power to empower myself, to make myself feel good, without the pot. I would totally recommend to anyone doing some kind of spiritual exercise, where you get your Chi flowing.

Because this is what cannabis does, at least according to my experiences, it makes your life energy or chi flow down to your physical body, it drains it so to speak on the long run. And you start to crave food to replace it, and this drainage also leads to the bad moods and thought patterns of "I need this in order to do this", when truthfully you can do it without the pot also.

Hang in there, you can do it. I've done it a couple of times, from my experience it takes around 3 weeks to get rid of the habit, after this if you continue and just persist on choosing the alternative way, you can make it back to normal life.

Although probably you are going to be bored a lot, so it's important to find some new activities to fill in those blanks.

Anyway, here is also a good text on what cannabis does to us, how it drains our chi: http://pastebin.com/1zKRXDZR.


You might as well have said "As entertainment, food is no worse or distracting than television."

Uh yeah, food is a very common form of entertainment; restaurants, cook-offs, eating contests... it's only when people go overboard that they begin to have a problem.

I'm tired of being too lazy to leave my apartment all weekend, of the food I eat when I'm stoned, of not being present around my friends, family and co-workers

These are all personal choices you made. If you really wanted to spend time with your friends and family you'd just do it. It sounds like you just can't be bothered but smoking pot gives you a convenient excuse to blow off social obligations. I mean jeeze, you're just so addicted to pot, how could you ever find the time to hang out with your friends?

I know, because I've been trying to quit all year. I've failed twice since February and I'm on my third go of it right now. And I only smoked a half-ounce a week for a year or so

Give me a break. Failing to quit pot is in the same category as failing to quit World of Warcraft, it ultimately comes down to the fact that you really just prefer to smoke.

needing to smoke when I wake up because it's so uncomfortable to be lucid.

I don't think pot is the problem.


Do psychoactive drugs affect behavior, or not? If they do affect behavior, then can we say that everything people under the influence do is simply their own choice? At least we must say that it is their choice under-the-influence, which might have been different.

Some people have an easy time quitting tobacco. Others don't. There are real differences in how the drug works on a person and fits into their life which aren't captured by phrases like 'you just can't be bothered'.


Do psychoactive drugs affect behavior, or not? If they do affect behavior, then can we say that everything people under the influence do is simply their own choice?

Caffeine is also a psychoactive drug, but overworked engineers don't blame coffee for 20 hour work days, instead, their coffee habit is understood as a supplement to their chosen lifestyle. Pot functions the same way for someone who decided to sit on the couch and play xbox all day; the pot didn't intoxicate him into playing video-games instead of going to class, if class was important to him he'd just go, stoned or otherwise.

edit: s/weeks/days


>because it's so uncomfortable to be lucid

That sounds very serious, and I hope you get help, but there's no way that's addiction.


my uncle died of a pot overdose :(

edit: look, I'm entirely sorry about the appeal to ridicule. It's a shitty way to get a point across and I just look like an asshole by doing it.

I get that addiction is no joke, however your problem is not the same problem caused by the drugs in the article, and your failure to quit the pot is entirely of your own pattern of behavior. Find another peer group to associate with.

I guess what I'm frustrated with is the on-going prohibition, which was brought about by the same exact type of alarmist bullshit. So you have problems with your choices in life, that does not mean that everyone else has that issue, or even a significant sample.

Let others have the freedom to make their own decisions, the same sort of freedom that was decided during the first great experiment with Prohibition. We all know what happened there. I think people are starting to realize what's happening now.


...seriously? Because as far as researchers are concerned, the LD50 is something like grams of THC/kg before you can die, and that was the drug being injected.


Nope, it's bullshit, just like badgar's half ounce-a-week descent into ruin. I have to doubt its legitimacy because the post reads like a plant by one invested in treatment facilities and private prisons.

If not, then I truly sympathize, but it is entirely incorrect to link a behavioral addiction with a physical addiction such as the one caused by opiates. They are in no way equivalent.


> Nope, it's bullshit, just like badgar's half ounce-a-week descent into ruin.

Excuse me? First of all, nothing I described was "descent into ruin." I said I'm having a hard time not smoking pot and it's affecting many aspects of my life. You have no idea what you're talking about, how dare you say I'm not struggling? Have you ever considered that people have a hard time quitting drugs? That pot might actually harm someone? No, your mind's made up: it's all a conspiracy by the drug companies!

> I have to doubt its legitimacy because the post reads like a plant by one invested in treatment facilities and private prisons.

Fuck you, you conspiracy-minded, condescending prick. I'm having a hard time over here but you think you're so important that treatment facilities and prisons are planting stories on a tiny technology startup forum.

> If not, then I truly sympathize, but it is entirely incorrect to link a behavioral addiction with a physical addiction such as one caused by opiates. They are in no way equivalent.

You don't sympathize, you're busy paranoid that prisons are astroturfing HN. And I thought paranoia was bad when you smoke on the streets. By the way, this entire subthread is talking about marijuana use and affecting career growth. So this entire point is irrelevant.

I fucking hate this site sometimes.


Me too. Will you guys please stop?


I honor your struggle and hope you are victorious over your addiction.


Yep, Galaxy Nexus here and it is completely unresponsive to any interaction whatsoever.


> Problem?

The problem is you aren't sticking with the narrative folks here are comfortable with. This particular Internet forum assumes Google has zero support, even though this is pointed out as false in literally every Google thread. This despite HN users genuinely believing they are smarter and have higher-minded debate than other forums.


What's up with Peter Norvig's comment at the bottom? Did he not RTFA? He suggests a solution that the article criticizes heavily halfway through.


Weird that he didn't address it, but optimizing for IDEs is not python's style. Although I'm sure the pains they went through with the 2to3 tool might make some of them second guess it.


Why is it OK to be rude through abbreviations?

You'd get heavily downvoted for asking "Did Peter Norvig not read the fucking article?", yet that's exactly what you've put into everyone's mind with your comment.


Initialisms like "RTFA" lose their literal intensity through overuse.


Well, to me RTFA is such a common expression that I don't even associate it with the original words anymore; it has become a word on its own.


The last I've heard of this was 2 years ago, an article in the New Yorker: http://www.newyorker.com/reporting/2011/01/24/110124fa_fact_...

At that point, it was ~40% of revenue and ~80% of profits from subscribers. Apparently they've gone nowhere, fast.


> You can't be sure if a card will appear for flights

In my experience, Google Now finds my flights in my Gmail 100% of the time. For at least a dozen flights across the US. And for some airports (SFO is one, unsurprisingly) it even has the terminal and gate information ready! Google Now makes the "arriving at the airport" experience better every time for me.


I had some friends arriving at SFO from Dubai a few weeks later, but had no way of telling if Now would show the right flight on the right day since there is no card about future flights. Similar story for the cross country flight they took a few days later.

In order for me to depend on Now, I need to know I can trust it and it only got one of the flights right. There is no way to know if it will do the right thing in the future unless you keep checking and having a backup plan.


That's because it's Google Now, not Google Planner. It's for giving you information relevant to right now. You don't plan to use Google Now for something, you check it when you want information relevant to you at the moment. If you stop trying to make Google Now into a personal organizer, you'll enjoy using it more.


> It's for giving you information relevant to right now

More accurately it is giving you a random subset of information that might be relevant right now. The behaviour is not deterministic so you can't rely on it.


Random is incorrect.


I was operating under the (apparently mistaken) impression that the only automated processing of email contents done by teh Google was for targeted advertising purposes.

It's sort of scary to think that they're now going to parse out and generate non-email records of potentially confidential information such as your physical location at a point in time (like a flight number + date).

I steal private data for a living and that's just fucking creepy.


You buy expensive makes then, I really hope you know that you're way above what most people spend on cars. Most cars don't have those chips yet. The only sort of mainstream car I've seen with a chip in the key is the prius, which starts in the low 20s new.


My 1998 Honda Accord had a chip... I don't usually cite Wikipedia links, but... http://en.wikipedia.org/wiki/Transponder_car_key


Come to think of it, I've only had a Mazda the last 10 or so years. Maybe it's just Mazda then. Their bottom-line Mazda3 (currently 16.7k MSRP) came with it when I bought one 6 years ago too.


Curious. I don't think you could buy a mainstream car in the UK without a chip.


He had root, so he could have instead installed a rootkit, which can hide the existence of processes from all of userland. In a graduate OS class I took, we had an assignment to do hide a process live on OpenSolaris 8 using the kernel debugger (kdb). I wrote some assembly and overwrote some bytes in the syscall functions for process listing. We were on developer builds so you could just use the function symbols by name in kdb. I forgot to cover /proc/ though.


> uptime percentages are a useless measure

Uptime is only useless if you don't care about high availability. Many startups don't, but Google sure does.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: