B
Bart Vandewoestyne
I am working my way through the book 'Modern Compiler Implementation in C' and am now working on the lexer from Chapter 2:
https://github.com/BartVandewoestyn...Compiler_Implementation_in_C/chap02/tiger.lex
Part of the exercise is that strings with escape sequences and control characters in caret notation must be supported. Between lines 153 and 163, i make sure my strings support escape sequences like \ddd with ASCII code ddd (3 decimal digits). Between lines 187 and 194 I try to do the same for control characters in caret notation. I haven't succeeded to put the value ofthe control character in the result variable yet. I wonder if it is doable with a single sscanf line like for the \ddd case...
What would be the most elegant and standard-conforming way to grab the value of the matched control character?
Regards,
Bart
https://github.com/BartVandewoestyn...Compiler_Implementation_in_C/chap02/tiger.lex
Part of the exercise is that strings with escape sequences and control characters in caret notation must be supported. Between lines 153 and 163, i make sure my strings support escape sequences like \ddd with ASCII code ddd (3 decimal digits). Between lines 187 and 194 I try to do the same for control characters in caret notation. I haven't succeeded to put the value ofthe control character in the result variable yet. I wonder if it is doable with a single sscanf line like for the \ddd case...
What would be the most elegant and standard-conforming way to grab the value of the matched control character?
Regards,
Bart