use std::str::FromStr; use std::rc::Rc; use sl::Form; grammar; pub Term: Rc
= { NUM => Rc::new(Form::Int(i32::from_str(<>).unwrap())), SYM => Rc::new(Form::Symbol(<>.to_owned(),None)), "(" ")" => <>.unwrap_or(Rc::new(Form::Nil)), "'" => Rc::new(Form::Pair(Rc::new(Form::Symbol("quote".to_owned(),None)), Rc::new(Form::Pair(<>, Rc::new(Form::Nil),None)),None)), "!" => { h.append(t).unwrap() }, }; ListInside: Rc = { => Rc::new(Form::Pair(<>, Rc::new(Form::Nil),None)), => Rc::new(Form::Pair(h, t,None)), "." => Rc::new(Form::Pair(a, d,None)), } match { "(", ")", ".", "'", "!", r"[0-9]+" => NUM, r"[a-zA-Z+*/_=?%&|^<>-][\w+*/=_?%&|^<>-]*" => SYM, r"(;[^\n]*\n)|\s+" => { } }