In this article we present a new tool for language-oriented programming which provides to user convenient means to describe the domain specific languages in the form of language based on parsing expression grammars and helpful tools for grammar debugging. Also we consider the sample of using this toolkit as a part of an integrated development environment.
1 Санкт-Петербургский национальный исследовательский университет информационных технологий, механики и оптики (Университет ИТМО), г. Санкт-Петербург, 197101, Россия В данной работе демонстрируется использование макроопределений высшего порядка для реализации поддержки объектно-ориентированной парадигмы программирования в языке C89 без расширений. Выбор парадигмы программирования является важной задачей, предшествующей реализации программы. В рамках объектно-ориентированной парадигмы программирования описывается широкий класс задач. Многие распространенные высокоуровневые языки общего назначения, такие как C++, C#, Java, предоставляют поддержку этого программирования. Однако применение языков, поддерживающих объектно-ориентированное программирование, не всегда технически возможно из-за отсутствия средств разработки под целевую платформу, в частности, компилятора. Так, например, для предметноориентированных процессоров (ASIP) зачастую предоставляется только компилятор языка Си как наиболее распространенного низкоуровневого языка программирования. Кроме того, относительно небольшой размер языка, а также его близость к языку ассемблера позволяют быстро реализовать компилятор для новой архитектуры. Вместе с тем препроцессор языка Си позволяет за счет создания системы макроопределений высшего порядка реализовать сложную логику генерации кода, выходящую за рамки тривиального заполнения шаблона значениями параметров макроопределения.В статье с помощью примеров исходного кода показана реализация инкапсуляции, наследования и полиморфизма. Инкапсуляция делает невозможным обращение к непубличным методам и полям класса извне уже в момент компиляции. Особое внимание авторы уделяют типобезопасности генерируемого кода: введение наследования не означает еще большее ослабление правил типизации языка Си.Результаты исследования предполагают применимость такого подхода для реализации программ, эффективно использующих объектно-ориентированное программирование, при разработке на языке Си в случае невозможности использования современных объектно-ориентированных языков.Ключевые слова: язык Cи, препроцессор, объектно-ориентированное программирование, метапрограммирование, макрос. При написании программы важно определить адекватную задаче парадигму программирования. Это может быть программирование от состояний, объектно-ориентированное, декларативное и т.д. Выбор парадигмы, с помощью которой решение задачи будет описано максимально естественно и лаконично, позволяет быстрее создавать более надежные программы за счет уменьшения сложности процесса написания кода и времени на его отладку. В мире широко распространены языки, как предполагающие следование определенным парадигмам (Smalltalk, ML), так и поддерживающие множество парадигм (C#, Java, OCaml и др.). В то же время лишь для небольшого количества языков существуют компиляторы для большинства различных аппаратных и программных целе-вых платформ, так как разработка эффективных кросс-компиляторов, особенно языков высокого уровня, является достаточно трудоемкой задачей.Весьма интересны...
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.
customersupport@researchsolutions.com
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.