diff --git a/fly/src/parser.rs b/fly/src/parser.rs index 902c9736..294efb60 100644 --- a/fly/src/parser.rs +++ b/fly/src/parser.rs @@ -37,7 +37,7 @@ grammar parser() for str { = "(" name:ident() _ ":" _ sort:sort() ")" { Binder {name, sort } } / name:ident() sort:(_ ":" _ s:sort() { s })? { Binder { name, - sort: sort.unwrap_or(Sort::uninterpreted("")) + sort: sort.unwrap_or(Sort::unknown()) } } pub(super) rule term() -> Term = precedence!{ diff --git a/fly/src/syntax.rs b/fly/src/syntax.rs index 5b8a9931..b19cf14c 100644 --- a/fly/src/syntax.rs +++ b/fly/src/syntax.rs @@ -12,11 +12,19 @@ use crate::ouritertools::OurItertools; /// A Sort represents a collection of values, which can be the built-in boolean /// sort or a named sort (coming from a Signature). -#[allow(missing_docs)] #[derive(PartialEq, Eq, Clone, Debug, Hash, Serialize, PartialOrd, Ord)] pub enum Sort { + /// Boolean sort Bool, + /// Uninterpreted sort identified by its name Uninterpreted(String), + /* + /// Unspecified sort + /// + /// This is used in sort inference, and assumed to not occur anywhere after + /// sort inference. + Unknown, + */ } impl Sort { @@ -192,7 +200,6 @@ impl Term { } /// Smart constructor for Id - /// TODO(oded): should this take AsRef? pub fn id(name: &str) -> Self { Self::Id(name.to_string()) }