Ad
  • Default User Avatar

    Your C# "tokenize" method is a mess. For some unknown reason it adds closing parenthese ")" to the end of the input. Also, the regex is a complete mess too, it does not parse numbers at all and there are other issues with it.

    Why even have such starting code if it is wrong?

  • Default User Avatar

    Looks like not all inputs are displayed in log for C#.

    For example in "conflicts" tests i can see only:

    input("fn x => 0") == <> was ok
    Test Failed
    input("f = 5") == <> and not <5> => wrong solution, aborted!
    

    But with Console.WriteLine(input) i can see:

    x = 0
    fn f => 1
    fn x => 0
    input("fn x => 0") == <> was ok
    f = 5
    Test Failed
    input("f = 5") == <> and not <5> => wrong solution, aborted!
    

    Also in "variables" tests in log i can see input("y") == <> and not <25> => wrong solution, aborted!

    But in previous "function" tests with Console.WriteLine(input) (not in default log) i can see

    x = 23
    y = 25
    z = 0
    ...
    

    So I thought there should be different scopes for different sections of the tests. If not, then the answer in "variables" tests should be y = 25

  • Default User Avatar

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

  • Custom User Avatar
    • Identifier names like _abc123

    • Different variable assignments tests

    assert.strictEqual(interpreter.input("y = 2"), 2);
    assert.strictEqual(interpreter.input("x = 11"), 11)
    
    • Multiple variable assignments tests with the same variable as such
    assert.strictEqual(interpreter.input("y = x + 5"), 12);
    assert.strictEqual(interpreter.input("y = x + 2"), 9)
    
    • Expressions on RHS of assignment operator (with and without identifiers)
    assert.strictEqual(interpreter.input("y = 5 * (23 - 4)"), 12);
    assert.strictEqual(interpreter.input("y = x / (1 + 5)"), 12)
    

    should be added as part of fixed and sample tests across all languages

  • Custom User Avatar

    No random tests in JS (at least)

  • Custom User Avatar

    Referencing a non-existent variable will cause the interpreter to throw an error. The interpreter should be able to continue accepting input even after throwing.

    So should I throw a RunTimeException? If I thow, how can I make interpreter be able to continue accepting input.

  • Default User Avatar

    Overall really fun Kata. Recommended kata really helped me out when solving. Only issue I had was that the way errors were described was really ambiguos. It sounded like they wanted you to handle the error checking and throw a formatted string as an error with a return, when in reality they handle error checking and just want you to let it throw the true error.

  • Default User Avatar

    Please enable newer versions of Node for the JavaScript version of this kata, as it is in Simpler Interactive Interpreter. Coming from there and then having to rewrite larger parts of the existing code, because one used features that are not available in Node 8, is an unnecessary obstacle.

  • Custom User Avatar

    C++ translation has some issues. It doesn't specify details about throwing exceptions. Turns out for the empty string it's expected an error is thrown, which is not in the description. Another issue however is that actual and expected values are not shown to the user, hence the user can only second guess.

    Biggest issue is however that the C++ translation does NOT adhere to the grammar!
    It uses a unary negation as operator, which is not allowed by the grammar ("negative numbers")

  • Custom User Avatar

    Description says:
    Output for input consisting entirely of whitespace will be an empty string (null in case of Java).
    All other cases will throw an error.
    Seems that a string consisting of three spaces in a row is expected to throw, not to return an empty string.
    More: prototype returns a double, cannot see how it would return a string..

  • Default User Avatar

    I try to solve the problem using C++ and keep getting results like that (in Random_tests):

    Expected: equal to -116.36 (+/- 1e-06)
    Actual: -116.183
    

    And I keep thinking this is because of my misunderstading of %-operator. What it supposed to do in case of floating-point numbers? E.g. what is the value of 9.7 % 2.3? Is it like 10 % 2 or 9 % 2. And what is value of 7.5 % -3?

  • Custom User Avatar

    ENBF grammar is missing description of how tokens are separated by whitespace.

  • Default User Avatar

    Randomized tests should be added (python).

  • Custom User Avatar

    The EBNF grammar needs fixing with regard to assingments. It makes "3+x=5+2" a legal statement, with assignment being a "factor", and doesn't help one bit with semantics even when the input statement is sensible. For example, "x = 5 + 3" probably should assign 8 to x, right? But the grammar recognizes the assignment when only "x = 5" is in view as a complete factor.

    A top-level declaration like:

    statement ::= expression | variable '=' expression
    

    ...would (after removing the "assignment" nonterminal entirely) fix this. If you want to allow chained assignments later, then this works:

    statement ::= expression | variable = statement
    

    Also, the "expression ::= expression operator expression" production makes this grammar ambiguous. Make that "expression operator factor" on the right will fix this, but again this doesn't help with associating action with the parse. The usual:

    expression :: = term | expression addop term
    addop ::= '+' | '-'
    term ::= factor | term mulop factor
    mulop ::= '*' | '/' | '%'
    factor = identifier | number
    

    ...would fix that and make the operator precedence crystal clear to a reader who's seen any form of BNF.

  • Custom User Avatar

    In Python and JS (at least), the initial code contains a self.functions empty dictionary. The description says nothing about functions but This is a simplified version of the Simple Interactive Interpreter kata with functions removed. What's the point?
    Edit: After passing the kata I can say it: This is pointless and should be merely removed.

  • Loading more items...