// extern crate let_lang_proj;

mod lexer;
mod parser;
mod environment;
// use parser::*;
// use environment::*;
// finding the value from the environment
// fn value_of(ast: &ProcLangExp, env: &LetRecLangEnv) -> Option<ProcIntBool> { // defined in int_bool.rs
//     match ast.clone() {
//         ProcLangExp::ConstExp(int)    => Some(IntBoolProc::Integer(int)),
//         ProcLangExp::Boolean(b)       => Some(IntBoolProc::Boolean(b)),
//         ProcLangExp::DiffExp(e1, e2)  => value_of_diff_exp(&(*e1), &(*e2), env),
//         // ProcLangExp::IsZeroExp(e)     => value_of_iszero(&(*e), env),
//         // ProcLangExp::IfExp(e1,e2,e3)  => value_of_if(&(*e1),&(*e2),&(*e3), env),
//         // ProcLangExp::VarExp(s)        => env.apply_env(&s),
//         // ProcLangExp::LetExp(s,e1,e2)  => value_of_let(&s, &(*e1), &(*e2), env),
//         // ProcLangExp::LetRecExp(v1,v2,e1,e2) => value_of_let_rec(&(*v1),&(*v2),&(*e1),&(*e2), &(*env)),
//         // ProcLangExp::ProcExp(s,e1)         => Some(IntBoolProc::Procedure(&s,&(*e1),env),
//         // ProcLangExp::CallExp(e1,e2)         => value_of_call(&(*e1),&(*e2),env)
//     }}


fn main() {
    #[derive(Debug)]
    //let proc_str = "let x = 7 in let y = 2 in let y = let x = -(x , 1) in -(x , y) in -( -( x , 8 ) , y )";
	// let proc_str = "proc (z) -(z,x)" ;
	let proc_str = "let x = 200 in let f = proc (z) -(z,x) in let x = 100 in let g = proc (z) -(z,x) in -((f 1),(g 1))";
    let a = lexer::tokenize(proc_str);
    //let a = lexer::tokenize("if iszero(-(x , 11 ) ) then - ( y , 2 ) else - ( y , 4 )");
    //let a = lexer::tokenize("if iszero(-(x , 11 ) ) then - ( y , 2 ) else - ( y , 4 )");
    println!("------------------------------------------------------------");
    println!("lexer is loaded");
    println!("Tokens are:  {:?}",a);
    let b = parser::parse(&a.unwrap());
    println!("------------------------------------------------------------");
    println!("Parser_output  {:?}",b);
	match b {
        Ok(v1)  => {match v1{
		Some(v)=> {println!("{}", v);      // regular print
                  println!("{:#?}", v);},
		_ => println!("None"),}}  // pretty-print in debug format
		Err(e) => println!("Syntax error: {:#?}", e),
    }
    let _result = parser::show_parse(&(proc_str.to_string()));
    let env1 = environment::env();
    /*
 let m = assert_eq!(tokenize("( 2 3)").unwrap();
 println!("lexer is loaded");
 */
 

}