summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 7c4babd..5026085 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,4 @@
+use chomp::ast::InlineCall;
use chomp::{ast::TypeCheck, nibble::File};
use proc_macro2::Span;
use std::{
@@ -14,9 +15,16 @@ fn main() {
.map_err(|e| Box::new(e) as Box<dyn Error>)
.and_then(|_| syn::parse_str(&input).map_err(|e| Box::new(e) as Box<dyn Error>))
.and_then(|nibble: File| {
- dbg!(nibble
- .convert_with_substitution())
- .fold(&mut TypeCheck::new())
+ let (funs, goal) = nibble.convert();
+
+ funs.into_iter()
+ .try_rfold(goal, |goal, (name, term, args)| {
+ goal.fold(&mut InlineCall::new(name, term, args))
+ })
+ .map_err(|e| Box::new(e) as Box<dyn Error>)
+ })
+ .and_then(|term| {
+ term.fold(&mut TypeCheck::new())
.map_err(|e| Box::new(e) as Box<dyn Error>)
})
.map(|(typed, _)| typed.emit_code(Ident::new("Ast", Span::call_site())))