• What a parser did is to tansfer a "plain text" representation of something to a "structured" representation. In this case, the plain text is a String representing regular expression, and the the structured thing is the data structure that has been defined for you.

  • Random test failures make me find sorts of bugs in parsers I had wrote earlier. Nice kata!

  • Or you could make the argument that this way the type is simpler, so easier to comprehend for the target demographic ( which might yet have to learn about native polymorphic always ).

  • build the CST (concrete syntax tree)

  • No issue here: you chose to override the classes in preloaded. They are there for a reason. Don't be surprised you get in undebuggable situations if you actually twist the context in which you're solving the kata.

    For instance, your Or.__str__ is different from the one supposedly used.

    Keep in mind that the string you see in the assertion messages are stringified versions of your CST. For instance, it seems you're returning Str(Or(...)) for that input while you're supposed to return only Or(...). So your "correct" solution is actually incorrect.

    You get the discrepancy between the fixed and random tests because the supposed to be Or class is supposed to stringify itself adding parentheses around itself too. As long as your (inappropriate) definition of Or changes this behavior and that the ref solution uses your (inappropriate) classes to build the CST, the parentheses aren't there anymore in the expected result of the random tests, yes. But that's totally on you. ;)



  • And I work with C++

  • Sorry, I have no idea about what i should do with this kata . optimize/check the regular expression?

  • Python version is so broken I passed by pressing attempt a couple of times until I saw green and just clicked "submit". One of those cases where you push to prod and quit I guess.

    The comments below mention all the proglems I was going to mention so can this kata be removed? Clearly in so many years nobody thought it needs fixing.

  • This comment is hidden because it contains spoiler information about the solution

  • ruby returns last evaulated expression.
    you will use return if you want to get out early
    from a method.

  • Description:

    a parser that outputs the following AST

    and then two blocks of examples returning ASTs.

    Return an AST.

  • Please specify a language. Help us help you. Closing.

  • errrr.... Here, my python-based-JS-knowledge is forbidding me to get the thing, I believe...

  • Loading more items...