From 5429e9a9e6b2d6eea01328e03f01b71d1964e1ac Mon Sep 17 00:00:00 2001
From: rschoene <rene.schoene@tu-dresden.de>
Date: Thu, 2 Dec 2021 17:00:13 +0100
Subject: [PATCH] working on concise grammar

- rename intermediate grammar and aspect files
- updated documentation
---
 pages/docs/inner-workings.md                  | 20 ++++++++++++-------
 ragconnect.base/build.gradle                  |  2 +-
 .../Generation.jadd => Intermediate.jadd}     |  0
 ...stacheNodes.relast => Intermediate.relast} |  0
 ...desToYAML.jrag => IntermediateToYAML.jrag} |  2 +-
 .../jastadd/{intermediate => }/Mappings.jrag  |  0
 6 files changed, 15 insertions(+), 9 deletions(-)
 rename ragconnect.base/src/main/jastadd/{intermediate/Generation.jadd => Intermediate.jadd} (100%)
 rename ragconnect.base/src/main/jastadd/{intermediate/MustacheNodes.relast => Intermediate.relast} (100%)
 rename ragconnect.base/src/main/jastadd/{intermediate2mustache/MustacheNodesToYAML.jrag => IntermediateToYAML.jrag} (99%)
 rename ragconnect.base/src/main/jastadd/{intermediate => }/Mappings.jrag (100%)

diff --git a/pages/docs/inner-workings.md b/pages/docs/inner-workings.md
index 6d8b41e..a36a626 100644
--- a/pages/docs/inner-workings.md
+++ b/pages/docs/inner-workings.md
@@ -4,12 +4,18 @@ Please see [API documentation](ragdoc/index.html) for more details.
 
 ![ros2rag-process](img/ros2rag-process.png)
 
-`RagConnect` uses the [relast-preprocessor](https://git-st.inf.tu-dresden.de/jastadd/relast-preprocessor) to parse `.relast` grammar files. This results in an ASTNode of type `Program`.
-It further uses a dedicated parser for `.connect` files containing endpoint-, mapping-, and dependency-definitions. This results in an ASTNode of type `RagConnect`.
+`RagConnect` uses the [relast-preprocessor](https://git-st.inf.tu-dresden.de/jastadd/relast-preprocessor) to parse `.relast` grammar files.
+This results in an ASTNode of type `Program`.
+It further uses a dedicated parser for `.connect` files containing endpoint-, mapping-, and dependency-definitions.
+This results in an ASTNode of type `RagConnect`.
 The goal is to generate an aspect file containing setters and getters of tokens referred to by endpoint-definitions
-We use [mustache](https://mustache.github.io/) (currently its [Java version](https://github.com/spullara/mustache.java)) making use of partials resulting in a set of `.mustache` files located in `ragconnect.base/src/main/resources`.
-The generation process uses an intermediate NTA of type `MRagConnect` defined in `MustacheNodes.relast` to separate this generation concern from the content of the DSL
+We use [mustache](https://mustache.github.io/) (currently its [Java version](https://github.com/spullara/mustache.java)) making use of partials to separate concerns.
+The `.mustache` files are located in `ragconnect.base/src/main/resources`.
+The generation process uses intermediates NTAs (whose types are defined in `Intermediate.relast`) to ease the definition of two main generation "problems".
+Those problems are differentiation on both kinds of an endpoint (send/receive and type/token/list), and attributes depending on position in n-ary relations.
 
-There are aspect files for `Navigation` (mainly isX/asX attributes), `Analysis` (lookup attributes), `Printing`, `backend/Mappings` (default mappings)
-One of the main aspects is `backend/Generation` containing attributes to construct the `MRagConnect` NTA and all necessary attributes used within the mustache templates
-The other main aspect (which is currently not really used) is `backend/MustacheNodesToYAML.jrag` containing the transformation from a `MRagConnect` subtree to a `Document` subtree defined by `YAML.relast`. This is used to generate a YAML file containing the data used by mustache. It can be used by the default mustache implementation together with the templates.
+There are aspect files for `Navigation` (mainly isX/asX attributes), `Analysis` (static analysis attributes), `Printing`, `Mappings` (default mappings).
+One of the main aspects is `Intermediate` containing all attributes consumed by `mustache` and other attributes the former depend on.
+The other main aspect (which is currently not really used) is `IntermediateToYAML` containing the transformation from a `RagConnect` subtree to a `Document` subtree defined by `Mustache.relast` (located in `relast-preprocessor` submodule).
+This is used to generate a YAML file containing the data used by mustache.
+It can be used by the default mustache implementation together with the templates.
diff --git a/ragconnect.base/build.gradle b/ragconnect.base/build.gradle
index f831f53..f039c8b 100644
--- a/ragconnect.base/build.gradle
+++ b/ragconnect.base/build.gradle
@@ -86,7 +86,7 @@ jar {
 
 File preprocessorGrammar = file('../relast-preprocessor/src/main/jastadd/RelAst.relast')
 File ragConnectGrammar = file('./src/main/jastadd/RagConnect.relast')
-File intermediateGrammar = file('./src/main/jastadd/intermediate/MustacheNodes.relast')
+File intermediateGrammar = file('./src/main/jastadd/Intermediate.relast')
 File mustacheGrammar = file('../relast-preprocessor/src/main/jastadd/mustache/Mustache.relast')
 task relast(type: JavaExec) {
     group = 'Build'
diff --git a/ragconnect.base/src/main/jastadd/intermediate/Generation.jadd b/ragconnect.base/src/main/jastadd/Intermediate.jadd
similarity index 100%
rename from ragconnect.base/src/main/jastadd/intermediate/Generation.jadd
rename to ragconnect.base/src/main/jastadd/Intermediate.jadd
diff --git a/ragconnect.base/src/main/jastadd/intermediate/MustacheNodes.relast b/ragconnect.base/src/main/jastadd/Intermediate.relast
similarity index 100%
rename from ragconnect.base/src/main/jastadd/intermediate/MustacheNodes.relast
rename to ragconnect.base/src/main/jastadd/Intermediate.relast
diff --git a/ragconnect.base/src/main/jastadd/intermediate2mustache/MustacheNodesToYAML.jrag b/ragconnect.base/src/main/jastadd/IntermediateToYAML.jrag
similarity index 99%
rename from ragconnect.base/src/main/jastadd/intermediate2mustache/MustacheNodesToYAML.jrag
rename to ragconnect.base/src/main/jastadd/IntermediateToYAML.jrag
index cfe83bb..67ccf27 100644
--- a/ragconnect.base/src/main/jastadd/intermediate2mustache/MustacheNodesToYAML.jrag
+++ b/ragconnect.base/src/main/jastadd/IntermediateToYAML.jrag
@@ -1,4 +1,4 @@
-aspect MustacheNodesToYAML {
+aspect IntermediateToYAML {
   syn Document RagConnect.toYAML() {
     Document doc = new Document();
     MappingElement root = new MappingElement();
diff --git a/ragconnect.base/src/main/jastadd/intermediate/Mappings.jrag b/ragconnect.base/src/main/jastadd/Mappings.jrag
similarity index 100%
rename from ragconnect.base/src/main/jastadd/intermediate/Mappings.jrag
rename to ragconnect.base/src/main/jastadd/Mappings.jrag
-- 
GitLab