Bug in my output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Bug in my output?

I'm not at my computer to post the code right now, but I will later. I'm writing a compiler for a java-like language. Working on the VM that goes with it too. So when I process the bye code into assembly it won't run on the cpu emulator, says error in line 0. I was trying to figure out what was causing the issue so I copy pasted each translated section into a new file and ran it. I made it all the way through the original file just copy paste into a new one and the new one ran without issues. My next step I guess is to toy around a bit and maybe comment out all the lines that print to the file and run one at a time till I find which section is causing the error, but the files, at least the asm code in each was the same. I'm lost at what could be the bug. Anyone ever have something similar happen that might help me get some light here? Again I'll post the code later and a brief summary of the languages

3rd Apr 2023, 9:30 PM
Bob
3 Answers
+ 2
If you "fixed" the code by copying it elsewhere, it's likely there's some invalid char somewhere, maybe an invisible one, or one that looks a lot like a valid one, such as fancy quotes or horizontal bars
4th Apr 2023, 1:54 AM
Emerson Prado
Emerson Prado - avatar
0
I'm thinking that was the case. I did a line by line and found I was using == instead of != at one point. You would think it would just made me enter an infinite loop but once I changed that everything worked
4th Apr 2023, 12:26 PM
Bob
0
Here it is. Looking forward to any feedback. Seems to be bug free now https://code.sololearn.com/cBXOo4f4GDO0/?ref=app
4th Apr 2023, 4:40 PM
Bob