Question
When I execute my code (and also the code of your repository at the time of this commit) "everything compiled ..." is not printed to the console, but "Unexpected token, ...".
Is it possible that the code of your respository and what you showed in your video is missing something to get the same output in the console?
Answered by Daniel McCarthy
Instructor
Hello, I dont think so. Did you do a full clone or just copy and pasted the changes? I recommend a full clone from that point in time so that you can check because since its working in the videos and the commits are the same you shouldn't be having that problem , it could be possible you forgot to clean your object files as well
Follow-up by Thomas H.
Question author
I did a full clone and then I did a "git reset --hard [hash of the commit]"
Follow-up by Thomas H.
Question author
I called "make clean" and after that I called "make"
Follow-up by Thomas H.
Question author
I debugged the code.
The problem is that in my case peekc() inside the method "read_next_token" (lexer.c) returns 255 when it is at the end of the file and so it does not run into the case EOF, but into the default case of the switch-statement. That means compiler_error(...)
Follow-up by Thomas H.
Question author
I found the problem. I was a problem regarding processor architecture. I'm using a virtual machine on my Mac (apple chip => Arm architecture => ubuntu arm).
I tested it on another machine with amd64 (virtual machine with ubuntu arm64) and there it works.
I would like to work on my Mac (arm). I hope I found a workaround for the ubuntu arm.
Maybe I should specify all char more specific as signed char.
On ubuntu with arm architecture char is an unsigned char (therefore the problem)
Follow-up by Thomas H.
Question author
* Of course I meant "(virtual machine with ubuntu amd64)" within the second parentheses.
Follow-up by Thomas H.
Question author
Now I found the perfect solution for my problem. I changed all gcc calls inside the makefile and added the compiler option "--signed-char"
Answered by Daniel McCarthy
Instructor
Hello,
Glad you solved your problem and feel free to reach out for anything else
Thanks
Dan