dragon-book-exercise-answers
dragon-book-exercise-answers copied to clipboard
Compilers Principles, Techniques, & Tools (purple dragon book) second edition exercise answers. 编译原理(紫龙书)第2版习题答案。
found this answer wrong
found something wrong in solution
 may be `if (lookahead == t)`
origin answer: \/\*([^*"]*|".*"|\*+[^/])*\*\/ 1.add \ in [^*"], i.e, [^*"] -> [^\*"] 2.remove * after [^*"], i.e, [^*"]* -> [^*"] 3.add (\*)* before the last occurrence of */ so, my answer...
考虑一个例子: `/* a\" */` 它是一个合法的评论却不符合答案所给的形式: `\/\*([^*"]*|".*"|\*+[^/])*\*\/`
One could easily see that it accepts the strings like _1010_ which has 1 and 0 repeated. The given solution seems to be accepting the language of strings of {0,1,2}...
Fix lost label in 2.8.1 exercise code
In state 0, the transfer state of the ε maybe 1 and 3