@article{oai:ipsj.ixsq.nii.ac.jp:02001704, author = {中神,悠太 and 中井,央 and 三宮,秀次 and Yuta Nakagami and Hisashi Nakai and Shuji Sannomiya}, issue = {1}, journal = {情報処理学会論文誌プログラミング(PRO)}, month = {Mar}, note = {プログラミング言語の文法として文脈自由文法(CFG:Context-Free Grammar)がよく用いられる.プログラミング言語の文法は通常,何らかの構造的性質を有する.開発現場では,この性質を利用して,文法を記述する際に既存文法から一部を利用することがよくある.このとき,規則の一部を開発中の文法に取り入れるためには不整合を解消するための変更が必要となることがある.また,言語の進化にともなう構文の変化に応じて,文法規則の増減や調整も必要となる.開発者は文法中に潜在する構文要素間の関係を意識しながら文法の開発や修正を行う必要があり,これが文法の開発を難しくしている.さらに,意味解析処理を考慮してそのための構造を持たせることもあり,文法の設計がより複雑化することが多い.CFGではここであげたような複雑さを十分にとらえられない.我々は,CFGの構成要素である非終端記号に対して型クラスを基本とする型システムを導入したTypedCFGを提案する.TypedCFGでは,要素間の関係を表現する記述法を導入することで,要素間の依存関係や制約を非終端記号に対して明示的に与えられる.従来のCFGでの文法開発では規則間に潜在する関係を自ら補完していたが,それを明示することで効率的に文法を開発・修正できる.本研究では,提案する記法の考案やこれによるパーサジェネレータの実装を行った.さらに,型情報を用いて意味解析における各種制約を表現する手法について検討し,いくつかの例について実装を行った., Context-Free Grammar (CFG) is commonly used as the syntax for programming languages. Typically, programming language grammars exhibit some structural properties. In development, it is common to utilize parts of existing grammars when describing new ones, leveraging these properties. However, in- corporating rules from existing grammars into a developing grammar often requires adjustments to resolve inconsistencies. Furthermore, as languages evolve, syntax changes necessitate adjustments in grammar rules. Developers must be mindful of relationships among potential syntactic elements within the grammar, which complicates grammar development. Moreover, designing grammars can become even more complex when considering semantic analysis requirements, potentially requiring specific structural attributes. CFG fails to adequately capture complexities such as those mentioned above. We propose Typed CFG, which introduces a type system based on type classes for non-terminal symbols, components of CFG. Typed CFG employs a notation to explicitly specify dependencies and constraints among elements, addressing these issues. While traditional CFG development often involves developers sup- plementing implicit relationships between rules, Typed CFG facilitates efficient grammar development and modification by making these relationships explicit. In this study, we devised the proposed notation and implemented a parser generator based on it. Addition- ally, we explored techniques using type information to represent various constraints in semantic analysis, implementing several examples accordingly.}, pages = {15--15}, title = {型クラスの導入による文脈自由文法の構文要素間の関係の記述}, volume = {18}, year = {2025} }