You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+63-55Lines changed: 63 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ When run in a terminal, our demo will show a translation roundtrip, showcasing t
31
31
32
32
Vatras is a library to study and compare meta-languages for specifying variability in source code and data.
33
33
Some software systems are configurable _before_ they are compiled, i.e., statically.
34
-
A common way example for implementing static variability is by conditional compilation, as for example possible with the C preprocessor.
34
+
A common way to implement static variability is by conditional compilation, as for example possible with the C preprocessor.
35
35
For instance, the following [code snippet from the Linux kernel](https://github.com/torvalds/linux/blob/e271ed52b344ac02d4581286961d0c40acc54c03/include/linux/console.h#L479-L486)
36
36
37
37
```C
@@ -140,9 +140,9 @@ We tested our setup on Manjaro, NixOS, Windows Subsystem for Linux (WSL2), and w
140
140
> In case of problems, there is a "Troubleshooting" section at the bottom of this file.
141
141
142
142
### Setup
143
-
Clone the library and its submodules to a directory of your choice:
There are **three alternative ways** to compile the library and run its small demo.
@@ -153,14 +153,14 @@ In general, we **recommend Nix** because it creates a sandbox environment with a
153
153
- For **Mac** users, we recommend Nix or Docker. (We experienced problems with installing Agda manually.)
154
154
- For **Linux** users, any alternative is fine but we recommend Nix for the reasons mentioned above.
155
155
156
-
There are no other software requirements apart from having either Nix, Docker, or Agda installed, depending on which alternative you choose..
157
-
The only dependency of our library is the Agda standard library which is shipped as a git submodule within the `agda-stdlib` directory and is taken care of automatically by our [makefile](makefile).
156
+
There are no other software requirements apart from having either Nix, Docker, or Agda installed, depending on which alternative you choose.
157
+
The only dependency of our library is the Agda standard library which is automatically taken care of by our Nix and Docker setups.
158
158
159
159
Note that building for the first time (or running `nix-shell`) will take a while because Agda has to build the required dependencies from the standard library (expect ~5-10min and a lot of terminal output).
160
160
161
161
#### Alternative 1: Setup via Nix
162
162
163
-
The installation of Nix depends on your operating system. Head to the [NixOS website](https://nixos.org/download/) and follow the installation instructions for your system. Follow the download instructions for `Nix: the package manager`, not `NixOS: the Linux distribution`! Note that Nix is not directly available for Windows but it can be used from within Windows Subsystem for Linux (WSL2). When you open a WSL2 terminal terminal, you can install Nix by following the instructions for installing Nix on linux from the [NixOS website](https://nixos.org/download/).
163
+
The installation of Nix depends on your operating system. Head to the [NixOS website](https://nixos.org/download/) and follow the installation instructions for your system. Follow the download instructions for `Nix: the package manager`, not `NixOS: the Linux distribution`! Note that Nix is not directly available for Windows but it can be used from within Windows Subsystem for Linux (WSL2). When you open a WSL2 terminal, you can install Nix by following the instructions for installing Nix on Linux from the [NixOS website](https://nixos.org/download/).
164
164
165
165
When you have Nix installed on your system, open a terminal, navigate to this directory, and then simply open a Nix shell by typing
166
166
```shell
@@ -171,7 +171,7 @@ To compile the library and run the demo, simply run make:
171
171
```shell
172
172
make
173
173
```
174
-
The expected output is explained in detail in the Step-by-Step guide below.
174
+
The expected output is explained in detail in the [Expected Output section](#expected-output) below.
175
175
176
176
Alternatively, the demo can be compiled locally to `./result/bin`.
177
177
```shell
@@ -189,7 +189,7 @@ How to install Docker depends on your operating system. **For Windows or Mac**,
189
189
Once you have installed Docker, start the Docker daemon.
190
190
**On Windows**, open the search bar using the 'Windows Key' and search for 'Docker' or 'Docker Desktop'.
191
191
**On Linux**, the docker daemon typically runs automatically, so there is nothing to do; otherwise, start Docker's service using your service manager (e.g., with `systemd`, execute `sudo systemctl start docker`).
192
-
More detailed instructions on starting the deamon are given [here](https://docs.docker.com/config/daemon/start/) on the docker website.
192
+
More detailed instructions on starting the deamon are given [on the docker website](https://docs.docker.com/config/daemon/start/).
193
193
194
194
Afterwards, open a terminal and navigate to this repository's directory (the directory containing this README.md).
195
195
First, you must create the docker image:
@@ -210,7 +210,7 @@ docker run -t vatras
210
210
211
211
#### Alternative 3: Manual Setup
212
212
213
-
The library needs Agda version 2.6.4.3 (newer version should also work but we did not test them).
213
+
The library needs Agda version 2.8.0 (newer version should also work but we did not test them).
214
214
There are different ways to install Agda.
215
215
Following the [Agda book's installation instructions], we recommend using [GHCup][ghcup] to install GHC, Cabal, and Agda as follows (You may skip steps for tools you have already installed but there might be compatibility errors with some versions):
216
216
@@ -222,27 +222,36 @@ Following the [Agda book's installation instructions], we recommend using [GHCup
222
222
1. Install the GHC compiler and the cabal build tool with [GHCup][ghcup].
223
223
224
224
```shell
225
-
ghcup install ghc 9.2.4
225
+
ghcup install ghc 9.12.2
226
226
ghcup install cabal recommended
227
227
228
-
ghcup set ghc 9.2.4
228
+
ghcup set ghc 9.12.2
229
229
ghcup set cabal recommended
230
230
```
231
231
232
232
2. Install Agda (this may take a while).
233
233
234
234
```shell
235
235
cabal update
236
-
cabal install Agda-2.6.4.3
236
+
cabal install Agda-2.8.0
237
237
```
238
238
239
239
To test whether the installation worked or whether your existing installation of Agda has the right version you can check the following command's output:
240
240
```shell
241
241
> agda --version
242
-
Agda version 2.6.4.3
242
+
Agda version 2.8.0
243
243
```
244
+
245
+
3. Install the [Agda standard library](https://github.com/agda/agda-stdlib) version 2.3.
In case of confusion or trouble, we recommend to check the [official installation instructions](https://agda.readthedocs.io/en/v2.6.4.3/getting-started/installation.html), or follow the Getting-Started guide in the [Programming Language Foundations in Agda][plfa] book, or use the Nix setup, or check the troubleshooting instructions at the bottom of this file.
254
+
In case of confusion or trouble, we recommend to check the [official installation instructions](https://agda.readthedocs.io/en/v2.8.0/getting-started/installation.html), or follow the Getting-Started guide in the [Programming Language Foundations in Agda][plfa] book, or use the Nix setup, or check the troubleshooting instructions at the bottom of this file.
246
255
247
256
To test whether your setup is correct, and to run the demo you may use our makefile.
248
257
Make sure your terminal is in full-screen because the demo assumes to have at least 100 characters of horizontal space in the terminal for pretty-printing.
@@ -251,28 +260,12 @@ Then run
251
260
make
252
261
```
253
262
which will compile the library and run its small demo.
254
-
The expected output is explained in detail in the Step-by-Step guide below.
255
-
256
-
## Step-by-Step Guide
257
-
258
-
The "Kick-The-Tires" section above basically explains all necessary steps to get the library up and running.
259
-
Here, we give additional instructions on the expected output and how to play with other demo inputs.
260
-
For using the library once you finished the setup, please have a look at the later _Reusability Guide_, which, among other
261
-
information, includes an overview of the library, notes on our mechanized proofs, and tutorials for getting to know the library.
262
-
263
-
### How does the demo know which standard library to use?
264
-
265
-
Agda looks for its dependencies in a directory specified by the environment variable `AGDA_DIR`. The provided [makefile](makefile) sets this environment variable temporarily and locally during the build process to the `.libs` directory within this repository. (Your global setup will not be affected). If you want to run `agda` manually, or if you want to work on this project in an editor (e.g., emacs) then you have to set this environment variable to the libs directory in this repository.
266
-
267
-
```shell
268
-
export AGDA_DIR="path/to/this/repository/libs"
269
-
```
263
+
The expected output is explained in detail in the [Expected Output section](#expected-output) below.
270
264
271
-
Beware that setting the variable will overwrite any previously set directory. In that case you might want to overwrite the variable only temporarily while working on this project.
272
265
273
-
### Expected Output
266
+
#### Expected Output
274
267
275
-
The demo will print a long terminal output of about 1250 lines.
268
+
The demo will print a long terminal output of very rougly 1000 lines.
276
269
A copy of the expected output can be found in the [expected-output.txt](expected-output.txt).
277
270
278
271
First, the demo prints unicode characters to terminal, as a test for you to see whether your terminal supports unicode.
@@ -358,9 +351,21 @@ Then add your new list to the `examples` list at the bottom of the file.
358
351
359
352
### Using our library in your own Agda projects
360
353
354
+
In order to use Vatras in your project, you need to state `Vatras` as a dependency in your Agda library file.
355
+
An Agda library file has the suffix `.agda-lib` and is usually contained in the root directory of your project.
356
+
Its content, including the dependency to Vatras, should include the following:
357
+
```
358
+
name: YOUR-PROJECT-NAME
359
+
depend: Vatras
360
+
include: SOME/PATH/IN/YOUR/PROJECT
361
+
```
362
+
For details about Agda's library management, please have a look at [Agda's packaging guide](https://agda.readthedocs.io/en/v2.8.0/tools/package-system.html).
363
+
364
+
Afterwards, you need to follow one of the following alternatives to let Agda know where to find Vatras.
365
+
361
366
#### Alternative 1: Installation via Nix
362
367
363
-
When using Nix, you can use this repository as a library in you own project, by using `agda.withPackages`:
368
+
When using Nix, you can install this repository as an Agda library by using `agda.withPackages`:
364
369
```nix
365
370
agda = nixpkgs.agda.withPackages [
366
371
nixpkgs.agdaPackages.standard-library
@@ -373,19 +378,13 @@ Though, not required, we recommend to use the [nixpkgs pin](nix/sources.json) cr
373
378
374
379
#### Alternative 2: Manual installation
375
380
376
-
After downloading this library, you can register it by appending the path of [Vatras.agda-lib](Vatras.agda-lib) to the file `$AGDA_DIR/libraries`, creating it if necessary.
377
-
If the environment variable `AGDA_DIR` is unset, it defaults to `~/.agda` on unix-like systems and `C:\Users\USERNAME\AppData\Roaming\agda` or similar on Windows.
378
-
After registering this library on your system, you can use it in your project by stating `Vatras` as a dependency in your Agda library file.
379
-
An Agda library file has the suffix `.agda-lib` and is usually contained in the root directory of your project.
380
-
Its content, including the dependency to Vatras, should include the following:
381
-
382
-
```
383
-
name: YOUR-PROJECT-NAME
384
-
depend: Vatras
385
-
include: SOME/PATH/IN/YOUR/PROJECT
381
+
After downloading this library, you can register it using the following commands:
For details about Agda's library management, please have a look at [Agda's packaging guide](https://agda.readthedocs.io/en/v2.6.4.3/tools/package-system.html).
386
+
Make sure that you also have the Agda standard library version 2.3 installed.
387
+
See step 3 in the [manual setup](#alternative-3-manual-setup) for details on how to install ths Agda standard library.
389
388
390
389
### Notes on Mechanized Proofs
391
390
@@ -593,23 +592,32 @@ during a Docker build, you might have encountered an out of memory issue.
593
592
Try to rerun the same command after closing other applications which might comsume a lot of RAM.
594
593
In some cases it may also be necessary to disable some kind of out-of-memory killer (also known as OOM killer or OOM deamon) but use this option with caution.
595
594
596
-
### Failed to read library file ./libs/../agda-stdlib/standard-library.agda-lib.
597
-
The following error may occur when executing `make` after a manual setup:
595
+
### Docker fails to open Git repository
596
+
597
+
If you see an error like
598
598
```
599
-
Failed to read library file ./libs/../agda-stdlib/standard-library.agda-lib.
600
-
Reason: ./libs/../agda-stdlib/standard-library.agda-lib: openBinaryFile: does not exist (No such file or directory)
601
-
make: *** [makefile:15: build] Error 42
599
+
error: opening Git repository '"/home/user"': failed to resolve path '/home/your-user-name/some/path/.git/worktrees/Vatras': No such file or directory
600
+
------
601
+
Dockerfile:19
602
+
--------------------
603
+
17 |
604
+
18 | # Verify all proofs and build the demo.
605
+
19 | >>> RUN nix-build
606
+
20 |
607
+
21 | # Copy the demo with all runtime dependencies (ignoring build-time dependencies)
608
+
--------------------
609
+
ERROR: failed to solve: process "/bin/sh -c nix-build" did not complete successfully: exit code: 1
602
610
```
603
-
This error indicates that the `agda-stdlib` git submodule has not been set up correctly.
604
-
Executing `git submodule update --init` in the root of the repository should fix the problem.
611
+
you may be in a Git worktree or your Git directory is out of place for some other reason.
612
+
Ensure that `git rev-parse --path-format=absolute --git-common-dir` (the path of the Git repository's data) is in your current working directory by creating a fresh non-bare clone without creating a second Git worktree.
605
613
606
614
## Where does the library name 'Vatras' come from?
607
615
608
616
The name Vatras is (of course) an acronym, which stands for _VAriability language TRAnslationS_.
609
617
Besides, Vatras is a water mage in the classic german RPG [Gothic II](https://almanach.worldofgothic.de/index.php/Vatras), who stems from the city of Varant, which almost sounds like _Variant_.
610
618
Vatras is praying to the god Adanos, who brings some kind of equality or balance loosely speaking.
0 commit comments