Санкт-Петербургский государственный университет, 198504, Россия, Санкт-Петербург, Университетский пр., д. 28 Аннотация. Реляционное программирование является подходом, позволяющим исполнять программы в различных "направлениях" для получения различных сценариев поведения по одной реляционной спецификации. В данной статье рассмотрена задача автоматического преобразования функциональных программ в реляционные. Представлен метод преобразования типизированных функций в реляционную форму, а также доказательство его статической и динамической корректности. Также в статье обсуждаются ограничения предложенного метода, представлена реализация метода для подмножества языка OCaml и проведена оценка эффективности метода на ряде реалистичных примеров. RAN/Proc. ISP RAS, vol. 30, issue 2, 2018, pp. 45-64 46 Непосредственная разработка реляционных программ является сложной задачей, требующей от разработчика определенных навыков. Однако во многих случаях требуемая реляционная программа может быть получена из некоторой функциональной программы автоматически. Таким образом, появляется задача автоматического преобразования функциональных программ в реляционные. Отметим, что единственный существующий подобный метод Unnesting [6] не полон и не был реализован. Основным вкладом данной статьи является метод реляционного преобразования, который может быть применён к типизированным программам общего вида. Для описания этих программ используется компактный ML-подобный язык (является подмножеством OCaml), оснащенный системой типов Хиндли-Милнера с let-полиморфизмом [7]. Оставшаяся часть статьи организована следующим образом. В разд. 2 приведен краткий обзор схожих работ. Разд. 3 посвящена реляционному программированию и языку miniKanren. Разд. 4 содержит описание синтаксиса, правил вывода типов и операционной семантики как для ML-подобного языка, так и для его реляционного расширения. В разд. 5 представлены формальные правила для реляционного преобразования, а также доказательства сохранения типизации и семантики. В разд. 6 представлены реализация описанного метода и несколько примеров результата преобразования. Схожие работыВзаимодействие декларативных языков программирования (а реляционное программирование является декларативным) с языками более прагматичными (например, Java или OCaml) является естественной задачей. Успешное решение это задачи позволяет совместить выразительность декларативного языка с оптимизированностью и обширной функциональностью императивного или функционального языка. В качестве примера можно упомянуть работы [8; 9], где для описания ограничений на метамодель REAL [10] используется декларативный язык OCL (Object Constraint Language), который позволил кратко и понятно описать необходимые ограничения, однако оказался непригоден для работы с реальными данными. Поэтому ограничения на языке OCL были преобразованы в скрипты, написанные на императивном языке JavaScript. В контексте данной работы наиболее показательным декларативным языком является Prolog. Во-первых, между ним и языком miniKanren много общего; во-...
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.
hi@scite.ai
10624 S. Eastern Ave., Ste. A-614
Henderson, NV 89052, USA
Copyright © 2024 scite LLC. All rights reserved.
Made with 💙 for researchers
Part of the Research Solutions Family.