解析
扩展(谓词逻辑)
计算机科学
符号(正式)
基于规则的机器翻译
背景(考古学)
解析表达式语法
S-属性语法
人工智能
上下文无关语法
语音识别
L-属性语法
自然语言处理
程序设计语言
生物
古生物学
标识
DOI:10.1145/3136014.3136025
摘要
Parsing expression grammars (PEGs) are a powerful and popular foundation for describing syntax. Despite PEGs' expressiveness, they cannot recognize many syntax patterns of popular programming languages. Typical examples include typedef-defined names in C/C++ and here documents appearing in many scripting languages. We use a single unified state representation, called a symbol table, to capture various context-sensitive patterns. Over the symbol table, we design a small set of restricted semantic predicates and actions. The extended PEGs are called SPEGs, and are designed to be safe in contexts of backtracking and the linear time guarantee of packrat parsing. This paper will show that SPEGs have improved the expressive power in such ways that they recognize practical context-sensitive grammars, including back referencing, indentation-based code layout, and contextual keywords.
科研通智能强力驱动
Strongly Powered by AbleSci AI