Update on the Software Languages Book

As usual, if you want to have a look or perhaps even be an early adopter, please get in touch by email.

I completed the "Metaprogramming basics" chapter with these sections:
  • Object program representation
  • Interpretation
  • Parsing
  • Semantic analysis
  • Transformation
  • Formatting
The chapter is now heavily Haskell-based with some minor bits of Java.

I have removed all use of Prolog.

The table of contents of the complete book is now also stable; these are all the chapters:

(The chapters in boldface are readily available upon request.)

  • Preface (introduction to the book)
  • The notion of software language
  • A DSL primer
  • Syntax of software languages
  • Metaprogramming basics
  • Semantics of software languages
  • Types and software languages
  • Metaprogramming cont'd
  • Postface (summary and outlook)

Thus, what's left is the "metaprogramming cont'd" chapter -- to be ready in early October. There are going to be these sections:
  • Term rewriting
  • Attribute grammars
  • Logic programs
  • Constraint programming
  • Multi-stage programming
  • Partial evaluation
  • Concrete object syntax

One final note on the book overall: I decided to keep megamodeling out of the book because this area is still too much in flux. Also, the book is getting out of hand anyway.



Scoped global variables in Prolog

It just so happens that I needed global variables in some Prolog code.

In fact, I needed more carefully scoped global variables. SWI-Prolog's global variables are really global. (Well, they are thread-scoped, for what it matters.) This is not good, if you need a lot of global variables and maybe even in different parts of an application.

An uninspiring approach would be to fabricate global variable names in a manner that they are scoped internally by some name prefix. It was more fun to achieve scope by means of actually using one truly global variable to provide many scoped variables. Here is a demo:

?- logvars:get(myscope, a, X).                            

?- logvars:get(myscope, a, Y).

?- logvars:get(myscope, a, X), logvars:get(myscope, a, Y).
X = Y .

?- logvars:get(myscope, a, X), logvars:get(myscope, b, Y).
true .

Here is the code:


Inlined below:

% (C) 2016 Ralf Laemmel
:- module(logvars, []).

get(+S, +N, -V): Retrieve the value V of the global variable named N
and "scoped" by the global variable S. The variable N is
"automatically" created with a fresh logical variable V as initial

get(S, N, V) :-
    ( nb_current(S, _) ->
          nb_setval(S, _) ),
    nb_getval(S, (Ns, Vs)),
    varnth0(Pos, Ns, N),
    nth0(Pos, Vs, V).   

varnth0(-Pos, ?Ns, +N): given a list Ns of atoms with a variable tail,
find the name N in Ns or, if not present, unify the first variable
position of Ns with N, and return the position as Pos. This is a
helper for get/3.

varnth0(Pos1, [N1|Ns], N2) :-
    ( N1 == N2 ->
   Pos1 = 0;
          varnth0(Pos2, Ns, N2),
          Pos1 is Pos2 + 1 ).
varnth0(0, [N1|_], N2) :-
    N1 = N2.


Megamodels of Coupled Transformations

While having fun at UvA in A'dam by means of teaching Haskell in a pre-master summer school, I also manage to walk across the street to see folks at CWI. Will be giving a presentation on coupled transformations and megamodeling.

Title: Megamodels of Coupled Transformations

Abstract: Many software engineering contexts involve a collection of coupled artifacts, i.e., changing one artifact may challenge consistency between artifacts of the collection. A coupled software transformation (CX) is meant to transform one or more artifacts of such a collection while preserving consistency. There are many forms of coupling—depending on technological space and application domain and solution approach. We axiomatize and illustrate important forms of coupling within the Prolog-based software language repository YAS (Yet Another SLR (Software Language Repository)) while relying on a higher-level predicate logic-based megamodeling language LAL for axiomatization and a lower-level megamodeling language Ueber for build management and testing.

Date and Time: 19 August, 11:00am

Related links:


An updated update on the software language book

Deleting this post as it superseded by newer updates.


Status update on the Software Language Book

NOTE per 12 Sep 2016: This post is outdated.

My software language book is coming together. :-)

Software Languages: An Introduction
Ralf Lämmel
To appear in Springer Verlag, 2016-17

Call for book usage

