Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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?
Looks like not all inputs are displayed in log for C#.
For example in "conflicts" tests i can see only:
But with
Console.WriteLine(input)
i can see: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 seeSo 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
This comment is hidden because it contains spoiler information about the solution
Identifier names like
_abc123
Different variable assignments tests
should be added as part of fixed and sample tests across all languages
No random tests in JS (at least)
So should I throw a RunTimeException? If I thow, how can I make interpreter be able to continue accepting input.
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.
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.
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")
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..I try to solve the problem using C++ and keep getting results like that (in Random_tests):
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 of9.7 % 2.3
? Is it like10 % 2
or9 % 2
. And what is value of7.5 % -3
?ENBF grammar is missing description of how tokens are separated by whitespace.
Randomized tests should be added (python).
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:
...would (after removing the "assignment" nonterminal entirely) fix this. If you want to allow chained assignments later, then this works:
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:
...would fix that and make the operator precedence crystal clear to a reader who's seen any form of BNF.
In Python and JS (at least), the initial code contains a
self.functions
empty dictionary. The description says nothing about functions butThis 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...