Cookies
O website necessita de alguns cookies e outros recursos semelhantes para funcionar. Caso o permita, o INESC TEC irá utilizar cookies para recolher dados sobre as suas visitas, contribuindo, assim, para estatísticas agregadas que permitem melhorar o nosso serviço. Ver mais
Aceitar Rejeitar
  • Menu
Publicações

Publicações por João Alexandre Saraiva

2020

Expressing Disambiguation Filters as Combinators

Autores
Macedo, JN; Saraiva, J;

Publicação
PROCEEDINGS OF THE 35TH ANNUAL ACM SYMPOSIUM ON APPLIED COMPUTING (SAC'20)

Abstract
Contrarily to most conventional programming languages where certain symbols are used so as to create non-ambiguous grammars, most recent programming languages allow ambiguity. These ambiguities are solved using disambiguation rules, which dictate how the software that parses these languages should behave when faced with ambiguities. Such rules are highly efficient but come with some limitations - they cannot be further modified, their behaviour is hidden, and changing them implies re-building a parser. We propose a different approach for disambiguation. A set of disambiguation filters (expressed as combinators) are provided, and disambiguation can be achieved by composing combinators. New combinators can be created and, by having the disambiguation step separated from the parsing step, disambiguation rules can be changed without modifying the parser.

2020

Unifying Parsing and Reflective Printing for Fully Disambiguated Grammars

Autores
Zhu, ZR; Ko, HS; Zhang, YZ; Martins, P; Saraiva, J; Hu, ZJ;

Publicação
NEW GENERATION COMPUTING

Abstract
Language designers usually need to implement parsers and printers. Despite being two closely related programs, in practice they are often designed separately, and then need to be revised and kept consistent as the language evolves. It will be more convenient if the parser and printer can be unified and developed in a single program, with their consistency guaranteed automatically. Furthermore, in certain scenarios (like showing compiler optimisation results to the programmer), it is desirable to have a more powerful reflective printer that, when an abstract syntax tree corresponding to a piece of program text is modified, can propagate the modification to the program text while preserving layouts, comments, and syntactic sugar. To address these needs, we propose a domain-specific language BiYacc, whose programs denote both a parser and a reflective printer for a fully disambiguated context-free grammar. BiYacc is based on the theory of bidirectional transformations, which helps to guarantee by construction that the generated pairs of parsers and reflective printers are consistent. Handling grammatical ambiguity is particularly challenging: we propose an approach based on generalised parsing and disambiguation filters, which produce all the parse results and (try to) select the only correct one in the parsing direction; the filters are carefully bidirectionalised so that they also work in the printing direction and do not break the consistency between the parsers and reflective printers. We show that BiYacc is capable of facilitating many tasks such as Pombrio and Krishnamurthi's 'resugaring', simple refactoring, and language evolution.

2019

Get Your Spreadsheets Under (Version) Control

Autores
Macedo, JN; Moreira, R; Cunha, J; Saraiva, J;

Publicação
Proceedings of the XXII Iberoamerican Conference on Software Engineering, CIbSE 2019, La Habana, Cuba, April 22-26, 2019.

Abstract
Spreadsheets play a pivotal role in many organizations. They serve to store and manipulate data or forecasting, and they are often used to help in the decision process, thus directly impacting the success, or not, of organizations. As the research community already realized, spreadsheets tend to have the same problems “professional” software contain. Thus, in the past decade many software engineering techniques have been successfully proposed to aid spreadsheet developers and users. However, one of the most used mechanisms to manage software projects is still lacking in spreadsheets: a version control system. A version control system allows for collaborative development, while also allowing individual developers to explore different alternatives without compromising the main project. In this paper we present a version control system, named SheetGit, oriented for end-user programmers. It allows to graphically visualize the history of versions (including branches), to switch between different versions just by pointing and clicking, and to visualize the differences between any two versions in an animated way. To validate our approach/tool we performed an empirical evaluation which shows evidence that SheetGit can aid users when compared to other tools.

2019

Java Stream Fusion: Adapting FP mechanisms for an OO setting

Autores
Ribeiro, F; Saraiva, J; Pardo, A;

Publicação
XXIII BRAZILIAN SYMPOSIUM ON PROGRAMMING LANGUAGES

Abstract
In this paper, we show how stream fusion, a program transformation technique used in functional programming, can be adapted for an Object-Oriented setting. This makes it possible to have more Stream operators than the ones currently provided by the Java Stream API. The addition of more operators allows for a greater deal of expressiveness. To this extent, we show how these operators are incorporated in the stream setting. Furthermore, we also demonstrate how a specific set of optimizations eliminates overheads and produces equivalent code in the form of for loops. In this way, programmers are relieved from the burden of writing code in such a cumbersome style, thus allowing for a more declarative and intuitive programming approach.

2020

InDubio: A Combinator Library to Disambiguate Ambiguous Grammars

Autores
Macedo, JN; Saraiva, J;

Publicação
COMPUTATIONAL SCIENCE AND ITS APPLICATIONS, ICCSA 2020, PART IV

Abstract
To infer an abstract model from source code is one of the main tasks of most software quality analysis methods. Such abstract model is called Abstract Syntax Tree and the inference task is called parsing. A parser is usually generated from a grammar specification of a (programming) language and it converts source code of that language into said abstract tree representation. Then, several techniques traverse this tree to assess the quality of the code (for example by computing source code metrics), or by building new data structures (e.g, flow graphs) to perform further analysis (such as, code cloning, dead code, etc). Parsing is a well established technique. In recent years, however, modern languages are inherently ambiguous which can only be fully handled by ambiguous grammars. In this setting disambiguation rules, which are usually included as part of the grammar specification of the ambiguous language, need to be defined. This approach has a severe limitation: disambiguation rules are not first class citizens. Parser generators offer a small set of rules that can not be extended or changed. Thus, grammar writers are not able to manipulate nor define a new specific rule that the language he is considering requires. In this paper we present a tool, name InDubio, that consists of an extensible combinator library of disambiguation filters together with a generalized parser generator for ambiguous grammars. InDubio defines a set of basic disambiguation rules as abstract syntax tree filters that can be combined into more powerful rules. Moreover, the filters are independent of the parser generator and parsing technology, and consequently, they can be easily extended and manipulated. This paper presents InDubio in detail and also presents our first experimental results.

2020

Greenspecting Android virtual keyboards

Autores
Rua, R; Fraga, T; Couto, M; Saraiva, J;

Publicação
MOBILESoft '20: IEEE/ACM 7th International Conference on Mobile Software Engineering and Systems, Seoul, Republic of Korea, July 13-15, 2020

Abstract
During this still increasing mobile devices proliferation age, much of human-computer interaction involves text input, and the task of typing text is provided via virtual keyboards. In a mobile setting, energy consumption is a key concern for both hardware manufacturers and software developers. Virtual keyboards are software applications, and thus, inefficient applications have a negative impact on the overall energy consumption of the underlying device. Energy consumption analysis and optimization of mobile software is a recent and active area of research. Surprisingly, there is no study analyzing the energy efficiency of the most used software keyboards and evaluating the performance advantage of its features. In this paper, we studied the energy performance of five of the most used virtual keyboards in the Android ecosystem. We measure and analyze the energy consumption in different keyboard scenarios, namely with or without using word prediction. This work presents the results of two studies: one where we instructed the keyboards to simulate the writing of a predefined input text, and another where we performed an empirical study with real users writing the same text. Our studies show that there exist relevant performance differences among the most used keyboards of the considered ecosystem, and it is possible to save nearly 18% of energy by replacing the most used keyboard in Android by the most efficient one. We also showed that is possible to save both energy and time by disabling keyboard intrinsic features and that the use of word suggestions not always compensate for energy and time. © 2020 ACM.

  • 11
  • 26