Remove Unimplemented from Reduced IR

This commit is contained in:
Greg Shuflin 2021-10-24 22:13:31 -07:00
parent 81859306b3
commit 7c5a08664a
3 changed files with 9 additions and 11 deletions

View File

@ -108,7 +108,6 @@ impl<'a> Reducer<'a> {
fn expression(&mut self, expr: &ast::Expression) -> Expression {
use crate::ast::ExpressionKind::*;
use Expression::{Unimplemented};
match &expr.kind {
NatLiteral(n) => Expression::Literal(Literal::Nat(*n)),
@ -133,11 +132,11 @@ impl<'a> Reducer<'a> {
body: self.function(body),
})
},
NamedStruct { name, fields } => Unimplemented, //self.reduce_named_struct(name, fields),
Index { .. } => Unimplemented,
WhileExpression { .. } => Unimplemented,
ForExpression { .. } => Unimplemented,
ListLiteral { .. } => Unimplemented,
NamedStruct { name, fields } => Expression::ReductionError("NamedStruct not implemented".to_string()), //self.reduce_named_struct(name, fields),
Index { .. } => Expression::ReductionError("Index expr not implemented".to_string()),
WhileExpression { .. } => Expression::ReductionError("While expr not implemented".to_string()),
ForExpression { .. } => Expression::ReductionError("For expr not implemented".to_string()),
ListLiteral { .. } => Expression::ReductionError("ListLiteral expr not implemented".to_string()),
}
}
@ -169,7 +168,7 @@ impl<'a> Reducer<'a> {
}
None => {
//TODO need this for custom prefix ops
Expression::Unimplemented
Expression::ReductionError("User-defined prefix ops not supported".to_string())
}
}
}
@ -203,7 +202,7 @@ impl<'a> Reducer<'a> {
}
None => {
//TODO handle a user-defined operation
Unimplemented
ReductionError("User-defined operations not supported".to_string())
}
}
}
@ -224,7 +223,7 @@ impl<'a> Reducer<'a> {
LocalVariable => Expression::Lookup { id: def_id.clone(), kind: Lookup::LocalVar },
FunctionParam(n) => Expression::Lookup { id: def_id.clone(), kind: Lookup::Param(*n) },
DataConstructor { index, arity, .. } => {
Expression::Unimplemented
Expression::ReductionError("DataConstructor not supported".to_string())
},
RecordConstructor { .. } => {
Expression::ReductionError(format!("The symbol for value {:?} is unexpectdly a RecordConstructor", qualified_name))

View File

@ -62,7 +62,6 @@ pub enum Expression {
f: Box<Expression>,
args: Vec<Expression>
},
Unimplemented,
ReductionError(String),
}

View File

@ -1,7 +1,7 @@
use stopwatch::Stopwatch;
use crate::error::SchalaError;
use crate::{eval, parsing, reduced_ast, reduced_ir, tree_walk_eval, symbol_table, tokenizing, typechecking};
use crate::{eval, parsing, reduced_ir, tree_walk_eval, symbol_table, tokenizing, typechecking};
use schala_repl::{
ComputationRequest, ComputationResponse, GlobalOutputStats, LangMetaRequest, LangMetaResponse,
ProgrammingLanguageInterface,