Cunha J, Erwig M, Mendes J, Saraiva JA.  2014.  Model inference for spreadsheets. Automated Software Engineering. :1-32. Abstractase14.pdf

Many errors in spreadsheet formulas can be avoided if spreadsheets are built automati-
cally from higher-level models that can encode and enforce consistency constraints in the generated
spreadsheets. Employing this strategy for legacy spreadsheets is dicult, because the model has
to be reverse engineered from an existing spreadsheet and existing data must be transferred into
the new model-generated spreadsheet.
We have developed and implemented a technique that automatically infers relational schemas
from spreadsheets. This technique uses particularities from the spreadsheet realm to create better
schemas. We have evaluated this technique in two ways: First, we have demonstrated its appli-
cability by using it on a set of real-world spreadsheets. Second, we have run an empirical study
with users. The study has shown that the results produced by our technique are comparable to
the ones developed by experts starting from the same (legacy) spreadsheet data.
Although relational schemas are very useful to model data, they do not t well spreadsheets as
they do not allow to express layout. Thus, we have also introduced a mapping between relational
schemas and ClassSheets. A ClassSheet controls further changes to the spreadsheet and safeguards
it against a large class of formula errors. The developed tool is a contribution to spreadsheet
(reverse) engineering, because it lls an important gap and allows a promising design method
(ClassSheets) to be applied to a huge collection of legacy spreadsheets with minimal e ort.

Pardo A, Fernandes JP, Saraiva JA.  2011.  Shortcut fusion rules for the derivation of circular and higher-order programs. Higher-Order and Symbolic Computation. 24:115-149. Abstracthosc11.pdf

Functional programs often combine separate parts using intermediate data structures for communicating results. Programs so defined are modular, easier to understand and maintain, but suffer from inefficiencies due to the generation of those gluing data structures. To eliminate such redundant data structures, some program transformation techniques have been proposed. One such technique is shortcut fusion, and has been studied in the context of both pure and monadic functional programs.
In this paper, we study several shortcut fusion extensions, so that, alternatively, circular or higher-order programs are derived. These extensions are also provided for effect-free programs and monadic ones. Our work results in a set of generic calculation rules, that are widely applicable, and whose correctness is formally established.

Silva JC, Campos JC, Saraiva JA.  2010.  GUI Inspection from Source Code Analysis. Electronic Communications of the EASST. 33 Abstract459-1337-1-pb.pdf

Graphical user interfaces (GUIs) are critical components of todays software. Given their increased relevance, correctness and usability of GUIs are becoming essential. This paper describes the latest results in the development of our tool to reverse engineer the GUI layer of interactive computing systems. We use static analysis techniques to generate models of the user interface behaviour from source code. Models help in graphical user interface inspection by allowing designers to concentrate on its more important aspects. One particularly type of model that the tool is able to generate is state machines. The paper shows how graph theory can be useful when applied to these models. A number of metrics and algorithms are used in the analysis of aspects of the user interface's quality. The ultimate goal of the tool is to enable analysis of interactive system through GUIs source code inspection.

Saraiva JA, Bigonha R, Tirelo F.  2008.  Disentangling denotational semantics specifications. JUCS - Journal of Universal Computer Science. 14(21):3592--3607. Abstractjucs_14_21_3592_3607_tirelo.pdf

Denotational semantics is a powerful technique to formally define programming languages. However, language constructs are not always orthogonal, so many semantic equations in a definition may have to be aware of unrelated constructs semantics. Current approaches for modularity in this formalism do not address this problem, providing, for this reason, tangled semantic definitions. This paper proposes an incremental approach for denotational semantic specifications, in which each step can either add new features or adapt existing equations, by means of a formal language based on function transformation and aspect weaving.

Saraiva JA, Maia P, Mendes J, Cunha J, Rebêlo H, Saraiva JA.  2015.  Towards the Design and Implementation of Aspect-Oriented Programming for Spreadsheets. Abstract1503.03463v1_2.pdf

A spreadsheet usually starts as a simple and singleuser software artifact, but, as frequent as in other software systems, quickly evolves into a complex system developed by many actors. Often, different users work on different aspects of the same spreadsheet: while a secretary may be only involved in adding plain data to the spreadsheet, an accountant may define new business rules, while an engineer may need to adapt the spreadsheet content so it can be used by other software systems. Unfortunately, spreadsheet systems do not offer modular mechanisms, and as a consequence, some of the previous tasks may be defined by adding intrusive “code” to the spreadsheet. In this paper we go through the design and implementation of an aspect-oriented language for spreadsheets so that users can work on different aspects of a spreadsheet in a modular way. For example, aspects can be defined in order to introduce new business rules to an existing spreadsheet, or to manipulate the spreadsheet data to be ported to another system. Aspects are defined as aspect-oriented program specifications that are dynamically woven into the underlying spreadsheet by an aspect weaver. In this aspect-oriented style of spreadsheet development, different users develop, or reuse, aspects without adding intrusive code to the original spreadsheet. Such code is added/executed by the spreadsheet weaving mechanism proposed in this paper.

