6 research outputs found

    Erlang programok statikus elemzése és szeletelése

    Get PDF
    A funkcionális programozási nyelvek terjedésének velejárója, hogy felmerül az igény olyan eszközökre, amelyek a fejlesztési folyamatot támogatják. Ezek lehetnek futási idejű eszközök, vagy olyanok, melyek csupán a forráskód elemzésével kı́nálnak hasznos információkat a fejlesztők számára. Az Erlang ipari környezetben is gyakran használt funkcionális programozási nyelv. A RefactorErl egy statikus elemző és refaktoráló eszköz Erlanghoz, mely számos transzformációt biztosı́t a forráskód jelentésmegőrző átalakı́tására, másrészről kiterjedt statikus elemzőkészlettel segı́ti a fejlesztőket a mindennapos tevékenységükben. Kutatásomban olyan elemzési módszerekkel foglalkoztam, amelyek segı́tségével az Erlang programok forráskódjában rejlő összetett összefüggések nyerhetők ki. Ezek az eredmények pedig további magasabb szintű elemzések alapját képzik. Az ismertetett eredményeim a vezérlés és az Erlang folyamatok közötti kapcsolatok elemzéséhez kapcsolódnak. A dolgozatomban Erlang programok vezérlésfolyam-gráfját adtam meg, amely tartalmazza a programok végrehajtása során előálló lehetséges végrehajtási utakat. A gráfot a nyelv szintaktikus kategóriáihoz rendelt formális szabályok segı́tségével definiáltam, amelyek a nyelv szemantikájának megfelelően adják meg a vezérlésfolyam-gráf éleit. A vezérlésfolyam-gráf felhasználásra került további elemzésekhez is, mint például a párhuzamosı́tható komponensek azonosı́tása. A vezérlésfolyam-gráf, illetve a benne foglalt információk felhasználhatóak a forráskódban történő változások hatáselemzéséhez. A vezérlésfüggőségi gráf egy kompaktabb reprezentáció, amely a vezérlési utakban lévő szekvenciák eliminálásával már csak a kifejezések közötti közvetlen függőségeket tartalmazza. Megadtam Erlang programokra a vezérlésfüggőségi gráfot, amelyet adatfüggőségi információkkal egészı́tettem ki. Az ı́gy definiált Erlang függőségi gráf felhasználható gráf alapú statikus programszeleteléshez. A definiált infrastruktúrára épı́tve megadtam egy hatáselemzés alapú teszteset szelekciós módszert. A módszer azon tesztesetek halmazát adja meg, amelyek érintettek lehetnek a változtatás/transzformáció kapcsán. Azaz a változtatás hatása elterjedhet a tesztelt funkcionalitásba. Az elemzés nem csak a transzformációk hatásának elemzésére, hanem tetszőleges változás elemzésére is használható. Dolgozatomban bemutattam Erlang programok egy statikus kommunikációs modelljét. Megadtam azokat az algoritmusokat, melyek segı́tségével felderı́thetőek az elindı́tott Erlang folyamatok és a köztük aszinkron üzenetküldésekkel lebonyolı́tott kommunikáció. A modellbe felvettem olyan rejtett kommunikációs elemeket is, mint a közös osztott memóriának tekinthető Erlang Term Storage (ets) táblák használata. Megadtam azokat a statikus elemzési algoritmusokat, melyek felhasználásával kiegészı́thető a kommunikációs gráf speciális Erlang folyamatokkal (például generikus szerverek) és az interfészeiken keresztül történő rejtett kommunikációval. A kommunikációs gráf kiválóan használható a kódban rejlő összefüggések megjelenı́tésére, kódmegértés, konkurenciából fakadó hibakeresés támogatásához. Ugyanakkor felhasználható konkurens programok változásához köthető hatáselemzés pontosı́tásához is

    Type theory as a framework for modelling and programming

    Get PDF
    In the context provided by the proceedings of the UVMP track of ISoLA 2016, we propose Type Theory as a suitable framework for both modelling and programming. We show that it fits most of the requirements put forward on such frameworks by Broy et al. and discuss some of the objections that can be raised against it

    Modular and type-safe definition of Attribute Grammars with AspectAG

    Get PDF
    AspectAG is a Haskell-embedded domain-specific language (EDSL) that encodes first-class attribute grammars (AGs). AspectAG ensures the wellformedness of AGs at compile time by using extensible records and predicates encoded using old-fashioned type-level programming features, such as multiparameter type classes and functional dependencies. AspectAG suffers the usual drawbacks of EDSLs: when type errors occur they usually do not deliver error messages that refer to domain terms, but to the host language. Often, implementation details of the EDSL are leaked in those messages. The use of type-level programming techniques makes the situation worse since type-level abstraction mechanisms are quite poor. Additionally, old-fashioned type-level programs are untyped at type-level, which is inconsistent with the general approach of strongly-typed functional programming. By using modern Haskell extensions and techniques we propose a reworked version of AspectAG that tackles those weaknesses. New AG definitions are safer, both at the level of types and at the level of kinds. Furthemore, a set of identified domain-specific errors are reported with DSL-oriented messages. To achieve this, we define and use a framework for manipulating type errors that can be used in any EDSL. We show the pragmatics of AspectAG by defining languages and extending them both with new syntax and semantics. We use MateFun, a purelyfunctional language used to teach mathematics as a case study.AspectAG es un lenguaje de dominio específico embebido (EDSL) que codifica gramáticas de atributos (AGs) como ciudadanos de primera clase. AspectAG garantiza la buena formación de las AGs en tiempo de compilación por medio del uso de registros extensibles y predicados, codificados gracias al uso de características antiguas de programación a nivel de tipos, como clases multiparámetro y dependencias funcionales. AspectAG sufre las desventajas usuales de los EDSLs: cuando ocurren errores de tipado, los mensajes de error reportados no se expresan en términos del dominio, sino del lenguaje anfitrión. También es usual que detalles de implementación del EDSL se vean filtrados en estos mensajes. El uso de técnicas de programación a nivel de tipos agrava la situación porque los mecanismos de abstracción a nivel de tipos son pobres. Ademas, las técnicas de programación a nivel de tipos usadas en AspectAG son esencialmente no tipadas, lo que es inconsistente con nuestro enfoque de tipado fuerte. Usando extensiones modernas al sistema de tipos de Haskell, proponemos una nueva versión de la biblioteca AspectAG, abordando los problemas antes mencionados. Las nuevas definiciones de AGs son mas seguras tanto a nivel de tipado como a nivel de kinds (tipado a nivel de tipos). Ademas, un conjunto identificado de errores específicos del dominio son reportados con mensajes referentes al mismo. Para lograr esto, definimos y utilizamos un framework para manipular errores de tipado, que puede ser aplicado a cualquier EDSL. Mostramos la pragmática de AspectAG definiendo lenguajes y extendiéndoles con nueva sintaxis y con nueva semántica. Utilizamos el lenguaje MateFun, un lenguaje funcional puro utilizado para enseñar matemáticas como caso de estudio

    Acta Cybernetica : Volume 22. Number 3.

    Get PDF

    Verified programming with explicit coercions

    Get PDF
    Type systems have proved to be a powerful means of specifying and proving important program invariants. In dependently typed programming languages types can depend on values and hence express arbitrarily complicated propositions and their machine checkable proofs. The type-based approach to program specification allows for the programmer to not only transcribe their intentions, but arranges for their direct involvement in the proving process, thus aiding the machine in its attempt to satisfy difficult obligations. In this thesis we develop a series of patterns for programming in a correct-by-construction style making use of constraints and coercions to prove properties within a dependently typed host. This allows for the development of a verified, kernel which can be built upon using the host system features. In particular this should allow for the development of “tactics” or semiautomated solvers invoked when coercing types all within a single language. The efficacy of this approach is given by the development of a system of expressions indexed by their, exposing a case analysis feature serving to generate value constraints. These constraints are directly reflected into the host allowing for their involvement in the type-checking process. A motivating use case of this design shows how a term’s semantic index information admits an exact, formalized cost analysis amenable to reasoning within the host. Finally we show how such a system is used to identify unreachable dead-code, trivially admitting the design and verification of an SSA style compiler with this optimization. We think such a design of explicitly proving the local correctness of type-transformations in the presence of accumulated constraints can form the basis of a flexible language in concert with a variety of trusted solver

    Polarized substructural session types

    Get PDF
    Concurrent processes can be extremely difficult to reason about, both for programmers and formally. One approach to coping with this difficulty is to study new programming languages and type features such as Session Types. Session types take as their conceptual notion of concurrency as a collection of processes linked together via channels and provide type-level coordination between processes using these channels. Logically motivated programming languages exploit the idea that providing a proof of a theorem in a logic is similar to proving that a given term has a particular type in a programming language and vice versa. These connections can be interesting for a few different reasons. First, when language and logic are independently discovered and independently useful, the existence of a connection suggests that both are onto some fundamentally important idea. Additionally, a connection provides a basis both for sanity checking our ideas and also can be fruitful grounds for inspiration by seeing how variants of either the logic or the language are reflected through the connection. This thesis primarily describes an exploration of logically motivated session types, SILL. Polarization, classifying propositions as either positive or negative, provides a natural way to describe a logically based session typing language with asynchronous communication while retaining a semantics that is reasonably implementable. Additionally, polarization gives us a way to smoothly integrate synchronous channels into SILL without needing a semantic extension. When combined with Adjoint Logic, this gives us an ability to incorporate a variety of modalities with relatively little work. From a practical perspective, this gives SILL access to persistent processes and garbage collection. We additionally explore a trio of loosely related extensions to SILL, and their logical connections, inspired by the above results: bundled message passing to reduce the number of communications performed by processes; racy programs, enabled by a select/epoll-like mechanism; and asynchronous receiving, an almost generalization of the basic asynchronous semantics. We have three different implementations of SILL: a simple but relatively full featured interpreter written in OCaml; a fragment of SILL as an embedded domain specific language in Haskell; and a cleaner version of the same in Idris. Lastly, we show that Liquid Types and Session Types are compatible. This gives us one notion of a dependently session typed language
    corecore