E. Cardoso, D. Pereira, Regina Sarah Monferrari Amorim De Paula, L. Reis, R. Ribeiro
{"title":"A Type-Directed Algorithm to Generate Random Well-Formed Parsing Expression Grammars","authors":"E. Cardoso, D. Pereira, Regina Sarah Monferrari Amorim De Paula, L. Reis, R. Ribeiro","doi":"10.1145/3561320.3561326","DOIUrl":"https://doi.org/10.1145/3561320.3561326","url":null,"abstract":"PEGs are recognition formalism proposed by Brian Ford to describe top-down recursive parsers. Unfortunately, to determine whether an arbitrary PEG will terminate when parsing an input is undecidable. As termination is a desired property for parsing tools, Ford proposes a well-formedness test that guarantees every PEG that satisfies it, terminates on any input. Therefore, when experimenting with PEG-based tools using property-based testing, it is mandatory to randomly generate only well-formed PEGs, since a naive generation strategy may lead a PEG-based parser into an infinite loop. To overcome that, we propose an algorithm for generating well-formed PEGs, prove its correctness and implement it as a library in the Racket programming language.","PeriodicalId":212309,"journal":{"name":"Proceedings of the XXVI Brazilian Symposium on Programming Languages","volume":"42 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2022-10-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"128756778","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Anna Leticia Alegria, R. Ierusalimschy, N. Rodriguez
{"title":"EventManager — a tool to help students analyse concurrent programs","authors":"Anna Leticia Alegria, R. Ierusalimschy, N. Rodriguez","doi":"10.1145/3561320.3561324","DOIUrl":"https://doi.org/10.1145/3561320.3561324","url":null,"abstract":"Students learning concurrent programming often struggle with tests due to the non-deterministic nature of thread scheduling. It is in general hard to test specific scenarios and harder yet to repeat a given scenario for further tests after changes to the code. In this paper, we describe EventManager, a tool that allows the developer to instrument their program, marking events in the code and specifying valid event sequences using a domain-specific language that restricts thread scheduling to obey allowed sequences for these events. This language is based on regular expressions and set operations. We describe the implementation of EventManager for applications based on POSIX threads and discuss the expressiveness of the resulting environment.","PeriodicalId":212309,"journal":{"name":"Proceedings of the XXVI Brazilian Symposium on Programming Languages","volume":"55 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2022-10-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"117309587","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Thais Damasio, Michael Canesche, Vinícius Pacheco, Anderson Aparecido da Silva, Fernando Magno Quintão Pereira
{"title":"Impacto de Ofuscadores e Otimizadores de Código na Acurácia de Classificadores de Programas","authors":"Thais Damasio, Michael Canesche, Vinícius Pacheco, Anderson Aparecido da Silva, Fernando Magno Quintão Pereira","doi":"10.1145/3561320.3561322","DOIUrl":"https://doi.org/10.1145/3561320.3561322","url":null,"abstract":"O problema de detecção de clones consiste em determinar, dado um programa inicial e classes de problemas, qual problema o programa resolve. A detecção de clones é útil em vários contextos diferentes, incluindo a identificação de código malicioso e a identificação de plágio. Uma vez que a solução exata para detecção de clones é uma impossibilidade teórica, esse problema é resolvido via heurísticas; a maior parte delas de natureza estatística. Este trabalho analisa o impacto de técnicas de transformação de código sobre essas heurísticas. Mostramos que otimizações de código padrão são tão efetivas quanto ofuscadores para enganar as heurísticas mais populares para detecção de clones, gerando, contudo, código ordens de magnitude mais eficientes. Mostramos também que histogramas de instruções são tão efetivos quanto representações mais complexas ao executar as heurísticas. E por fim mostramos que otimizações de código podem funcionar como um normalizador de programas, em alguns casos, revertendo o efeito da ofuscação, e recuperando assim a capacidade de um detector estatístico de encontrar clones.","PeriodicalId":212309,"journal":{"name":"Proceedings of the XXVI Brazilian Symposium on Programming Languages","volume":"13 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2022-10-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"126615841","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"A Foreign Function Interface for Pallene","authors":"Gabriel Coutinho De Paula, R. Ierusalimschy","doi":"10.1145/3561320.3561321","DOIUrl":"https://doi.org/10.1145/3561320.3561321","url":null,"abstract":"Pallene is a statically typed subset of the Lua programming language, designed to act as a system-language counterpart to Lua’s scripting, and used to write lower-level libraries and extension modules for Lua. In this sense, Pallene is a companion language, always intended to be used side-by-side with Lua, sharing its runtime. Pallene, both as a system-language counterpart to Lua and as a bridge between Lua and foreign languages, must provide a mechanism to interact with libraries and system services written in a low-level language like C. To this end, we present a Foreign Function Interface (FFI) design and implementation for Pallene, which allows for calling external functions that follow C calling conventions and manipulating C data representations directly. Our design balances flexibility and safety following an empirical approach, wherein we prefer to sacrifice hypothetical flexibility unless we see a real use case that forces us to compromise on safety. Furthermore, our implementation aims to be as portable as Pallene, as well as performant and simple. Since Pallene’s implementation already depends on a C compiler, we avail ourselves of the assistance of this compiler to gain a rudimentary understanding of C. This enables the FFI to verify the correctness of function bindings and to use C macro definitions.","PeriodicalId":212309,"journal":{"name":"Proceedings of the XXVI Brazilian Symposium on Programming Languages","volume":"42 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2022-10-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"115898530","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Exploring Opacity Software Transactional Memory in Haskell through Graph Transformation","authors":"Diogo J. Cardoso, Luciana Foss, A. R. D. Bois","doi":"10.1145/3561320.3561325","DOIUrl":"https://doi.org/10.1145/3561320.3561325","url":null,"abstract":"Software Transactional Memory (STM) is considered an alternative abstraction for concurrent programming, it has shown to be more approachable when compared to it’s main counterpart, lock-based synchronization. Haskell included language support very early through the STM Haskell library, that allows concurrent lock-free programming using composable atomic actions that manipulate transactional variables. In this work, we explore the correctness criterion Opacity and CO-Opacity for the STM Haskell algorithm using a Graph Transformation System (GTS) approach. Even though Opacity can be demonstrated in Haskell using other STM algorithms, the original STM Haskell library does not satisfy it. Using a GTS to represent the execution of the original STM Haskell, we demonstrate it’s correctness, or lack thereof, using the graph characterization of the criterion. We also compare it to a GTS for the TL2 algorithm, to observe how the algorithms differ in decision making, and how it affects the correctness of the execution.","PeriodicalId":212309,"journal":{"name":"Proceedings of the XXVI Brazilian Symposium on Programming Languages","volume":"135 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2022-10-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"127552514","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Ariel Agne Da Silveira, R. Ribeiro, Miguel Alfredo Nunes, Paulo Torrens, K. Roggia
{"title":"A Sound Deep Embedding of Arbitrary Normal Modal Logics in Coq","authors":"Ariel Agne Da Silveira, R. Ribeiro, Miguel Alfredo Nunes, Paulo Torrens, K. Roggia","doi":"10.1145/3561320.3561329","DOIUrl":"https://doi.org/10.1145/3561320.3561329","url":null,"abstract":"This work describes an encoding of modal logics using the Coq proof assistant. Our formalization differs from previous attempts by providing a uniform representation of several systems for modal logic using Coq’s rich type structure. We illustrate the usefulness of our library in a formalization of Löb’s theorem which closely follows a classical proof of this result.","PeriodicalId":212309,"journal":{"name":"Proceedings of the XXVI Brazilian Symposium on Programming Languages","volume":"60 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2022-10-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"123135887","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Nelson Gregório, J. P. Fernandes, João Bispo, S. Medeiros
{"title":"E-APK: Energy Pattern Detection in Decompiled Android Applications","authors":"Nelson Gregório, J. P. Fernandes, João Bispo, S. Medeiros","doi":"10.1145/3561320.3561328","DOIUrl":"https://doi.org/10.1145/3561320.3561328","url":null,"abstract":"Energy efficiency is a non-functional requirement that developers must consider. This requirement is particularly relevant when building software for battery-operated devices like mobile ones: a long-lasting battery is an essential requirement for an enjoyable user experience. It has been shown that many mobile applications include inefficiencies that cause battery to be drained faster than necessary. Some of these inefficiencies result from software patterns that have been catalogued in the literature. The catalogues often provide more energy-efficient alternatives. While the related literature is vast, most approaches so far assume as a fundamental requirement that one has access to the source code of an application in order to be able to analyse it. This requirement makes independent energy analysis challenging, or even impossible, e.g. for a mobile user or, most significantly, an App Store trying to provide information on how efficient an application being submitted for publication is. Our work studies the viability of looking for known energy patterns in applications by decompiling them and analysing the resulting code. For this, we decompiled and analysed 236 open-source applications. We extended an existing tool to aid in this process, making it capable of seamlessly decompiling and analysing android applications. With the collected data, we performed a comparative analysis of the presence of energy patterns between the source code and the decompiled code. While further research is required to more assertively say if this type of static analysis is viable, our results point in a promising direction with 163 applications, approximately 69%, containing the same number of detected patterns in both source code and the release APK.","PeriodicalId":212309,"journal":{"name":"Proceedings of the XXVI Brazilian Symposium on Programming Languages","volume":"13 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2022-10-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"131445511","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Dinei A. Rockenbach, Júnior Löff, G. Araujo, Dalvan Griebler, L. G. Fernandes
{"title":"High-Level Stream and Data Parallelism in C++ for GPUs","authors":"Dinei A. Rockenbach, Júnior Löff, G. Araujo, Dalvan Griebler, L. G. Fernandes","doi":"10.1145/3561320.3561327","DOIUrl":"https://doi.org/10.1145/3561320.3561327","url":null,"abstract":"GPUs are massively parallel processors that allow solving problems that are not viable to traditional processors like CPUs. However, implementing applications for GPUs is challenging to programmers as it requires parallel programming to efficiently exploit the GPU resources. In this sense, parallel programming abstractions, notably domain-specific languages, are fundamental for improving programmability. SPar is a high-level Domain-Specific Language (DSL) that allows expressing stream and data parallelism in the serial code through annotations using C++ attributes. This work elaborates on a methodology and tool for GPU code generation by introducing new attributes to SPar language and transformation rules to SPar compiler. These new contributions, besides the gains in simplicity and code reduction compared to CUDA and OpenCL, enabled SPar achieve of higher throughput when exploring combined CPU and GPU parallelism, and when using batching.","PeriodicalId":212309,"journal":{"name":"Proceedings of the XXVI Brazilian Symposium on Programming Languages","volume":"27 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2022-10-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"130670751","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Geração Automática de Benchmarks para Compilação Preditiva","authors":"Cecília Kind, Joao Coelho, Bruno Kind, F. Pereira","doi":"10.1145/3561320.3561323","DOIUrl":"https://doi.org/10.1145/3561320.3561323","url":null,"abstract":"O treinamento de um compilador preditivo requer uma quantidade muito vasta de benchmarks, que aproxime o universo de programas que o compilador irá encontrar durante sua utilização. Atualmente existem diversas técnicas para gerar benchmarks para calibrar compiladores preditivos. Contudo, essas técnicas, quando aplicadas a linguagens inseguras, como C, C++ ou dialetos de montagem, tendem a esbarrar em um desafio: a geração de códigos executáveis. A dificuldade em detectar comportamento indefinido, somada à dificuldade de criar entradas que executem vários caminhos de um mesmo programa, torna a geração de benchmarks executáveis um desafio. Este artigo descreve Jotai, um conjunto de aproximadamente 30 mil programas executáveis, minerados a partir de repositórios de código aberto. Jotai usa um inferidor de tipos publicamente disponível para garantir que códigos minerados automaticamente possam compilar, e usa uma linguagem de domínio específico para gerar entradas válidas para programas. Essa coleção pôde ser utilizada para prever o benefício advindo de otimizações de código; para encontrar boas configurações para as diferentes heurísticas usadas por compiladores; e para analisar correlações, por exemplo, entre o número de instruções processadas durante a execução de um programa e o tempo que esse programa leva para terminar.","PeriodicalId":212309,"journal":{"name":"Proceedings of the XXVI Brazilian Symposium on Programming Languages","volume":"111 1 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2022-10-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"121437798","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}