Ad
  • Default User Avatar

    @cskyleryoung: The "runner up" wasn't always the runner-up. I don't think it's a stretch to say that both solutions helped each other gain points; ooflorent's solution and mine have a lot in common. The difference being, I've demonstrated how to use a tokenizer, which is generally good practice when writing a parser.

    However, this language is really very simple and so many people took exception to my solution for being 'overkill' (just read the other comments). I expect it will soon lose the top spot. Which I am OK with, because I like the other solution as well (it is almost canonical). But when you start writing real world parsers, just know you can expect to write tokenizing/lexing code.

    Please make sure your performance test will be accessible indefinitely, and next time you reference a different solution, please link to it. That way, your comments will stay intelligible in the future, even if the ranking changes.

  • Custom User Avatar

    As you have likely surmised it's because it takes a pass through to essentially remove all non parens first. One could simply ignore anything that isn't a paren.