|
| 1 | +PLT Lab 1 Test Suite |
| 2 | +==================== |
| 3 | + |
| 4 | +Programming Language Technology (PLT, Chalmers DAT151, University of Gothenburg DIT231) |
| 5 | + |
| 6 | +This is the Test for PLT lab 1: Engineering a BNFC grammar for a fragment of C++. |
| 7 | + |
| 8 | +Prerequisites |
| 9 | +------------- |
| 10 | + |
| 11 | +To run this testsuite, recent versions of the following Haskell tools need to be installed. |
| 12 | + |
| 13 | +- [Haskell Stack](https://docs.haskellstack.org/en/stable/), e.g. version 3.1.1 |
| 14 | +- [GHC](https://www.haskell.org/ghc/) version 9.4.8 |
| 15 | +- [BNFC](https://bnfc.digitalgrammars.com/), e.g. version 2.9.5 |
| 16 | +- [Alex](https://haskell-alex.readthedocs.io/en/stable/) |
| 17 | +- [Happy](https://haskell-happy.readthedocs.io/en/stable/) |
| 18 | + |
| 19 | +These tools need to be in the [`PATH`](https://en.wikipedia.org/wiki/PATH_(variable)) |
| 20 | +in your [command shell](https://en.wikipedia.org/wiki/Shell_(computing)). |
| 21 | + |
| 22 | +Running the testsuite |
| 23 | +--------------------- |
| 24 | + |
| 25 | +Invoke the test runner with the path to your `.cf` BNFC grammar file: |
| 26 | +``` |
| 27 | +stack run -- path/to/your/file.cf |
| 28 | +``` |
| 29 | + |
| 30 | +**NOTE:** The start category (entry point) of your grammar must be called `Program`. |
| 31 | + |
| 32 | +Installing the prerequisites |
| 33 | +---------------------------- |
| 34 | + |
| 35 | +Here is a suggestion how to install the prerequisites, if needed. |
| 36 | + |
| 37 | +First install [GHCup](https://www.haskell.org/ghcup/). |
| 38 | +Then use it to install Stack and GHC. |
| 39 | +``` |
| 40 | +ghcup install stack latest |
| 41 | +ghcup install ghc 9.4.8 |
| 42 | +``` |
| 43 | +If needed, add to your system `PATH` the location where GHCup installs tools. |
| 44 | + |
| 45 | +Finally, use Stack to install the remaining tools. |
| 46 | +``` |
| 47 | +stack install alex happy BNFC |
| 48 | +``` |
| 49 | +If needed, add to your system `PATH` the location where Stack installs tools. |
| 50 | + |
| 51 | +Verify that these tools are working by querying their version: |
| 52 | +``` |
| 53 | +stack --version |
| 54 | +ghc --version |
| 55 | +bnfc --version |
| 56 | +alex --version |
| 57 | +happy --version |
| 58 | +``` |
0 commit comments