xxleyi / learning_list

聚集自己的学习笔记
10 stars 3 forks source link

编译器之 Context Free Grammars #287

Open xxleyi opened 3 years ago

xxleyi commented 3 years ago

image image image image image image image image image image image image image image

The form of the context-free grammar can be important. Tools are often sensitive to the particular you write the grammar and while there are many ways to write a grammar for the same language, only some of them may be accepted by the tools. And as we'll see there are cases where it's necessary to modify the grammar in order to get the tools to accept it. This happens actually sometimes as well with regular expressions but it's much less common. So normally for most regular expressions you would want to write the tools would be able to digest them. That's fine. That's not also true. That's not true of an arbitrary context-free grammar.