If you are doing lectures or if you are otherwise interested in the emerging book, please get in touch. I can share draft material with you, subject to agreeing with some (simple?) copyright-related protocol. Of course, I would be happy to see this work being used and receiving feedback. If you would rather want to see a more polished manuscript, then get in touch anyway, and I am happy to keep you in the loop.

Use cases of the book

Let me just explain how I use the book; please let me know about your needs. 

  • I am readily using this book now as the exclusive resource for my Bachelor-level course on programming language theory, as it covers enough aspects of formal syntax, semantics, interpretation, and type systems. The style in these areas is quite applied as opposed to theoretical. Nevertheless some advanced topics are offered in the relevant chapters, e.g., metametamodels, partial evaluation, and abstract interpretation.
  • I am also using this book to support my Master-level course on software language engineering. Especially the DSL primer and the broad coverage of the notion of software languages and the topics on software metalanguages and software language implementation help me to quickly drill into software language engineering. I should mention that, for the purposes of my research-oriented course, I don’t expect in-depth coverage of those subjects; rather I want to prepare students for research work.

Important characteristics of the book

I already mentioned that the book is written in an applied as opposed to a theoretical style. The book develops simple notations for abstract and concrete syntax which are used throughout the book. Different programming languages are used to implement functionality (semantics, type checking, transformation, translation, etc.). In the context of semantics and type systems, Haskell is preferred. In some illustrations of language implementation, Python and Java are leveraged. In a few places, Prolog is used for representing rewrite systems or deductive systems to provide executable specifications for problems of software language processing. 

There are many exercises throughout the book; they are classified at the levels "basic", "intermediate", and "advanced". Solutions for the exercises are not included into the book, but they should be made available eventually online for the basic and intermediate levels.

Timeline for finalization

Realistically, I will need all of summer 2016 to finish and mature all content. In August, I plan to provide a version for reviewing by Springer. Depending on the details of the Springer-driven process and my ability to implement change requests in a timely manner, the book could be in print in 6 months from now (Mid June 2016). I would be very sad (as if you or me cared), if it would take another year. Until then, I am happy to communicate with regard to the possible deployment of the draft material in your courses.

Status of material

These chapters are stable:
  • The notion of software language
    • Software language examples
    • Classification of software languages
    • The lifecycle of software languages
    • Software languages in software engineering
    • Software languages in academia
  • A DSL primer
    • Language concepts
    • Internal DSL style
    • Textual syntax
    • Parsing text to objects
    • Language-agnostic models
    • Language constraints
    • Interpretation
    • Code generation
    • Visual syntax
    • Summary
  • Syntax of software languages
    • Concrete syntax
    • Abstract syntax
    • The metametalevel
    • Syntax mapping
  • Semantics of software languages
    • Pragmatic interpretation
    • Big-step operational semantics
    • Small-step operational semantics
    • Denotational semantics
    • The λ-calculus
    • Partial evaluation
    • Abstract interpretation
  • Types and software languages
    • Type systems
    • Typed calculi
    • Type-system implementation

The following chapters are not ready for your eye; they are released one-by-one to those interested:
  • Preface (introduction to the book)
  • Postface (summary and outlook)
  • Software metalanguages
    • Attribute grammars
    • Rewrite systems
    • Quasi quotation
    • Templates
    • Intermediate representation
  • Software language implementation
    • Parsing
    • Pretty printing
    • Code generation
    • Test-data generation
    • Syntax-directed editing
  • Megamodeling and software languages
    • Entities of interest
    • Relationships of interest
    • Build management and testing
    • Logic-based axiomatization
    • Megamodels of coupled transformations

What’s not in the book?
  • Description of specific platforms for software language implementation such as Eclipse, EMF, TXL, Stratego/XT, and Rascal. The book aims at being technology-agnostic and somewhat timeless. Also, the assumption is that there exists strong material for all important platforms. The book comes with online material though, which covers several platforms. Diverse platforms are mentioned in the right places in the book.
  • Proper coverage of compiler construction topics such as flow analysis, intermediate or machine code-level optimization, and code generation. A cursory discussion of compiler construction topics is included though. There are clearly very good books on compiler construction on the market. Don’t expect this book to be useful for a compiler construction course.

  • A deeper discussion of current research trends in software language engineering. One might thus miss non-trivial coverage of, for example, language workbenches, projectional editing, language embedding, debugging, language integration, and advanced metalanguages, e.g., for name binding or type systems. The reason for exclusion is again that the book aims at being somewhat timeless. Pointers to research works are included, though.



