PhD Defence, Valentin David
Photo: Valentin David
Valentin David successfully defended his PhD thesis, titled Language Constructs for C++-like Languages: Tools and Extensions [bib] on November 6rd, 2009.
Press release (in Norwegian)
SummaryProgramming tools can be powerful companions for the software engineer. Unfortunately, language-dependent programming tools are hard to develop for languages like C++, and hard to maintain. Only a large demand can help a tool survive. For this reason domain-specific tools are out: a narrower domain implies less users, less demand, and then less interest in investing time. In this thesis we try to show that in some contexts we can write tools quickly by showing some experimentation of language features.
Program transformation and C++
C++ is a complex language. Which is then hard to do program transformation with it. The syntax is context-sensitive. And the context includes even the architecture of the target. Many front-ends and transformation environments are available. They respond to different needs, but none are universal, covering all aspects of the language.
Modular specification for a context-sensitive syntax
It is possible to disambiguate a context-sensitive grammar expressed as an ambiguous syntax by using attribute grammars (AGs). The class context-free syntax is closed under union, and AG rules can also be composed. In the end, instead of separating concerns as compiler passes, we can separate language features.
Extending a context-sensitive syntax
With a case study, we show the importance of the modularity of a syntax specification. We show that by introducing a few context-free productions with a few attribute rules we can easily extend a context-sensitive syntax. In this case we extended C with pre- and postconditions. The extension of syntax is non-intrusive, the C parser is reused.
Providing mouldable failure management
Handling failures is important for building quality software. Often a language provide exceptions, or the function returns a special value, but the choice is by the developer of a library, not from its user. Alerts proposes a unified way to handle errors and let the user choose the way to handler error. We show an implementation of alerts which does not need modification of the run-time environment. We extend the syntax of C providing new syntactic constructions.
ConceptC++ is an extension of C++ aimed at resolving some needs for template meta-programming. We show that by generating code using template meta-programming, ConceptC++ can be treated as syntactic sugar of C++. The transformations are then context-free and can be applied to parts of a program.
ConceptC++ for categorical constructions
Concepts are like specification, giving us software institutions. And ConceptC++ provides us signature morphisms. With this in mind, we show techniques of software building using categorical constructions. Though concepts is not completely adapted for the purpose and have some deficiencies. We propose changes to concepts that would resolve the problems.
Reusing concepts for testing
Concepts can be finally reused for a third tool: generating testing code. Specifications can be used for testing, so can concepts. Axioms are transformed to test oracles. The transformation generates test drivers. The result is a program that automatically tests code against its specifications for given sets of typed data.
In general the tools developed are simple, written using very few lines of code. We believe this simplifies maintenance, increasing the tools possible shelf-life.