DepJ Interpreter
Introduction
The interpreter implements dependent classes as they are defined in the vcn calculus. In addition to the language features defined in the calculus, the interpreter implements language features that are necessary for demonstrating practical examples. In particular the following additional language features are implemented:
- Mutable instance variables: An instance of a dependent class inherits variables from all matching declarations of the class and its superclasses.
- Varying set of fields: The declarations of dependent classes may have different sets of (dispatch) fields. This is different from vcn calculus, which required that all declarations of a dependent class have the same fields.
- Distinction between methods and classes: Methods and classes are declared by different types of declarations. A method has a return type and may have a body, while a class may have superclasses. This is different from vcn, which uses a unified syntax both for classes and methods.
- Abstract classes: Some declarations of a dependent class may be marked as abstract, which means that they are not available as constructors. A constructor call of a dependent class is valid if there is a non-empty set of matching non-abstract declarations of a dependent class. Further, each field bound in the constructor call must be declarated in at least one of the matching non-abstract declarations of the class.
- Abstract methods: Some declarations of a method may be marked as abstract and do not have a body. The interpreter implements a static completeness check, which checks that all abstract method declarations are implemented for all possible concrete parameter values.
- Symmetric dispatch: The methods are selected by a symmetric dispatch strategy, which requires that for all possible parameter types a unique most specific method declaration can be selected. This uniqueness property is checked by the interpreter.
- Method refinements: A method may be marked as 'refined', which means that it does not participate in the symmetric dispatch, but instead refines the method selected by the symmetric dispatch. Multiple matching method refinements are ordered into a sequence with the method selected by the symmetric dispatch at the end of the sequence. A method refinement can call the next expression in the sequence by the 'super' keyword.
- Modules: Declarations of dependent classes and methods can be distributed in multiple modules. A module may import other modules. The import relationship between modules is transitive. A module and all its imported modules must consistute a valid program, which means that type-checking must succeed, including the checks for completeness and uniqueness properties.
- Nested declarations: Class and method declarations can be nested within other class declarations. The nested declarations are equivalent to corresponding external declarations, that have an additional field 'out' with the type equivalent to the signature of the enclosing class.
- Local variables: Local variables can be declarated at the beginning of each block.
- Control statements: The usual 'if' and 'while' statements are supported.
- Java types: Standard Java types, the types in java.lang and java.lang.util packages and primitive types, are supported.
- Literals: Some of the Java literals are supported: strings, decimal numbers and boolean values
- Java methods: Calls to Java methods are supported. The method name must be included between vertical bars, e.g. obj.|toString|().
Download
Running the Interpreter
The interpreter requires an installation of Java 6. The interpreter is launched through its main class org.tud.depclsj.DepClsJ, located in depclsj.jar. The class takes the source files as arguments. On Windows you can also run 'dcj.bat', which simply starts the main class with the given arguments.
The interpreter starts by type checking all modules. If the type checking is successful the interpreter looks for the 'main()' method and executes it.
The interpreter archive contains several folders with examples. Each example folder contains 'run.bat' file, which runs the example.