Responding to reviews of rejected conference papers

This post is concerned with this overall question:

How to make good use of reviews for a rejected conference paper?

The obvious answer is presumably something like this:

Extract TODOs from the reviews. Do you work. Resubmit.

In this post, I'd like to advocate an additional element:

Write a commentary on the reviews.

Why would you respond on reviews for a rejected conference paper?

Here are the reasons I can think of:
  • R1You received a review that is clearly weak and you want to complain publicly. I recommend against this complaint model. It is unfriendly with regard to the conference, the chairs, and the reviewers. If one really needs to complain, then one should do this in a friendly manner by direct communication with the conference chair.
  • R2: You spot factual errors in an otherwise serious review and you want to defend yourself publicly. There is one good reason for doing this. Just write it off your chest. There is two good reasons for not doing it. Firstly, chances are that your defense is perceived as an unfriendly complaint; see above. Secondly, why bother and who cares? For instance, sending your defense to the chairs would be weird and useless, I guess.
  • R3: You want to make good use of the reviews along revision and document this properly.

R3 makes sense to me. 

R3 is what this post is about.

We respond to reviews anyway when working on revisions of journal submissions because we have to. One does not make it through a major revision request for a journal paper unless one really makes an effort to properly address the reviewer requests.

Some conferences run a rebuttal model, but this is much different. Rebuttal is about making reviewers understand the paper; revision of a journal paper is more about doing enough of presentational improvements or bits of extra thinking and even research so that a revision is ultimately accepted. 

In the case of a rejected conference paper and its revision, I suggest that a commentary is written in a style, as if the original reviewers were to decide on the revision, even though this will not happen, of course. It remains to be decided on a case-by-case basis whether and how and when the commentary should be made available to whom for what purpose. 

Not that I want my submissions to be rejected, but it happens because of competition and real issues in a paper or the underlying research. My ICMT 2016 submission was received friendly enough, but rightly rejected. The paper is now revised and the paper's website features the ICMT 2016 notification and my commentary on the reviews. In this particular case, I estimated that public access to the notification and my commentary will do more good than bad. At the very least, I can provide a show case for what I am talking about in this blog post.

With the commentary approach, there are some problems that I can think of:
  • P1: Reviewers or conference chairs feel offended. Without being too paranoid, the reviewers or the chairs could receive the commentary as a criticism of their work. For instance, the chair may think that some review was not strong enough to be publicly exposed as a data point of the conference. I have two answers. Firstly, an author should make an effort to avoid explicit or subliminal criticism. (We know how to do this because of how we deal with journal reviews.) Secondly, dear reviewers and chairs, maybe the world would be a better place if more of the review process would be transparent?
  • P2: Prior reviews and your commentary could be misused by reviewers. There is some good reason for not exposing reviewers to other reviews of the same paper (or a prior version thereof), not until they have casted their vote at least, because they may just get biased or they may use these other views without performing a thorough analysis on their own. This is a valid concern. This problem may call for some rules as to i) what conferences are eligible for passing reviews and commentary to each other and ii) when and how commentary can be used by reviewers. 
  • P3: Your commentary is perceived as putting pressure on reviewers of the revision. At this stage of our system, I don't propose that reviewers should be required in any way to consider the commentary on a previous version of a paper because reviewing is already taking too much time. All what I am saying is that reviewers should be given the opportunity to access previous reviews and the author's commentary, at least at some stage of the review process. Reviewers are welcome to ignore the commentary. In fact, some reviewing models may be hard to unite with the notion of commentary. For instance, I don't now whether it would work for the double blind model.

In summary, commentary on rejected conference submissions is a bit like unit testing. We should do it because it helps us to test our interpretation of the reviews in a systematic manner. Without such testing we are likely to i) complain non-constructively about the reviews; ii) ignore legitimate and critical issues pointed out by the reviews; iii) as a consequence, resubmit suboptimal revisions and busy program committees. So we do not really write this commentary for future reviewers; we rather write the commentary for us. However, we write it in a style that it could be used for good by future reviewers. 

