2024-03-29T22:23:50Zhttps://ipsj.ixsq.nii.ac.jp/ej/?action=repository_oaipmhoai:ipsj.ixsq.nii.ac.jp:002029712020-10-27T05:02:43Z00934:00935:09993:09994
Packrat parserライブラリWoodrat用アルゴリズミックデバッガの実装Implementation of an Algorithmic Debugger for Packrat parser Library Woodratjpn[発表概要,Unrefereed Presentation Abstract] http://id.nii.ac.jp/1001/00202877/Articlehttps://ipsj.ixsq.nii.ac.jp/ej/?action=repository_action_common_download&item_id=202971&item_no=1&attribute_id=1&file_no=1Copyright (c) 2020 by the Information Processing Society of Japan筑波大学大学院システム情報工学研究科コンピュータサイエンス専攻筑波大学システム情報系情報工学域坂上, 知紀前田, 敦司Packrat parsingとは,バックトラックのある再帰下降構文解析手法の一種であり,途中結果をメモ化することで,入力サイズに対して線形時間で解析を行うことができる.本研究室では,packrat parsingを用いたRuby用ライブラリWoodratを開発してきた.これを用いて構文解析を行う際にParsing Expression Grammar(PEG)と呼ばれる形式文法を用いるが,PEGの意味には直感的でない部分があり,正しい文法を書くことは簡単ではない.PEGを用いて文法を誤って定義した際に,誤りの発見を容易にするために,アルゴリズミックデバッギングを用いて,Woodrat用のデバッガを実装する.このデバッガは,プログラムの再帰的な実行をトレースしたものを木構造で表現し,その木構造に対してデバッグを行うことを可能とする.そして,ユーザからの入力を元にバグの含む範囲を狭めて,木構造のエラー箇所を半自動的に特定する.本発表では,アルゴリズミックデバッギングで用いられているsingle-steppingアルゴリズムやdivide-and-queryアルゴリズムなどいくつかのアルゴリズムを比較し,PEGに即したアルゴリズムのデバッガを提案する.Woodrat is a library for Ruby developed in our laboratory to describe a parser and uses a parsing technique called packrat parsing. This technique uses a recursive-descent parsing with backtracking. By allowing arbitrary backtracking, both lexical analysis and syntax analysis can be performed together. In packrat parsing, a formal grammar called parsing expression grammar (PEG) is used to define grammar rules. When backtracking occurs at the time of parsing, the parse time may be an exponential time. Packrat parsers prevent this exponential growth by memoizing intermediate results, suppressing running time in linear order. However, packrat parsing has a disadvantage that it is difficult to find PEG grammar mistakes. In this presentation, in order to deal with this problem, We implement a debugger for Woodrat with a debugging method called algorithmic debugging. In algorithmic debugging, a trace of recursive calls in a program is represented by a tree structure, and debugging is performed on that tree structure. Based on the input from the user, it is possible to narrow the range of code which includes the bug and specify the erroneous part of the tree structure. In addition, we compared some algorithms such as single-stepping algorithm and divide-and-query algorithm used in algorithm debugging, and implemented the debugger with an algorithm based on PEG.AA11464814情報処理学会論文誌プログラミング(PRO)13123232020-01-291882-78022020-01-23