Commit Graph

273 Commits

Author SHA1 Message Date
Iavor Diatchki
a56b6ef08e Implement anonymous modules for nested modules.
This doesn't work for top-level modules, as we need to figure out a
way to name the anonymous module in that case.
2022-06-01 16:22:34 -07:00
Iavor Diatchki
791d97a448 Checkpoint: refactoring in prep for supporting anonymous modules in instances 2022-06-01 15:52:41 -07:00
Iavor Diatchki
e681c322e9 Remove backtick imports 2022-06-01 14:33:29 -07:00
Iavor Diatchki
2ec12a4c05 Partially functional module system. Still some bugs to fix. 2022-05-31 16:50:38 -07:00
Iavor Diatchki
c74442dd4e Checkpoing: checking type-level module parmameters 2022-05-24 16:25:32 -07:00
Iavor Diatchki
c4cb1c222e Placeholder, and comments 2022-04-11 16:24:38 -07:00
Iavor Diatchki
cff5ed4766 Checkpoint: more integration 2022-04-07 13:58:13 -07:00
Iavor Diatchki
c56ca1252d Checkpoint: compute scoping relations 2022-04-06 14:55:04 -07:00
Iavor Diatchki
6573cc61da Incremental progress:
* Move code for adding implicit imports to a separate module
  * Use the correct original name module path when instantiating functors
2022-04-05 09:49:57 -07:00
Iavor Diatchki
eb26f5e4e4 Checkpoint: more on instantiating functors 2022-02-21 16:08:01 -08:00
Iavor Diatchki
e3bcea5fe6 Split off help about named things into a separate module 2022-02-16 11:34:15 -08:00
Iavor Diatchki
7fd1326cf3 Checkpoint 2022-02-16 11:34:15 -08:00
Iavor Diatchki
87c50d52c3 Split up NamingEnvironemnt into multiple modules and cleanup 2022-02-16 11:34:15 -08:00
Ryan Scott
1181076f1f Factor out compatibility shims into GHC.Num.Compat 2022-01-13 12:13:40 -05:00
Ryan Scott
644d33bf1f Merge branch 'master' into ghc9 2022-01-12 09:33:24 -05:00
Aaron Tomb
4e9c5b1650 Update copyright year 2021-10-05 10:16:16 -07:00
Aaron Tomb
f980545711 Bump version number after 2.12 release 2021-10-05 10:11:28 -07:00
Felix Yan
868ce2cff3
Allow sbv 8.16
Tested to build fine.
2021-08-19 10:40:04 +08:00
Rob Dockins
35bb83b80c Swap out pretty printer packages. We are now using prettyprinter.
This required a fair amount of fixup to the pretty-printing code,
as some of the primitives have semantics that differ in subtle ways
from the old package.  The output now is mostly the same as before,
although some improvements have been made here and there.

The one somewhat negative outcome of this change is that the
"line fill" algorithm in `prettyprinter` works a bit different
and makes choices about where to break lines that are arguably
less desirable than before. When laying out structures nested inside
sequences, it is more likely to break a line inside a substructure,
whereas the old algorithm prefered to break lines between elements
of the outer sequence.  There are also appear to be some minor
differences regarding how ribbon width is calculated.
2021-08-06 14:17:47 -07:00
Felix Yan
4526f5090e Allow sbv 8.15 (#1205) 2021-07-23 08:27:04 -07:00
Iavor Diatchki
816523df10 Fixes #1167
This requires newer version simple-smt, which supports calling back into
the program when the solver exits
2021-07-21 10:54:03 -07:00
Rob Dockins
889bfd6511 First take at GHC 9.* compatibility.
There's a lot here that can be cleaned up, and we need
some backward compatiblity layer, but this is just a first
try.

Something in the PrimeEC module is causing hard crashes
during the test suite, so I'll have to figure out what's
going on there.
2021-07-14 22:44:53 -07:00
Rob Dockins
3900c68619 Update build metadata to allow/require What4 1.2 2021-06-17 11:54:09 -07:00
Iavor Diatchki
7727197800 Split off tokens and new layout in a separate modules 2021-04-29 11:17:34 -07:00
robdockins
cd0748cc74
Merge pull request #1161 from felixonmars/patch-2
Allow sbv 8.14
2021-04-20 10:22:19 -07:00
Felix Yan
6d17c2e97b
Allow sbv 8.14
Tested to build fine here.
2021-04-14 03:33:21 +08:00
Rob Dockins
3f185449ee Move WordValue into a separate module. 2021-04-13 10:27:17 -07:00
Rob Dockins
3f710468e8 Break SeqMap out into a separate module 2021-04-13 10:27:17 -07:00
Rob Dockins
234437af06 Remove our dependency on the random package.
Instead, directly use the generators defined in `tf-random`.
This changes the generation algorithm for some types, so we
need to update the tests that depend on those concrete values.

Fixes #1102
2021-04-07 12:12:32 -07:00
robdockins
c2ef506902
Merge pull request #1139 from felixonmars/patch-2
Allow sbv 8.13
2021-04-06 10:15:20 -07:00
Iavor S. Diatchki
523a2dcd5b
Merge pull request #1048 from GaloisInc/nested-modules
Nested modules
2021-04-06 08:40:42 -07:00
Aaron Tomb
e3c4e37d0c
Bump version after release (#1148) 2021-04-05 09:52:25 -07:00
Iavor Diatchki
1532223149 Redo the scoping on the command line and browsing.
This fixes a bug where the scoping on the command line was incorrect
for nested modules.

It also changes the semantics of `:browse` (whose implementation is now
in a separate module), to be more reasonable. See #689
2021-04-02 16:07:48 -07:00
Iavor Diatchki
501f884353 Merge branch 'master' into nested-modules 2021-04-01 15:23:02 -07:00
Felix Yan
b7f9aba816
Allow sbv 8.13
Tested to build fine here.
2021-03-30 21:11:22 +08:00
Lisanna Dettwyler
f021990eba
Prep CI for upcoming release (#1123)
- Container images are now published to ghcr.io rather than docker hub (closes #1110):
  - https://github.com/orgs/GaloisInc/packages/container/package/cryptol
  - https://github.com/orgs/GaloisInc/packages/container/package/cryptol-remote-api
- Docker builds for all images are cached against ghcr.io (doesn't provide incremental builds, but it still helps a lot).
  - https://github.com/orgs/GaloisInc/packages/container/package/cache-cryptol
  - https://github.com/orgs/GaloisInc/packages/container/package/cache-cryptol-remote-api
- "Portable" variant of cryptol-remote-api is now built and tested to the same degree as the non-portable one
- Normalized CI workflows to [`.github/workflows/ci.yml`](https://github.com/GaloisInc/cryptol/blob/lisanna/docker-publishing/.github/workflows/ci.yml) (closes #1115)
- Pre-merge and release build configurations are now more or less the same, so release process remains validated (closes #1114, closes #1116)
- Matrix configs for each job are visible at high-level views of the workflow
- Always upload workflow artifacts, use sensible retention periods for publish vs. non-publish
- `cryptol-eval-server` included in cryptol-remote-api container image (closes #1112)
- Pathclearing for static linking (#1113)
2021-03-23 15:24:48 -07:00
Felix Yan
77dedc3fec
Allow sbv 8.12 (#1126)
Tested to build fine here.
2021-03-22 13:47:23 -07:00
Felix Yan
89660676b1
Allow sbv 8.11
Tested to build fine here.
2021-03-13 19:13:49 +08:00
Iavor Diatchki
34b1d87df3 Implementation of nested modules.
* Limitations:
    Does not work in combination parameterized modules, as I am
    about to redo how that works.

  * General refeactorings:
    * Namespaces:
      - We have an explicit type for namespaces, see `Cryptol.Util.Ident`
      - Display environments should now be aware of the namespace of the
        name being displayed.

    * Renamer:
      - Factor out the renamer monad and error type into separate modules
      - All name resultion is done through a single function `resolveName`
      - The renamer now computes the dependencies between declarations,
         orders things in dependency order, and checks for bad recursion.

    * Typechecker: Redo checking of declarations (both top-level and local).
      Previously we used a sort of CPS to add things in scope.   Now we use
      a state monad and add things to the state.  We assume that the renamer
      has been run, which means that declarations are ordered in dependency
      order, and things have unique name, so we don't need to worry about
      scoping too much.

  * Change specific to nested modules:
    - We have a new namespace for module names
    - The interface file of a module contains the interfaces for nested modules
    - Most of the changes related to nested modules in the renamer are
      in `ModuleSystem.NamingEnv` and `ModuleSystem.Rename`
        - There is some trickiness when resolving module names when importing
          submodules (seed `processOpen` and `openLoop`)
    - There are some changes to the representation of modules in the typechecked
      syntax, in particular:
        - During type-checking we "flatten" nested module declarations into
          a single big declaration.  Hopefully, this means that passes after
          the type checker don't need to worry about nested modules
        - There is a new field containing the interfaces of the nested modules,
          this is needed so that when we import the module we know we have the
          nested structure
        - Declarations in functor/parameterzied modules do not appear in the
          flattened list of declarations.  Instead thouse modules are collected
          in a separate field, and the plan is that they would be used from
          there when we implmenet functor instantiation.
2021-03-12 09:55:56 -08:00
Felix Yan
a0aa00d15f
Allow sbv 8.10
Tested to build fine here.
2021-02-16 17:21:31 +08:00
Rob Dockins
0909120a68 Convert to using the SFloat module from What4.
Expose some additional primitives, such as FMA,
abs, sqrt, and more classification predicates.

Refactor the primitives table for floating-point
values into a single generic table that uses
methods from the `Backend` class.
2021-02-08 17:47:49 -08:00
Rob Dockins
78855e7967 Update to use libBF version 0.6, which has some bugfixes
and additional operations.
2021-01-28 17:03:46 -08:00
Rob Dockins
ef442be296 Refactor how primitives are represented. We invent a lightweight syntax
for primitives that is evaluated to values when a primitive is looked up
at evaluation time.  Currently, this does not add any additional capabilities,
but gives us the ability to modify the representation of values
without touching all the primitive definitions, and gives us a place to
hook in additional capabilies to the primitives.

As part of this refactoring, the primitives that are defined totally
generically are moved to the `Cryptol.Eval.Generic` module and
used uniformly in all the backends.
2020-12-01 11:01:21 -08:00
Felix Yan
052d88a247 Fix compatibility with SBV 8.8 & 8.9
Tested with SBV 8.9 here and it built fine.
2020-11-30 11:43:25 -08:00
Ben Selfridge
861e9e9651
Feature/docs checking (#976)
* Adds a stub executable to cabal file for checking docs

* [WIP] Adds check-exercises executable

A program that checks that the exercises in Programming Cryptol actual work when
executed against an Cryptol REPL. Instead of using \begin{Verbatim}, we use
\begin{REPL} in both the exercise and the answer, which is rendered the same but
gets checked by this program.

This is a WIP -- we still need to do a number of things, including (but not
limited to):

* Move the "REPL" macro out of CrashCourse.tex and into some including latex
  file
* Change many of the "Verbatim"s into "REPL"s to test if this approach works in
  general

* Several updates

* Moves REPL command definitions into main latex file

* Generalizes repl commands

* Several improvements:

* documentation of CheckExercises.hs
* factoring out addReplData, addReplin, addReplout, nextLine functions
* took the IO out of P monad (shouldn't have been there)
* worked on annotating repls for many exercises/examples in crash course

* Adds a README for check-exercises

* Uses cryptol's -e option to detect errors

* updates ProgrammingCryptol.pdf

* Fixes main function

After changing to use the -e option to detect errors, I used cabal v2-exec which
apparently does not rebuild anything, but I thought it did. This just fixes the
code so it builds again.
2020-11-20 16:53:36 -08:00
Aaron Tomb
c296e9aad6 Bump Cryptol version after release 2020-11-20 13:47:59 -08:00
Aaron Tomb
0541bcf559
Preparation for the 2.10 release (#972)
* Update CHANGES for 2.10

* Remove profiling flags from Cabal file

They result in `cabal check` warnings and probably don’t need to be
hard-coded.

* Remove commented-out Cryptol server references

The code no longer exists, so we’ll never uncomment these.

Equivalent functionality is now provided by `cryptol-remote-api`.

* Update references to version numbers in README. Closes #719.
2020-11-18 15:38:44 -08:00
Rob Dockins
9511dd856f Fix some cabal warnings and such 2020-11-10 09:36:05 -08:00
Rob Dockins
32e081c5ae Update cabal file to include all relevant files in the lib directory. 2020-10-27 17:40:39 -07:00
Rob Dockins
44e5f45ae3 Add faster primitive implementations for pmult, pdiv, and pmod. 2020-10-27 10:51:10 -07:00