首页> 外国专利> Optimising a compilation parser by identifying a subset of grammar productions

Optimising a compilation parser by identifying a subset of grammar productions

机译:通过识别语法产生的子集来优化编译解析器

摘要

A first parser (107, fig.1) is created for parsing a programming language in accordance with a first grammar (105, fig. 1). The grammar comprises a first set of grammar productions (106, fig. 1) as represented by production rules (108, fig.1) in the parser. The first parser is run against a first sample of the language 206 and a subset of the first set is identified of the productions used in parsing the sample. A second parser 205, 107' is generated for parsing the language in accordance with a second grammar 105' which is of reduced scope relative to the first grammar. The second grammar comprises the identified subset of the first set of productions with, preferably, the unused productions removed. The first or second parser may similarly be run against a second language sample to generate a third parser in accordance with a third grammar of reduced scope relative to the respective first or second grammar. If the scope of the grammar of the second or third parser is inadequate for processing the programming language then parsing may be reverted to the respective first or second parser having grammar of greater scope. The parsers may be instrumented (109, fig.1).
机译:创建第一解析器(107,图1),用于根据第一语法(105,图1)来解析编程语言。语法包括由语法分析器中的生成规则(108,图1)表示的第一组语法生成(106,图1)。针对语言206的第一样本运行第一解析器,并且识别第一集合的子集以解析样本中使用的生产。生成第二解析器205、107',用于根据第二语法105'来解析语言,该第二语法相对于第一语法而言具有缩小的范围。第二语法包括第一组产品的识别出的子集,最好去除未使用的产品。可以类似地针对第二语言样本运行第一解析器或第二解析器,以根据相对于各自的第一语法或第二语法而言范围缩小的第三语法来生成第三解析器。如果第二或第三解析器的语法的范围不足以处理编程语言,则可以将解析恢复为具有更大范围的语法的各个第一或第二解析器。可以对解析器进行检测(图1的109)。

著录项

相似文献

  • 专利
  • 外文文献
  • 中文文献
获取专利

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号