I am about to implement a domain specific language for representation of social learning conventions. Part of the implementation is a formal description of a language - its 'calculus', symbols and logical expressions.

My approach would be to describe the language by describing its grammar but there are also concepts such as relations, dialogs, expectations that require more theoretic approach and the description of the logic.

I would like to ask for an example and a literature recommendation (papers, books) that would help me with this description. I feel relatively competent approaching this task so I am not asking for a total hand holding, but help from a theoretician in this area would be GREATLY appreciated.

  • $\begingroup$ The sounds really really interesting. Describing the grammar is the easy bit. Providing semantics for domain specific concepts is very much an open research area. You could start by googling: "semantics domain specific languages". $\endgroup$ – Dave Clarke Aug 24 '12 at 15:10
  • $\begingroup$ What do you already know about writing formal language semantics? $\endgroup$ – Dave Clarke Aug 24 '12 at 18:00

There are two parts of the semantics you will need to describe:

  • static semantics: structure of well formed programs

  • dynamic semantics: meaning of running programmings

Static semantics usually take the form of type systems. I'd recommend looking at the books by Benjamin C Pierce and Robert Harper. Alternatively, you could write the rules of well-formed programs as a collection of (formal or informal) statements describing the validity conditions of your program. The formal approach taken by type systems provides a well-known framework for such specifications.

There are many formalisms for expressing the dynamic semantics to consider as your basis:

  • denotational semantics --- gives meaning in terms of semantic domains
  • operational semantics --- gives meaning in terms changes to an abstract machine states
  • axiomatic semantics --- gives meaning in terms of assertions about the state of the machine
  • algebraic semantics --- semantics is defined in terms of algebraic laws.

There should be plenty of books out there on these topics. A good broad introductory one is Nielson and Nielson's Semantics with Applications. A downloadable version is available from the authors' site. There is also a newer edition, but I haven't seen it.

Within each of these, there are choices to make. For example, if you decide to use operational semantics, there are large-step semantics, small step semantics, semantics based on labelled transition systems, semantics based on rewriting logic.

What kind of approach you should take will depend on what kind of language your DSL is, what kind of experience you have with designing semantics, and your personal preference.

Without any concrete details, I can help no further.

| cite | improve this answer | |
  • $\begingroup$ @Edmon I'd be interested to learn more. $\endgroup$ – Dave Clarke Aug 27 '12 at 6:41
  • $\begingroup$ I will certainly share as I progress. I might do it on my blog and also engage you and the rest of the community here as I encounter areas that I need help with. Thanks for the great answer. $\endgroup$ – Edmon Aug 30 '12 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.