We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
@drakemp I assume it's the only way to go -> To write the lexer, parser and evaluator. The grammar is easy though, therefore it's not that hard.
I also had the hard time with the operation count thingy. The point is, you need to do exactly what is stated in the description, namely ->
[ If the byte pointed by data pointer is zero, then move instruction pointer to next matching ']', otherwise move instruction pointer to next command.
] If the byte pointed by data pointer is non-zero, then move instruction pointer to previous matching '[' command, otherwise to next command.
so it's important that you count those correctly. Meaning, +1 for [ then + 1 for every op, then +1 for ] and now you either execute loop again (meaning that [ has to be executed again), or go to next instruction.
When I finally did exactly what they stated and counted the ops, I got all green
BrainF__k interpreter
You are viewing a single comment's thread. Return to all comments →
@drakemp I assume it's the only way to go -> To write the lexer, parser and evaluator. The grammar is easy though, therefore it's not that hard.
I also had the hard time with the operation count thingy. The point is, you need to do exactly what is stated in the description, namely ->
so it's important that you count those correctly. Meaning, +1 for [ then + 1 for every op, then +1 for ] and now you either execute loop again (meaning that [ has to be executed again), or go to next instruction.
When I finally did exactly what they stated and counted the ops, I got all green
My code in clojure -> link