Skip to content

Commit 0c192bd

Browse files
authored
Merge pull request #2593 from GaloisInc/tullsen/support-submodules-in-cryptol_load
- support submodules in cryptol_load - fix private's in submodules bug - doc & refactoring improvements
2 parents 152c320 + 48dc42a commit 0c192bd

File tree

26 files changed

+787
-328
lines changed

26 files changed

+787
-328
lines changed

CHANGES.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,43 @@ This release supports [version
102102
Accordingly, the second and third `String` arguments to
103103
`write_coq_cryptol_primitives_for_sawcore` have been removed.
104104

105+
* The behavior of `cryptol_load` has changed; previously when we had
106+
this
107+
108+
A <- cryptol_load "A1.cry" -- A1::** are added to {{A::**}}
109+
A <- cryptol_load "A2.cry" -- A2::** are added to {{A::**}}
110+
111+
the `A` in 2nd line would shadow the first `A`, and for each
112+
symbol `s` from "A2.cry", that symbol may shadow any duplicate
113+
symbol `s` from "A1.cry" and this would also leave symbols from
114+
"A1.cry" in the Cryptol environment.
115+
116+
The new behavior is that the same two commands now work
117+
identically to the following
118+
119+
import "A.cry" as A
120+
import "A2.cry" as A
121+
122+
and as a result
123+
- no shadowing occurs
124+
- importing ambiguous symbols is allowed
125+
- referring to ambiguous (qualified) symbols is an error.
126+
105127
## New Features
106128

107129
* SAW has new commands `llvm_unint: [String] -> LLVMSetup ()` and
108130
and analogous commands for JVM and MIR, which can be used to declare that some
109131
Cryptol names should be kept opaque during symbolic simulation.
110132

133+
* When one does `import ...` and `cryptol_load` at the SAWScript CLI,
134+
you can now access submodules in the loaded modules. Both these
135+
will "import" submodules recursively and make no distinction between
136+
normal and `private` variables. As a result, SAWScript code can
137+
refer to *every* definition in the loaded module.
138+
139+
You can reference public and private definitions in sub-modules via
140+
`::` qualifiers, just as is done in Cryptol code.
141+
111142
* The Cryptol import syntax has been extended.
112143
- You can now import Cryptol module names, including qualified module
113144
names (which are resolved via the Cryptol load path) as well as

crux-mir-comp/src/Mir/Cryptol.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ loadCryptolFunc col sig modulePath name = do
242242
let ?fileReader = BS.readFile
243243
ce <- liftIO (readIORef (mirCryEnv mirState))
244244
let modName = Cry.textToModName modulePath
245-
ce' <- liftIO $ SAW.importModule sc ce (Right modName) Nothing SAW.PublicAndPrivate Nothing
245+
ce' <- liftIO $ SAW.importCryptolModule sc ce (Right modName) Nothing SAW.PublicAndPrivate Nothing
246246
liftIO (writeIORef (mirCryEnv mirState) ce')
247247
-- (m, _ce') <- liftIO $ SAW.loadCryptolModule sc ce (Text.unpack modulePath)
248248
-- tt <- liftIO $ SAW.extractDefFromCryptolModule m (Text.unpack name)

0 commit comments

Comments
 (0)