Once the community gets a bit more used to this idea, we could deal with commentaries pretty much in the same way as with optional appendices in some conferences. One risk is the one of bias when reviewers are exposed to previous reviews and author claims in the commentary. Another risk is that a badly implemented process for commentaries would just cause more work for both program committees and authors. Maybe, I am thinking a bit too revolutionary here, but I am looking forward a system where we break out of the static nature of program committees and allow for review results and author responses to be passed on from conference to conference. I am thinking of a more social process of reviewing and revision.



CS intro != Programming intro

Yes, "CS intro != Programming intro". Of course, it is not; maybe it would never occur to you that it could!? Well, in some places, though, the CS 101 ("introduction to CS") course ends up being essentially that, at least for some initial part. In some places (Koblenz included; see my OOPM course which is under attack in this post), the CS 101 course certainly ends up trying to also introduce the basics of programming (because the lecturer thought he/she should).

Here is why I think this is wrong and I apologize for coming forward so late:

  • Teaching the trivial level of programming ("getting you going with for-loops and such" :-)) just doesn't belong at the university. Maybe it never belonged there, but it certainly doesn't belong there anymore (for like 10-20 years) because it is just such a basic skill and there is so much guidance out there (Youtube etc.) that a contemporary student wanting to study CS must (or should) simply be beyond the point of needing such a trivial introduction.
  • At a "mediocre" university like mine (not overwhelmed exactly with brilliant students like this), we may get some otherwise possibly smart students however certainly lacking the most basic programming skills. Trying to get them up to speed in a university-style course is just frustrating everyone. It certainly has bored me near to death.
As a result, I am changing my CS 101 course (11 ECTS on paper, which is crazy in itself), per immediately (effective per end of October), as follows:
  • I decouple the objective of teaching basics of programming from other aspects of the course by running two tracks in parallel for some time. I collect these other aspects of the course, which are not about basics of actual programming, as the "theory track". The "programming track" is just there for those who need it. I expect it to be skipped by some students. The theory track will not make any assumptions about previous programming skills.
  • In the theory track, I spend several weeks overall on algebraic specification with applications to abstract data types and what is maybe best called "algebraically oriented domain modeling". See my recent slide deck (.pdf), in that instance Haskell-focused, though. This is joint work with Magne Haveraaen, University of Bergen. Welcome to the university! Students need to understand algebraic signatures and logic formulae. I am going to be nice with the students :-) So I shall limited coverage to pragmatic application of loose algebraic specifications; no term algebra, no quotient algebra, no Herbrand universe, no nothing. Structural induction is in, though! Sorry.
  • As the two tracks have progressed enough, synergy happens such that we implement specifications in Java or Python. Appropriate axioms from the algebraic specifications will lend themselves as assertions and as (parametrized) unit tests. We are also well equipped to discuss design by contract. We will also be prepared to appreciate the beauty (?) of UML class diagrams with OCL constraints. Algebraic specifications and logics are everywhere.
  • Logistically, I will be working mostly without slides. Rather I will use the whiteboard and different editors. The 101wiki of the 101companies project will host code and explanations and links to Wikipedia and other online resources. I will distribute some lectures notes, but no wall of text is going to replace my previous wall of slides. I want to get across (through focused lecture note material) some basic notions and for the rest I use online resources including commented specifications and programs as well as links to Wikipedia et al.
This gets us through 2/3 of the course. The remaining 1/3 of the course will use a single, sequential timeline. I will think about it, as it gets closer, but here are some thoughts:
  • Coverage of EBNF as another modeling method. Great! There is this wonderful connection between algebraic signatures and context-free grammars. Maybe, I will do term algebras anyway and manage to bore everyone to death.
  • Very basics of complexity theory. This can be done as soon as students are fluent in basic algorithmic programming. The same is true for the very basics of program verification. Coverage of program verification (Hoare logic) will definitely benefit from dealing with logic formulae in the theory track earlier.
  • There is a bunch of non-very basic programming topics that I tend to cover such as pointers, encapsulation, interfaces, modularity, inheritance, generics, exceptions. Some order needs to be determined. I have managed in the past.

Luckily, in the second semester, I teach "introduction to functional programming".  It is, of course, wonderful (in the view of the lecturer anyway) to make the students see the connection between algebraic specification and functional programming.