Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Structured names #87

Merged
merged 5 commits into from
Nov 13, 2020
Merged

Structured names #87

merged 5 commits into from
Nov 13, 2020

Conversation

robdockins
Copy link
Contributor

Some early work on adding structured names to SAWCore. For now, this is really only addressing naming concerns for ExtCns and Constant terms, but there are already quite a lot of design issues to untangle.

@brianhuffman
Copy link
Contributor

I don't think we need this NameInfo type; we should just use Cryptol's Ident type everywhere. For Constant terms translated from Cryptol, we can use the same Ident they have in the original Cryptol, including the Cryptol module name. (The translator currently throws away the Cryptol module names, but this is bad.) For Constant terms defined dynamically within SAW using define, we can just use Cryptol.Utils.Ident.interactiveName as the module name, just like we do for let-defined constants in the Cryptol REPL.

@robdockins
Copy link
Contributor Author

I think the one concern I have with just using Cryptol's names is that we also have names imported from other languages, like LLVM and JVM to concern ourselves with. Do we just wan to shoehorn everything in to the Cryptol namespace by inventing special modules for those identifiers to live in?

@brianhuffman
Copy link
Contributor

brianhuffman commented Oct 17, 2020

We really don't do much importing of LLVM/JVM names into saw-core, except if we're doing a function extraction. So yeah, I'd be fine with shoehorning everything into the Cryptol namespace. We could even just have the user provide a name to use for each extracted function, so we don't even have to reserve any particular part of the namespace in advance.

One advantage of using the Cryptol namespace for module names is that users already know the syntax for it; having to refer to the same name two different ways in two contexts would be confusing.

@robdockins
Copy link
Contributor Author

I think the main ideas here are now in place, per our last conversation.

There are still a few details to work out, but it seems like this method allows us to install structured names and still be backward compatible in SAW with our test suite of proofs, so I think that's a really strong start.

@robdockins
Copy link
Contributor Author

@brianhuffman, I think this is just about ready to merge. I'd love your thoughts.

Copy link
Contributor

@brianhuffman brianhuffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

`NameInfo` datatype that is attached to `ExtCns` (and thus `Constant`)
nodes.

In addition, we implement a more organized naming environment, and a
notion of abolute names, which are intended to be a unique "name of
last resort".  Each name that doesn't derive from a SAWCore module is
required to have a unique URI.  Dynamically-created values incorporate
the unique VarIndex into their name, whereas concepts from, e.g.,
Cryptol modules have URIs that are derived from their fully-qualified
name.

In addition to the absolute name, imported names may have a collection
of aliases, which are the more typical way to refer to the name.
All the aliases for a name are put into a naming environment, which
map strings arising from user input, etc, into a set of names they
might refer to.  When the set contains more than one "true" name,
the identifier is ambiguous, and we can report all the names to which
that identifier might refer, as well as unambiguous alternate identifiers
for each name.
in the external format.  This allows us to retain the full
information present in the `NameInfo` structure without complicating
the main term parsing code.
for resolving identifiers using the Cryptol naming environment.
Also, improve some error messages.
held uninterpreted as a `Set VarIndex` instead of a `[String]`.

This shifts the burden of resolving user-provided names closer
to the front-end.
@robdockins robdockins merged commit e146c8a into master Nov 13, 2020
robdockins added a commit to GaloisInc/saw-script that referenced this pull request Nov 16, 2020
from SAWCore (CF GaloisInc/saw-core#87).

Add logic for first attempting to resolve user-supplied names
using the Cryptol interactive scope, then fall back on the SAWCore
naming environment.
robdockins added a commit to GaloisInc/saw-script that referenced this pull request Nov 16, 2020
from SAWCore (CF GaloisInc/saw-core#87).

Add logic for first attempting to resolve user-supplied names
using the Cryptol interactive scope, then fall back on the SAWCore
naming environment.
robdockins added a commit to GaloisInc/saw-script that referenced this pull request Nov 17, 2020
from SAWCore (CF GaloisInc/saw-core#87).

Add logic for first attempting to resolve user-supplied names
using the Cryptol interactive scope, then fall back on the SAWCore
naming environment.
robdockins added a commit to GaloisInc/saw-script that referenced this pull request Nov 17, 2020
from SAWCore (CF GaloisInc/saw-core#87).

Add logic for first attempting to resolve user-supplied names
using the Cryptol interactive scope, then fall back on the SAWCore
naming environment.
robdockins added a commit to GaloisInc/saw-script that referenced this pull request Nov 18, 2020
from SAWCore (CF GaloisInc/saw-core#87).

Add logic for first attempting to resolve user-supplied names
using the Cryptol interactive scope, then fall back on the SAWCore
naming environment.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants