copilot
copilot copied to clipboard
`copilot-core`: externalize the interpreter in a separate library
Description
Currently, the architecture of Copilot mixes backends with other libraries, which makes the result not uniform. For example, the interpreter and the Graphviz prettyprinter are part of copilot-core
, while the C99 backend is in a separate library.
The implementation does not match our desired architecture according to our design documents, and it makes the code partly harder to maintain.
A better solution would be to move the interpreter to a separate library, and to deprecate any interpreter modules exported from copilot-core
.
Type
- Maintenance: match proposed design.
Additional context
None.
Requester
- Ivan Perez
Method to check presence of bug
None (not a bug).
Expected result
There should be a copilot-interpreter
library, and all interpreter modules in copilot-core
should be deprecated.
Desired result
There should be a copilot-interpreter
library, and all interpreter modules in copilot-core
should be deprecated.
Proposed solution
Deprecate Copilot.Core.Interpret
and Copilot.Core.Interpret.Eval
. Move both modules to a different name-space and library (e.g., copilot-interpreter
).
Modify the tests accordingly (moving them to the new library if necessary).
Further notes
None.
Change Manager: Confirmed that the issue exists.
Technical Lead: Confirmed that the issue should be addressed.
Technical Lead: Issue scheduled for fixing in Copilot 3.11.
Fix assigned to: @ivanperez-keera .
Implementor: Solution implemented, review requested.
Change Manager: Verified that:
- Solution is implemented:
-
[X] The code proposed compiles and passes all tests. Details: Build log: https://app.travis-ci.com/github/Copilot-Language/copilot/builds/254730420
-
[X] The solution proposed produces the expected result. Details: The following Dockerfile checks that the new library is installed and the modules in the interpreter can be used from their new location, in which case it prints the message
Success
.FROM ubuntu:trusty RUN apt-get update RUN apt-get install --yes software-properties-common RUN add-apt-repository ppa:hvr/ghc RUN apt-get update RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4 RUN apt-get install --yes libz-dev ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH RUN cabal update RUN cabal v1-sandbox init RUN cabal v1-install alex happy RUN apt-get install --yes git SHELL ["/bin/bash", "-c"] CMD git clone $REPO && cd $NAME && git checkout $COMMIT && cd .. \ && cabal v1-install copilot/copilot**/ --enable-tests --enable-documentation --run-tests \ && cabal v1-exec -- runhaskell -Wall -Werror=deprecations <<< "import Copilot.Interpret(); main :: IO (); main = return ()" \ && echo "Success"
Command (substitute variables based on new path after merge):
$ docker run -e "REPO=https://github.com/ivanperez-keera/copilot" -e "NAME=copilot" -e "COMMIT=74bca924e5e1ab67cb720e4d126fd920dc42c567" -it copilot-verify-361
-
- [X] Implementation is documented. Details: All new modules include documentation. The library includes a custom README, and a custom cabal package description.
- [X] Change history is clear.
- [X] Commit messages are clear.
- [X] Changelogs are updated.
- [X] Examples are updated. Details: No updates needed.
- [X] Required version bumps are evaluated. Details: Bump needed (public functions deprecated, new library recommended).
Change Manager: Implementation ready to be merged.