Creating a textual domain-specific language

OData support
Dr. Mezei Gergely
Department of Automation and Applied Informatics

Configurability is a very important aspect of each widely used application since that is what makes the application flexible. The structure of a configuration file can be defined in many ways, but there are formats which are widely known and used, for example the XML and the JSON formats. For reading files given in XML or JSON format, the developer can use any publicly available library. These libraries usually give a decent feedback about syntax errors in the file, but they cannot give feedback about how much sense the configuration makes from the perspective of the application. Therefore, the editor of the configuration file must know what the type and value restrictions regarding the fields are and what the dependencies between the fields are in order to write an understandable and valid configuration for the application. In case of big and complex configuration files this task may become very hard.

The language and its interpreter created by me and discussed in this thesis provide a solution to the previously described issue. By using my solution, it becomes possible to validate JSON configurations semantically. I have created the language using ANTLR framework and wrote an interpreter for it in Java. The result is a Java 8 library with which semantic dependencies can be easily described for a JSON file and those dependencies can be easily validated against any JSON document. By using the language, type and value restrictions and relations between JSON nodes can be defined. The return value of the interpreter is an object with which any number of JSON files can be validated.


Please sign in to download the files of this thesis.