Skip to content

Commit 6d769ec

Browse files
committed
doc: add documentation to make clear how dashes are used in filenames
1 parent 51a9bc7 commit 6d769ec

File tree

1 file changed

+32
-20
lines changed

1 file changed

+32
-20
lines changed

README.md

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# UVL - Universal Variability Language
2+
23
This is a small default library used to parse and print the Universal Variability Language (UVL).
34

45
Under the hood it uses [ANTLR4](https://www.antlr.org/) as the parsing library.
@@ -9,16 +10,22 @@ The grammar in EBNF form is located in `uvl/UVL.g4` and the modifications for Ja
910
On a high level, each feature model in UVL consists of five optional separated elements:
1011

1112
1. **A list of used language levels**
12-
The model can use different concepts which are part of language levels. These levels can either be enumerated with the `include` keyword or be implicit.
13+
The model can use different concepts which are part of language levels. These levels can either be enumerated with the `include` keyword or be implicit.
1314
2. **A namespace which can be used for references in other models**
1415
3. **A list of imports that can be used to reference external feature models**
15-
The models are referenced by their file name and can be given an alias using a Java import like syntax.
16-
External models in subdirectories can be referenced like this: subdir.filename as fn
16+
The models are referenced by their file name and can be given an alias using a Java import like syntax. If the filename contains atypcial symbols like `"-"` the filename needs to be in exclamation marks. External models in subdirectories can be referenced like this:
17+
18+
```UVL
19+
imports
20+
subdir.filename as fn
21+
otherdir."file-name"
22+
```
23+
1724
4. **The tree hierarchy consisting of: features, group types, and attributes whose relations are specified using nesting (indentation)**
18-
Groups may have an arbitrary number of features as child nodes. A feature can also have a feature cardinality.
19-
Attributes consist of a key-value pair whose key is always a string and its value may be a boolean, number, string, a list attributes, a vector, or a constraint. If the value is a constraint the key must be `constraint`. If the value is a list of constraints the key must be `constraints`
25+
Groups may have an arbitrary number of features as child nodes. A feature can also have a feature cardinality.
26+
Attributes consist of a key-value pair whose key is always a string and its value may be a boolean, number, string, a list attributes, a vector, or a constraint. If the value is a constraint the key must be `constraint`. If the value is a list of constraints the key must be `constraints`
2027
5. **Cross-tree constraints**
21-
Cross-tree constraints may be arbitrary propositional formulas with the following symbols: => (implies), <=> (iff), & (and), | (or), ! (not), or brackets. Through the usage of language levels cross-tree constraints can also contain equations (<,>,==) which consist of expressions (+,-,*,/) with numbers or numerical feature attributes as literals and aggregate functions (avg, sum).
28+
Cross-tree constraints may be arbitrary propositional formulas with the following symbols: => (implies), <=> (iff), & (and), | (or), ! (not), or brackets. Through the usage of language levels cross-tree constraints can also contain equations (<,>,==) which consist of expressions (+,-,\*,/) with numbers or numerical feature attributes as literals and aggregate functions (avg, sum).
2229

2330
The following snippet shows a simplified server architecture in UVL. We provide more examples (e.g., to show the composition mechanism) in [https://github.com/Universal-Variability-Language/uvl-models/tree/main/Feature_Models](https://github.com/Universal-Variability-Language/uvl-models/tree/main/Feature_Models).
2431

@@ -50,25 +57,28 @@ constraints
5057
```
5158

5259
In this snippet, we can recognize the following elements:
53-
* The feature `Server` is abstract (i.e., corresponds to no implementation artifact.
54-
* Each `Server` requires a `FileSystem`and an `OperatingSystem` denoted by the *mandatory* group
55-
* The `Server` may have `Logging` denoted by the *optional* group
56-
* A `FileSystem` requires at least one type of `NTFS`, `APFS`, and `Ext4` denoted by the *or* group
57-
* An `OperatingSystem` has exactly one type of `Windows`, `macOS`, and `Debian`denoted by the *alternative* group
58-
* `Logging` has the feature attribute `log_level` attached which is set to "warn"
59-
* `Windows` requires `NTFS` denoted by the first cross-tree constraint
60-
* `macOS`requires `APFS`
60+
61+
- The feature `Server` is abstract (i.e., corresponds to no implementation artifact.
62+
- Each `Server` requires a `FileSystem`and an `OperatingSystem` denoted by the _mandatory_ group
63+
- The `Server` may have `Logging` denoted by the _optional_ group
64+
- A `FileSystem` requires at least one type of `NTFS`, `APFS`, and `Ext4` denoted by the _or_ group
65+
- An `OperatingSystem` has exactly one type of `Windows`, `macOS`, and `Debian`denoted by the _alternative_ group
66+
- `Logging` has the feature attribute `log_level` attached which is set to "warn"
67+
- `Windows` requires `NTFS` denoted by the first cross-tree constraint
68+
- `macOS`requires `APFS`
6169

6270
## Building a jar
6371

6472
The library is a maven project and can therefore be build with maven. To update the generated parser classes and create a jar with all necessary dependencies, use:
73+
6574
```
6675
mvn clean compile assembly:single
6776
```
6877

6978
The `target/uvl-parser-1.0-SNAPSHOT-jar-with-dependencies.jar` includes all dependencies.
7079

7180
## Usage from Java
81+
7282
The class `de.vill.main.UVLModelFactory` exposes the static method `parse(String)` which will return an instance of a `de.vill.model.FeatureModel` class. If there is something wrong, a `de.vill.exception.ParseError` is thrown. The parser tries to parse the whole model, even if there are errors. If there are multiple errors, a `de.vill.exception.ParseErrorList` is returned which contains all errors that occurred.
7383
A model can be printed with the `toString()` method of the `de.vill.model.FeatureModel` object.
7484
The following snippet shows a minimal example to read and write UVL models using the jar. More usage examples that also show how to use the acquired UVLModel object can be found in [src/main/java/de/vill/main/Example.java](https://github.com/Universal-Variability-Language/uvl-parser2.0/blob/main/src/main/java/de/vill/main/Example.java)
@@ -85,17 +95,19 @@ FeatureModel featureModel = uvlModelFactory.parse(content);
8595
String uvlModel = featureModel.toString();
8696
Path filePath = Paths.get(featureModel.getNamespace() + ".uvl");
8797
Files.write(filePath, uvlModel.getBytes());
88-
```
98+
```
8999

90100
## Links
101+
91102
UVL models:
92-
* https://github.com/Universal-Variability-Language/uvl-models
103+
104+
- https://github.com/Universal-Variability-Language/uvl-models
93105

94106
Other parsers:
95-
* https://github.com/Universal-Variability-Language/uvl-parser *deprecated, Initial UVL Parser, based on Clojure and instaparse* **UVL-Parser**
96-
* https://github.com/diverso-lab/uvl-diverso/ *Under development, Antlr4 Parser* **Diverso Lab**
97107

98-
Usage of UVL:
99-
* https://github.com/FeatureIDE/FeatureIDE *Feature modelling tool*
108+
- https://github.com/Universal-Variability-Language/uvl-parser _deprecated, Initial UVL Parser, based on Clojure and instaparse_ **UVL-Parser**
109+
- https://github.com/diverso-lab/uvl-diverso/ _Under development, Antlr4 Parser_ **Diverso Lab**
100110

111+
Usage of UVL:
101112

113+
- https://github.com/FeatureIDE/FeatureIDE _Feature modelling tool_

0 commit comments

Comments
 (0)