首页    期刊浏览 2024年11月26日 星期二
登录注册

文章基本信息

  • 标题:Definite Clause Grammars with Parse Trees: Extension for Prolog
  • 本地全文:下载
  • 作者:Falco Nogatz ; Dietmar Seipel ; Salvador Abreu
  • 期刊名称:OASIcs : OpenAccess Series in Informatics
  • 电子版ISSN:2190-6807
  • 出版年度:2019
  • 卷号:74
  • 页码:1-14
  • DOI:10.4230/OASIcs.SLATE.2019.7
  • 出版社:Schloss Dagstuhl -- Leibniz-Zentrum fuer Informatik
  • 摘要:Definite Clause Grammars (DCGs) are a convenient way to specify possibly non-context-free grammars for natural and formal languages. They can be used to progressively build a parse tree as grammar rules are applied by providing an extra argument in the DCG rule's head. In the simplest way, this is a structure that contains the name of the used nonterminal. This extension of a DCG has been proposed for natural language processing in the past and can be done automatically in Prolog using term expansion. We extend this approach by a meta-nonterminal to specify optional and sequences of nonterminals, as these structures are common in grammars for formal, domain-specific languages. We specify a term expansion that represents these sequences as lists while preserving the grammar's ability to be used both for parsing and serialising, i.e. to create a parse tree by a given source code and vice-versa. We show that this mechanism can be used to lift grammars specified in extended Backus-Naur form (EBNF) to generate parse trees. As a case study, we present a parser for the Prolog programming language itself based only on the grammars given in the ISO Prolog standard which produces corresponding parse trees.
  • 关键词:Definite Clause Grammar; Prolog; Term Expansion; Parse Tree; EBNF
国家哲学社会科学文献中心版权所有