b-frechette / C-S20

University of Idaho CS 445 compiler for the C- (Version S20) language.
2 stars 0 forks source link

Fix char Problem #11

Closed b-frechette closed 4 years ago

b-frechette commented 4 years ago

Need to find a way to strip the char - whether a char or char literal so that I can store it in a char variable to be printed by the Bison file.

b-frechette commented 4 years ago

Currently have a semi-decent, mostly convoluted solution. I am currently able to parse out single character inputs like 'a' into a in a char variable. As well as taking any unescaped character (that is not \t, \n, \0) and stripping it into a char as well.

For \t, \n, and \0 I have a patched (or possibly valid) solution that checks for t, n, or 0 and then hard codes \t, \n, or \0 into the char variable. I need to make sure this is (a) valid solution and (b) there are no other escaped characters I should be concerned about.

b-frechette commented 4 years ago

The patch seems to be a valid solution with the exception of the \t variable. I was overthinking this issue. The \t (as seen in the output file from my first submission) that instead of reading this as a tab it is instead just the letter t. Otherwise this was validated by Heckendorn as a reasonable solution.