Jupyter language kernel generator for DSLs developed using the Rascal Language Workbench.
To install Bacatá please use the following update site https://update.rascal-mpl.org/libs/ and select the Bacata feature.
- Install Bacatá
- Set the following environment variables.
- ECLIPSE_HOME: this variable points to the Contents folder of Eclipse.
- Example: ECLIPSE_HOME = /Applications/Eclipse\ 3.app/Contents
- JUPYTER_HOME: this variable points to the Jupyter installation.
- Example: JUPYTER_HOME = /Library/Frameworks/Python.framework/Versions/3.7/bin/jupyter
- ECLIPSE_HOME: this variable points to the Contents folder of Eclipse.
NOTE: Verify that the previous environment variables are available when you start Eclipse.
- Right click on the root of your project and initiate a Rascal Console.
- Import the Bacatá notebook module.
import bacata::Notebook_
- Create a Kernel.
k = kernel("Calc", |home:///Documents/calc/src|, "CalcREPL::myRepl", salixPath=|home:///Documents/Rascal/salix/src|, logo = |home:///calc.png|);
- Create a Notebook object.
nb = createNotebook(k);
- Start the Jupyter notebook.
nb.serve();
- After executing the previous command, you will obtain in the console the url in which Jupyter is running.
- To stop the server use the following command.
nb.stop();
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
What things you need to install the software and how to install them
Give examples
A step by step series of examples that tell you have to get a development env running
Say what the step will be
Give the example
And repeat
until finished
End with an example of getting some data out of the system or using it for a little demo
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Mauricio Verano Merino - Initial work -
- Jurgen Vinju
- Tijs van der Storm
See also the list of contributors who participated in this project.
- Hat tip to anyone who's code was used
- Inspiration
- etc
In order to execute Notebooks for DSLs using Bacatá you need to fulfill the follow prerequisites:
- Docker installation (installation guide)
- Bacatá Rascal.jar (download)
- Rascal jar (download)
In order to Dockerize a Rascal DSL, you need a Rascal DSL Project with:
- A module that defines a REPL ADT (details about REPL defitinion)
TODO
NOTE: From the command line syntactic auto-completion is not supported nor the Codemirror mode generation.
java -Drascal.path="Path to Bacatá Rascal jar" -jar <Rascal jar> bacata::Generator docker <language Name> <Path to DSL project src folder> <module that contains REPL> <binding REPL adt> <path to the language logo>
The following command will work with a DSL implemented using the Rascal Language workbench called QL.
java -Drascal.path="/Users/mveranom/Downloads/bacata-rascal.jar" -jar /Users/mveranom/Downloads/rascal.jar bacata::Generator docker qlLanguage home:///Documents/RascalProjects/QL/src lang::ql::QLREPL qlREPL home:///ql-logo.jpg
After executing this command Bacatá generates the following artifacts in the root folder of the DSL project:
- Dockerfile.
- A folder called kernel that contains other folder with the name of the language.
- kernel.json: this file contains the Jupyter Language kernel of the DSL that works with the Docker Bacata Image.
- logo-64x64.png: this file is optional and represents the logo of the language.
In order to create the Docker image that does the DSL Dockerization, the user needs to execute the following command two commands from the command line:
cd dsl-project/
docker build -t <name-of-image> .
The later command will read the Dockerfile and produces a Docker image with the DSL project source code.
<name-of-image>
: is an identifier for the Docker image.
cd Documents/RascalProjects/QL/
docker build -t qlLanguage .
Now we are going to run the Docker image built in the previous step. To run the Docker image you have to execute this command in the command line:
docker run -p <port>:8888 <image-name>
The <port>
is an available port in your machine.
The <image-name>
should be the same name used in the previous step.
After running this command, you will get some output:
output
Now, you have to follow the next two steps:
- Copy the
token
from the output - Open a browser and type
http://localhost:<port>
Then you will see an interface like this: