本文以SLR(1)分析器为例介绍了两种为二义性文法构造语法分析器的方法,并通过实例对两种方法的优劣进行了比较。
In this article, two methods of constructing SLR (1) analyzer for grammar with ambiguity are introduced and the two methods are compared with each other by examples.
如果在同一个文件里混用多种语言,必须保证文法不会出现二义性,也就是说所有的输入都只能存在一种解释。
If you want to combine languages inside of a file, you have to be sure that the resulting grammar isn't ambiguous, i.e. that for each input there is only one way to interpret it.
之后把它转换成ebnf文法,再通过一系列变换转化成无二义性的SI - NS图,根据此图就可以写出相应的各个子程序。
After transforms them the EBNF grammars and unambiguous SINS charts, we may write the corresponding procedure according to every chart.
应用推荐