SLE course at University of Groningen
Software Language Engineering (SLE) is concerned with the principled techniques and concepts for the construction of software languages. Software languages come in many shapes and sizes, including programming languages, modeling languages, data format languages, specification languages etc. In this course you will get acquainted with the basic techniques and concepts of language engineering, and acquire the basic skills to define the syntax and semantics of software languages, as well as know the relevant tools and techniques for implementing various kinds of language processors. The course consists of a series of lectures based on the book on SLE by Ralf Lämmel. During the course you will develop a simple domain-specific language (DSL) using the metaprogramming language Rascal, exercising both foundational and practical aspects of SLE. The final exam will test individual knowledge regarding the key concepts of SLE.
Contact: Tijs van der Storm storm@cwi.nl
This page: https://cwi-swat.github.io/sle-rug/
Book: Software Languages: Syntax, Semantics, and Metaprogramming, by Ralf Lämmel. The book is for sale here: Springer, Amazon FREE E-book: https://rug.on.worldcat.org/oclc/1036771828.
Detailed schedule: rooster.rug.nl
If you haven’t done so, install VS Code, and install the Rascal VS Code plugin from the extension pane. Documentation is here: Rascal Docs.
Fork the sle-rug repository, add the folder to your VS Code workspace, and check out the provided modules in src
for detailed instructions for the exercises from week 2 on.
Syntax
)AST
, CST2AST
and Resolve
)Check
)Eval
)Compile
)Transform
)The lab assignment is based on the Language Workbench Challenge 2013. The goal of the assignment is to build a DSL for questionnaires, called QL. QL allows you to define simple forms with conditions and computed values.
Here is some more detail:
The QL syntax consists of a form, containing questions. A question can be a normal question, or a computed question. A computed question has an associated expression which defines its value. Both kinds of questions have a label (to show to the user), an identifier, and a type. The conditional construct comes in two variants if
and if-else
. A block construct using {}
can be used to group questions.
Questions are enabled and disabled when different values are entered, depending on their conditional context.
The language supports booleans, integers and string types .
Here’s a simple questionnaire in QL from the domain of tax filing:
form taxOfficeExample {
"Did you sell a house in 2010?"
hasSoldHouse: boolean
"Did you buy a house in 2010?"
hasBoughtHouse: boolean
"Did you enter a loan?"
hasMaintLoan: boolean
if (hasSoldHouse) {
"What was the selling price?"
sellingPrice: integer
"Private debts for the sold house:"
privateDebt: integer
"Value residue:"
valueResidue: integer =
(sellingPrice - privateDebt)
}
}