Search code examples
rascal

Setting up a Rascal example project


How do I setup a Rascal-MPL project to consume the DSL built with Rascal?

I don't seem to find any resource that details how to solve that particular problem


Solution

  • The documentation hasn't been written for that case but here goes:

    • Use newRascalProject from util::Reflective to create a basic setup. For both the DSL project and the consuming project that makes sense.
    • mvn install in the DSL project, if you won't have the DSL project folder open in Eclipse or VScode or if you are working bare bones Unix/Maven.
    • In RASCAL.MF of the client project add Require-Libraries: |lib://dsl-project|
    • In pom.xml of the client project add a dependency on the DSL jar.
    • Restart the console or terminal for a file of the client project.

    In the terminal the active version of the path configuration for the interpreter will be printed. It should have the DSL project in the list of srcs.

    In VScode log for the Rascal LSP you can see the path configuration printed when compiling/checking source files in the client project. There the DSL project should be in the libs path.

    If the DSL project isn't compiled to .tpl files that appear in the target folder and eventually in the jar, you will get spurious error messages in the client code. In that case trigger the compiler in the DSL project by saving the top module, or run mvn install again. Revisit the pom file for the settings of the rascal-maven-plugin