کد مقاله کد نشریه سال انتشار مقاله انگلیسی نسخه تمام متن
433723 1441665 2014 14 صفحه PDF دانلود رایگان
عنوان انگلیسی مقاله ISI
Left recursion in Parsing Expression Grammars
ترجمه فارسی عنوان
بازگشت چپ در اصطلاح گرامر پارسینگ
کلمات کلیدی
گرامر اصطلاح تجزیه، تجزیه، بازگشت چپ، ماشین تجزیه، تجزیه پکرات
موضوعات مرتبط
مهندسی و علوم پایه مهندسی کامپیوتر نظریه محاسباتی و ریاضیات
چکیده انگلیسی


• We present a semantics for left-recursive Parsing Expression Grammars.
• A small extension adds precedence/associativity declarations to operator grammars.
• We give a semantics for compilation of left-recursive PEGs to a parsing machine.
• Our semantics are conservative: non-left-recursive PEGs are unaffected.

Parsing Expression Grammars (PEGs) are a formalism that can describe all deterministic context-free languages through a set of rules that specify a top-down parser for some language. PEGs are easy to use, and there are efficient implementations of PEG libraries in several programming languages.A frequently missed feature of PEGs is left recursion, which is commonly used in Context-Free Grammars (CFGs) to encode left-associative operations. We present a simple conservative extension to the semantics of PEGs that gives useful meaning to direct and indirect left-recursive rules, and show that our extensions make it easy to express left-recursive idioms from CFGs in PEGs, with similar results. We prove the conservativeness of these extensions, and also prove that they work with any left-recursive PEG.PEGs can also be compiled to programs in a low-level parsing machine. We present an extension to the semantics of the operations of this parsing machine that let it interpret left-recursive PEGs, and prove that this extension is correct with regard to our semantics for left-recursive PEGs.

ناشر
Database: Elsevier - ScienceDirect (ساینس دایرکت)
Journal: Science of Computer Programming - Volume 96, Part 2, 15 December 2014, Pages 177–190
نویسندگان
, , ,