pub fn eval(term: &Term) -> Value {
    match term {
        Term::Item(_, label) => Value::Neutral(Head::Item(label.clone()), Vec::new()), // TODO: Evaluate to value in environment
        Term::Ann(term, _) => eval(term),
        Term::Universe(_, universe) => Value::Universe(*universe),
        Term::U8Type(_) => Value::U8Type,
        Term::U16LeType(_) => Value::U16LeType,
        Term::U16BeType(_) => Value::U16BeType,
        Term::U32LeType(_) => Value::U32LeType,
        Term::U32BeType(_) => Value::U32BeType,
        Term::U64LeType(_) => Value::U64LeType,
        Term::U64BeType(_) => Value::U64BeType,
        Term::S8Type(_) => Value::S8Type,
        Term::S16LeType(_) => Value::S16LeType,
        Term::S16BeType(_) => Value::S16BeType,
        Term::S32LeType(_) => Value::S32LeType,
        Term::S32BeType(_) => Value::S32BeType,
        Term::S64LeType(_) => Value::S64LeType,
        Term::S64BeType(_) => Value::S64BeType,
        Term::F32LeType(_) => Value::F32LeType,
        Term::F32BeType(_) => Value::F32BeType,
        Term::F64LeType(_) => Value::F64LeType,
        Term::F64BeType(_) => Value::F64BeType,
        Term::BoolType(_) => Value::BoolType,
        Term::IntType(_) => Value::IntType,
        Term::F32Type(_) => Value::F32Type,
        Term::F64Type(_) => Value::F64Type,
        Term::BoolConst(_, value) => Value::BoolConst(*value),
        Term::IntConst(_, value) => Value::IntConst(value.clone()),
        Term::F32Const(_, value) => Value::F32Const(*value),
        Term::F64Const(_, value) => Value::F64Const(*value),
        Term::BoolElim(_, term, if_true, if_false) => match eval(term) {
            Value::BoolConst(true) => eval(if_true),
            Value::BoolConst(false) => eval(if_false),
            Value::Neutral(head, mut elims) => {
                elims.push(Elim::Bool(if_true.clone(), if_false.clone()));
                Value::Neutral(head, elims)
            }
            _ => Value::Neutral(
                Head::Error,
                vec![Elim::Bool(if_true.clone(), if_false.clone())],
            ),
        },
        Term::Error(_) => Value::Error,
    }
}
/// Evaluate a term into a semantic value.
Evaluate a term into a semantic value.
Evaluate a term into a semantic value .
pub fn eval(term: &Term) -> Value {
    match term {
        Term::Item(_, label) => Value::Neutral(Head::Item(label.clone()), Vec::new()), // TODO: Evaluate to value in environment
        Term::Ann(term, _) => eval(term),
        Term::Universe(_, universe) => Value::Universe(*universe),
        Term::U8Type(_) => Value::U8Type,
        Term::U16LeType(_) => Value::U16LeType,
        Term::U16BeType(_) => Value::U16BeType,
        Term::U32LeType(_) => Value::U32LeType,
        Term::U32BeType(_) => Value::U32BeType,
        Term::U64LeType(_) => Value::U64LeType,
        Term::U64BeType(_) => Value::U64BeType,
        Term::S8Type(_) => Value::S8Type,
        Term::S16LeType(_) => Value::S16LeType,
        Term::S16BeType(_) => Value::S16BeType,
        Term::S32LeType(_) => Value::S32LeType,
        Term::S32BeType(_) => Value::S32BeType,
        Term::S64LeType(_) => Value::S64LeType,
        Term::S64BeType(_) => Value::S64BeType,
        Term::F32LeType(_) => Value::F32LeType,
        Term::F32BeType(_) => Value::F32BeType,
        Term::F64LeType(_) => Value::F64LeType,
        Term::F64BeType(_) => Value::F64BeType,
        Term::BoolType(_) => Value::BoolType,
        Term::IntType(_) => Value::IntType,
        Term::F32Type(_) => Value::F32Type,
        Term::F64Type(_) => Value::F64Type,
        Term::BoolConst(_, value) => Value::BoolConst(*value),
        Term::IntConst(_, value) => Value::IntConst(value.clone()),
        Term::F32Const(_, value) => Value::F32Const(*value),
        Term::F64Const(_, value) => Value::F64Const(*value),
        Term::BoolElim(_, term, if_true, if_false) => match eval(term) {
            Value::BoolConst(true) => eval(if_true),
            Value::BoolConst(false) => eval(if_false),
            Value::Neutral(head, mut elims) => {
                elims.push(Elim::Bool(if_true.clone(), if_false.clone()));
                Value::Neutral(head, elims)
            }
            _ => Value::Neutral(
                Head::Error,
                vec![Elim::Bool(if_true.clone(), if_false.clone())],
            ),
        },
        Term::Error(_) => Value::Error,
    }
}
pub fn eval ( term : & Term ) -> Value { match term { Term :: Item ( _ , label ) => Value :: Neutral ( Head :: Item ( label . clone ( ) ) , Vec :: new ( ) ) , // TODO: Evaluate to value in environment Term :: Ann ( term , _ ) => eval ( term ) , Term :: Universe ( _ , universe ) => Value :: Universe ( * universe ) , Term :: U8Type ( _ ) => Value :: U8Type , Term :: U16LeType ( _ ) => Value :: U16LeType , Term :: U16BeType ( _ ) => Value :: U16BeType , Term :: U32LeType ( _ ) => Value :: U32LeType , Term :: U32BeType ( _ ) => Value :: U32BeType , Term :: U64LeType ( _ ) => Value :: U64LeType , Term :: U64BeType ( _ ) => Value :: U64BeType , Term :: S8Type ( _ ) => Value :: S8Type , Term :: S16LeType ( _ ) => Value :: S16LeType , Term :: S16BeType ( _ ) => Value :: S16BeType , Term :: S32LeType ( _ ) => Value :: S32LeType , Term :: S32BeType ( _ ) => Value :: S32BeType , Term :: S64LeType ( _ ) => Value :: S64LeType , Term :: S64BeType ( _ ) => Value :: S64BeType , Term :: F32LeType ( _ ) => Value :: F32LeType , Term :: F32BeType ( _ ) => Value :: F32BeType , Term :: F64LeType ( _ ) => Value :: F64LeType , Term :: F64BeType ( _ ) => Value :: F64BeType , Term :: BoolType ( _ ) => Value :: BoolType , Term :: IntType ( _ ) => Value :: IntType , Term :: F32Type ( _ ) => Value :: F32Type , Term :: F64Type ( _ ) => Value :: F64Type , Term :: BoolConst ( _ , value ) => Value :: BoolConst ( * value ) , Term :: IntConst ( _ , value ) => Value :: IntConst ( value . clone ( ) ) , Term :: F32Const ( _ , value ) => Value :: F32Const ( * value ) , Term :: F64Const ( _ , value ) => Value :: F64Const ( * value ) , Term :: BoolElim ( _ , term , if_true , if_false ) => match eval ( term ) { Value :: BoolConst ( true ) => eval ( if_true ) , Value :: BoolConst ( false ) => eval ( if_false ) , Value :: Neutral ( head , mut elims ) => { elims . push ( Elim :: Bool ( if_true . clone ( ) , if_false . clone ( ) ) ) ; Value :: Neutral ( head , elims ) } _ => Value :: Neutral ( Head :: Error , vec ! [ Elim Bool ( if_true clone ( ) if_false clone ( ) ) ] , ) , } , Term :: Error ( _ ) => Value :: Error , } }
Evaluate a term into a semantic value.
Evaluate a term into a semantic value .
term
&Term
term
&Term