You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was testing my implementation of String.jack inside the folder StringTest which I uploaded to the Web IDE JackCompiler. The folder only consisted of the jack files: String.jack and Main.jack.
I noticed that whenever I printed a string, it would start with two whitespaces before printing any characters in the string., e.g. abc would become abc.
I did some debugging and I think the error is related to the following:
Since my folder did not include the Output.jack file, it retrieves the code from the built-in files. When printing a string (Output.printString()) there is a dependency to the function charAt inside String.jack. I assume the compiler does not reference my provided String.jack but instead the built-inString.jack which has a different implementation of the String object.
As a result, the behavior of how the string is getting printed is not deterministic and results into arbitrary characters being printed.
I then tested my custom String.jack with my custom Output.jack in the same StringTest directory and then my code would behave correctly.
I'm wondering now if it is possible to test the String.jack in isolation without providing your custom Output.jack file.
Additional Comments
No response
Do you want to try to fix this bug?
I want to try to add this feature!
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Tool
Jack Compiler
Interface
Website (https://nand2tetris.github.io/web-ide)
Contact Details
No response
What happened?
I was testing my implementation of
String.jack
inside the folderStringTest
which I uploaded to the Web IDE JackCompiler. The folder only consisted of the jack files:String.jack
andMain.jack
.I noticed that whenever I printed a string, it would start with two whitespaces before printing any characters in the string., e.g.
abc
would becomeabc
.I did some debugging and I think the error is related to the following:
Since my folder did not include the
Output.jack
file, it retrieves the code from the built-in files. When printing a string (Output.printString()
) there is a dependency to the functioncharAt
insideString.jack
. I assume the compiler does not reference my providedString.jack
but instead thebuilt-in
String.jack
which has a different implementation of the String object.As a result, the behavior of how the string is getting printed is not deterministic and results into arbitrary characters being printed.
I then tested my custom
String.jack
with my customOutput.jack
in the same StringTest directory and then my code would behave correctly.I'm wondering now if it is possible to test the String.jack in isolation without providing your custom
Output.jack
file.Additional Comments
No response
Do you want to try to fix this bug?
Code of Conduct
The text was updated successfully, but these errors were encountered: