From 7c5a08664a2987f0a3a7dd95c5b7792e5c5c4e91 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sun, 24 Oct 2021 22:13:31 -0700 Subject: [PATCH] Remove Unimplemented from Reduced IR --- schala-lang/language/src/reduced_ir/mod.rs | 17 ++++++++--------- schala-lang/language/src/reduced_ir/types.rs | 1 - schala-lang/language/src/schala.rs | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/schala-lang/language/src/reduced_ir/mod.rs b/schala-lang/language/src/reduced_ir/mod.rs index 849b8d0..35939ee 100644 --- a/schala-lang/language/src/reduced_ir/mod.rs +++ b/schala-lang/language/src/reduced_ir/mod.rs @@ -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)) diff --git a/schala-lang/language/src/reduced_ir/types.rs b/schala-lang/language/src/reduced_ir/types.rs index 273f174..9486b87 100644 --- a/schala-lang/language/src/reduced_ir/types.rs +++ b/schala-lang/language/src/reduced_ir/types.rs @@ -62,7 +62,6 @@ pub enum Expression { f: Box, args: Vec }, - Unimplemented, ReductionError(String), } diff --git a/schala-lang/language/src/schala.rs b/schala-lang/language/src/schala.rs index 5104add..d55f5a2 100644 --- a/schala-lang/language/src/schala.rs +++ b/schala-lang/language/src/schala.rs @@ -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,