Saraiva JA, Pereira R, Fernandes JP, Cunha J.  2015.  Querying Spreadsheets: An Empirical Study. Abstract1502.07948.pdf

One of the most important assets of any company is being able to easily access information on itself and on its business. In this line, it has been observed that this important information is often stored in one of the millions of spreadsheets created every year, due to simplicity in using and manipulating such an artifact. Unfortunately, in many cases it is quite difficult to retrieve the intended information from a spreadsheet: information is often stored in a huge unstructured matrix, with no care for readability or comprehensiveness. In an attempt to aid users in the task of extracting information from a spreadsheet, researchers have been working on models, languages and tools to query. In this paper we present an empirical study evaluating such proposals assessing their usage to query spreadsheets. We investigate the use of the Google Query Function, textual modeldriven querying, and visual model-driven querying. To compare these different querying approaches we present an empirical study whose results show that the end-users' productivity increases when using model-driven queries, specially using its visual representation.

Beckwith L, Cunha J, Fernandes JP, Saraiva JA.  2010.  End Users Productivity in Model-based Spreadsheets: An Empirical Study. Abstracttr_study.pdf

Spreadsheets are widely used by end users, and studies have shown that most end-user spreadsheets contain non-trivial errors. To improve end users productivity, recent research proposes the use of a model-driven engineering approach to spreadsheets. In this paper we conduct the first systematic empirical study to assess the effectiveness and efficiency of this approach. A set of spreadsheet end users worked with two different model-based spreadsheets, and we present and analyze the results achieved.

Cunha J, Visser J, Alves T, Saraiva JA.  2010.  Type-safe Evolution of Spreadsheets. Abstracttr_evolution.pdf

Spreadsheets are notoriously error-prone. To help avoid the introduction of errors when changing spreadsheets, models that capture the structure and interdependencies of spreadsheets at a conceptual level have been proposed. Thus, spreadsheet evolution can be made safe within the confines of a model. As in any other model/instance setting, evolution may not only require changes at the instance level but also at the model level. When model changes are required, the safety of instance evolution can not be guarded by the model alone. Coupled transformation of models and instances are supported by the 2LT platform and have been applied for transformation of algebraic datatypes, XML schemas, and relational database models. We have extended 2LT to spreadsheet evolution. We have designed an appropriate representation of spreadsheet models, including the fundamental notions of formulæ, references, and blocks of cells. For these models and their instances, we have designed coupled transformation rules that cover specific spreadsheet evolution steps, such as extraction of a block of cells into a separate sheet or insertion of columns in all occurrences of a repeated block of cells. Each model-level transformation rule is coupled with instance level migration rules from the source to the target model and vice versa. These coupled rules can be composed to create compound transformations at the model level that induce compound transformations at the instance level. With this approach, spreadsheet evolution can be made safe, even when model changes are involved.

Martins P.  2014.  Embedding Attribute Grammars and their Extensions using Functional Zippers. Abstractphd.pdf

Gramáticas de atributos são um formalismo que permite exprimir algoritmos complexos de análise e transformação de programas, que tipicamente requerem várias travessias as árvores abstractas que os representam. As gramáticas de atributos foram extendidas com mecanismos que permitem referências, ordem superior e circularidade em atributos. Estas extensões permitem a implementação de mecanismos complexos e modulares de computações em linguagens.
Neste trabalho embebemos gramáticas de atributos e as suas extensões de forma elegante e simples, através de uma técnica chamada ”zippers”. Na nossa técnica, especificações de linguagens são definidas com um conjunto de componentes independentes de primeira ordem, que podem ser facilmente compostos para formar poderosos ambientes de processamento de linguagens.
Também desenvolvemos técnicas que descrevem transformações bidireccionais entre gramáticas. Definimos métodos de especificar transformações que, através de mecanismos completamente automáticos são invertidas e estendidas e geram graméticas de atributos que especificam o nosso ambiente bidirecional.
Com esta tecnica foram implementados varios exemplos de especificacao e processamento de linguagens, alguns dos quais estao definidos e explicados neste documento. Da mesma forma, criamos e desenvolvemos uma linguagem de dominio especifico usando a nossa tecnica; linguagem essa que integramos num portal que permite a criação de analises de programas completamente configurada para servir os requisitos particulares de cada utilizador.