Skip to content
Snippets Groups Projects
Commit 06427258 authored by René Schöne's avatar René Schöne
Browse files

Move grammar2uml to separate repository

- also use mkdocs for pages, include ragdoc
parent b9eff203
No related branches found
No related tags found
1 merge request!60.3.6
Pipeline #12727 failed
......@@ -66,36 +66,22 @@ If you want to build the tools of `Relast2Uml` from source, first build the jar
git clone https://git-st.inf.tu-dresden.de/jastadd/relast2uml.git
cd relast2uml
./gradlew jar
ls grammar2uml/build/libs/ dumpAst/build/libs/ dumpAstWithPlantuml/build/libs/
ls dumpAst/build/libs/ dumpAstWithPlantuml/build/libs/
```
Those JARs can then be copied to your project, e.g. for grammar2uml.
Those JARs can then be copied to your project.
```bash
cp grammar2uml/build/libs/grammar2uml-<version>.jar ../your-project/libs/grammar2uml.jar
cp dumpAst/build/libs/dumpAst-<version>.jar ../your-project/libs/dumpAst.jar
cd ../your-project/
```
Finally, this JAR has to be integrated into your build process. In case, [Gradle](https://gradle.org/) is used, the JAR file needs to be added as dependency using:
Finally, this JAR has to be integrated into your build process. In case [Gradle](https://gradle.org/) is used, the JAR file needs to be added as dependency using:
```groovy
dependencies {
implementation fileTree(include: ['grammar2uml.jar'], dir: 'libs')
implementation fileTree(include: ['dumpAst.jar'], dir: 'libs')
}
```
The path to the JAR file may need to be changed according to your project structure.
In case of `grammar2uml` a task needs to be created, similar to the one defined [above](#grammar2uml).
```groovy
task grammar2uml(type: JavaExec) {
main = '-jar'
args([
'../libs/grammar2uml.jar',
'--verbose',
'src/main/jastadd/GoalModel.relast'
])
}
```
......@@ -2,7 +2,7 @@
The tool called `DumpAst` ([see in repo](https://git-st.inf.tu-dresden.de/jastadd/relast2uml/-/tree/master/dumpAst)) is used to create a snapshot of an AST and visualize it.
![](_static/dumpAst.png)
![](img/dumpAst.png)
It has to be used within your application code, and comes with a fluent interface to add and/or filter parts of the AST.
First, import the entry point class `Dumper`
......
File moved
# Grammar2Uml
The tool called `Grammar2Uml` ([see in repo](https://git-st.inf.tu-dresden.de/jastadd/relast2uml/-/tree/master/grammar2uml)) takes a set of grammar specifications and creates a visualization similar to UML class diagrams.
![](_static/grammar2uml.png)
![](_static/minimal-example.png)
Every nonterminal will be shown as a rectangular box with its terminal children listed within it. Children are shown as containment relations between parent and child, whereas relations and intrinsic references are shown using arrows.
Furthermore, some options may be specified.
| Name | Required (Default) | Description |
|----------------------|--------------------|-------------------------------------------------------------------------|
| `--output` | No (`uml.md`) | target file to be generated. |
| `--inputGrammar2Uml` | No | grammar2uml definition file, see [below](#grammar2uml-definition-file). |
| `--defaultFolders` | No (`false`) | Creates a default folder per grammar file. |
| `--help` | No | Print usage and exit. |
| `--version` | No | Print version and exit. |
| `--verbose` | No | Print more messages while compiling. |
## Grammar2uml definition file
To structure the generated visualization, any number of nonterminals can be grouped with folders.
Either specify the option `--defaultFolders` to use one folder per input grammar file, or specify a grammar2uml definition file.
The definition file has a simple syntax, it is a list of folder specifications. One specifications looks like
```
folder FOLDER_NAME : NT1, NT2, ..., NT_n
```
It produces one folder named `FOLDER_NAME` containing all nonterminals (`NT1`, `NT2`, ..., `NT_n`) following it.
.. Relast2Uml documentation master file, created by
sphinx-quickstart on Thu Jan 14 17:56:50 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Relast2Uml Documentation
========================
`Relast2Uml <https://git-st.inf.tu-dresden.de/jastadd/relast2uml>`_ is a collection of tools to visualize specifications and programs using models based on `Reference Attribute Grammars <http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.108.8792&rep=rep1&type=pdf>`_ and `Relation Reference Attribute Grammars <https://doi.org/10.1016/j.cola.2019.100940>`_ built with `JastAdd <http://jastadd.org/>`_.
.. toctree::
:maxdepth: 2
:caption: Contents:
dumpAst.md
grammar2uml.md
adding.md
Indices and tables
==================
* :ref:`genindex`
* :ref:`search`
import os
dumpAstVersionFileName = '../dumpAst/src/main/resources/dumpAstVersion.properties'
def get_version():
if os.environ.get('CI_COMMIT_BRANCH', 'unknown') == 'dev':
return 'dev'
with open(dumpAstVersionFileName) as dumpAstVersionFile:
versionFileContent = dumpAstVersionFile.read()
return versionFileContent[versionFileContent.rindex('version=') + 8:].strip()
def define_env(env):
"""
This is the hook for defining variables, macros and filters
- variables: the dictionary that contains the environment variables
- macro: a decorator function, to declare a macro.
"""
env.conf['site_name'] = 'dumpAst ' + get_version()
@env.macro
def dumpAst_version():
return get_version()
if __name__ == '__main__':
print(get_version())
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd
site_name: DumpAst
repo_url: https://git-st.inf.tu-dresden.de/jastadd/relast2uml
site_dir: ../public
nav:
- "DumpAst": dumpAst.md
- "Add to your project": adding.md
- "API documentation": ragdoc/index.html
theme:
name: readthedocs
custom_dir: custom_theme/
markdown_extensions:
- toc:
permalink:
- admonition
plugins:
- search
- git-revision-date-localized:
type: datetime
timezone: Europe/Berlin
locale: en
fallback_to_build_date: True
- macros
mkdocs==1.2.2
mkdocs-git-revision-date-localized-plugin==0.10.3
mkdocs-macros-plugin==0.6.3
rootProject.name = 'relast2uml'
include 'relast.preprocessor'
include 'grammar2uml'
include 'dumpAst'
include 'dumpAstWithPlantuml'
include 'testDumper'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment