is a meta programming language. Rascal can be used to analyze and transform any program in any programming language. Rascal supports in principle any programming language, yet unfortunately, Rascal does currently not support the Ada programming language.
In this project we would like to investigate both how generic Rascal is and how Ada differs from other programming languages, such as Java, C# and C++, that are already supported by Rascal.
So first we need to add support for Ada to Rascal. We would like to add Ada support by taking an existing, high quality parser, serialize the produced abstract syntax trees, and import the serialized AST by Rascal. For the parser, we want to use libadalang (https://github.com/AdaCore/libadalang). The envisioned solution will be similar to ClaiR (https://github.com/cwi-swat/clair and https://doi.org/10.22152/programming-journal.org/2019/3/15): the addition of C/C++ support to Rascal.
Once Ada is supported by Rascal, we want to analyze and transform some Ada programs. For the analysis of Ada programs, we would like to perform at least the following experiments:
- Find globally unused functions and data types
- Find globally unused fields of data types
- Find globally exposed objects (such as functions and data types) that are only locally used
- Find opportunities for optimization, such as literal conditions in negations and if-statements
- Measure the cyclomatic complexity
- An important requirement for transforming programs in this project is to keep the trivia, i.e., white spaces and comments, for those parts of the program that are not changed. We intend to use either a "unparser" that is aware of trivia or a rewriter that reuse the original programming text as much as possible to fulfil this requirement.
- For transformation of Ada programs, we would like to perform at least the following experiments:
- Standardize comparisons by putting constant values on the left
- Rewriting if-then-else-statements with negated conditions
- Rewriting if-then-else-statements with unequal comparisons
- Rewriting assignments by if-then-else-statement
- Rewriting assignments by initialization and if-then-statement
Although the analysis results and transformed code of these experiments are appreciated, these experiments should really help us to answer the following questions:
- Can we use generic, pre-defined analyses, measurements, and transformations of Rascal on Ada programs?
- If so, how accurate are the results?
In particular, with respect to exception handling, discriminated and variant records, generics, and other advanced Ada features.
How quickly can we define them specific for Ada?
The project is intended to start in September 2021. In this project you will have two supervisors.
- Jurgen Vinju from CWI, TU Eindhoven and SWAT.engineering will provide his expertise on Rascal and ClaiR.
- Pierre van de Laar from ESI (TNO) will provide his expertise on Ada, libadalang, and rewriters.
You want to work on the precursor of your career; a work placement gives you an opportunity to take a good look at your prospective future employer. TNO goes a step further. It’s not just looking that interests us; you and your knowledge are essential to our innovation. That’s why we attach a great deal of value to your personal and professional development. You will, of course, be properly supervised during your work placement and be given the scope for you to get the best out of yourself. Naturally, we provide suitable work placement compensation.
Then please feel free to apply on this vacancy! For further questions don’t hesitate to contact us.
Due to Covid-19 and the consequent uncertainties and restrictions, students who are not residing in the Netherlands may currently not be able to start an internship or graduation project at TNO.