aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 6b2bc57..0f67aa4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,6 +5,9 @@ use std::io::Write;
use std::path::Path;
mod sexpr;
+mod cexpr;
+
+use cexpr::CExpr;
fn repl(verbose: bool) {
@@ -56,7 +59,21 @@ fn repl(verbose: bool) {
continue;
}
};
- println!("{}", sexpr::sexpr_repr(&ast).unwrap());
+ let expr = match CExpr::from_sexpr(&ast) {
+ Ok(v) => v,
+ Err(e) => {
+ println!("couldn't parse as math: {}", e);
+ continue;
+ },
+ };
+ match expr.to_sexpr() {
+ Ok(out) => println!("{}", sexpr::sexpr_repr(&ast).unwrap()),
+ Err(e) => {
+ println!("couldn't return to sexpr: {}", e);
+ continue;
+ },
+
+ }
}
}