<commit_before>#[link(name = "rusp",
       vers = "0.1",
       author = "<NAME>",
       url = "https://github.com/bjz/rusp")];

#[comment = "A minimal Lisp dialect for Rust."];
#[crate_type = "lib"];

///
/// Symbol identifier
///
#[deriving(Eq)]
struct Ident<'self>(&'self str);

///
/// Holds a typed value from the environment
///
#[deriving(Eq)]
enum Value<'self> {
    Str(&'self str),
    Bool(bool),
    Int(int),
    Float(float),
}

///
/// Primitive language expressions
///
/// The bottom turtles.
///
#[deriving(Eq)]
pub enum Expr<'self> {
    ///
    /// Symbol reference
    ///
    /// ~~~
    /// <ident>
    /// ~~~
    ///
    Symbol(
        Ident<'self>
    ),
    ///
    /// Constant literal
    ///
    /// ~~~
    /// <val>
    /// ~~~
    ///
    Literal(
        Value<'self>
    ),
    ///
    /// Quotation
    ///
    /// ~~~
    /// (quote <expr>)
    /// ~~~
    ///
    Quote(
        &'self Expr<'self>
    ),
    ///
    /// Conditional expression
    ///
    /// ~~~
    /// (if <test> <conseq> <alt>)
    /// ~~~
    ///
    If(
        &'self Expr<'self>,
        &'self Expr<'self>,
        &'self Expr<'self>
    ),
    ///
    /// Anonymous function
    ///
    /// ~~~
    /// (|<ident>*| <expr>)
    /// ~~~
    ///
    Lambda(
        &'self [Ident<'self>],
        &'self Expr<'self>
    ),
    ///
    /// Symbol definition
    ///
    /// ~~~
    /// (def <ident> <expr>)
    /// ~~~
    ///
    Define(
        Ident<'self>,
        &'self Expr<'self>
    ),
    ///
    /// Procedure call
    ///
    /// ~~~
    /// (<ident> <expr>+)
    /// ~~~
    ///
    Call(
        Ident<'self>,
        &'self [&'self Expr<'self>]
    ),
}<commit_msg>Add parse  and eval function stubs<commit_after>#[link(name = "rusp",
       vers = "0.1",
       author = "<NAME>",
       url = "https://github.com/bjz/rusp")];

#[comment = "A minimal Lisp dialect for Rust."];
#[crate_type = "lib"];

///
/// Symbol identifier
///
#[deriving(Eq)]
struct Ident<'self>(&'self str);

///
/// Holds a typed value from the environment
///
#[deriving(Eq)]
enum Value<'self> {
    Str(&'self str),
    Bool(bool),
    Int(int),
    Float(float),
}

///
/// Primitive language expressions
///
/// The bottom turtles.
///
#[deriving(Eq)]
pub enum Expr<'self> {
    ///
    /// Symbol reference
    ///
    /// ~~~
    /// <ident>
    /// ~~~
    ///
    Symbol(
        Ident<'self>
    ),
    ///
    /// Constant literal
    ///
    /// ~~~
    /// <val>
    /// ~~~
    ///
    Literal(
        Value<'self>
    ),
    ///
    /// Quotation
    ///
    /// ~~~
    /// (quote <expr>)
    /// ~~~
    ///
    Quote(
        &'self Expr<'self>
    ),
    ///
    /// Conditional expression
    ///
    /// ~~~
    /// (if <test> <conseq> <alt>)
    /// ~~~
    ///
    If(
        &'self Expr<'self>,
        &'self Expr<'self>,
        &'self Expr<'self>
    ),
    ///
    /// Anonymous function
    ///
    /// ~~~
    /// (|<ident>*| <expr>)
    /// ~~~
    ///
    Lambda(
        &'self [Ident<'self>],
        &'self Expr<'self>
    ),
    ///
    /// Symbol definition
    ///
    /// ~~~
    /// (def <ident> <expr>)
    /// ~~~
    ///
    Define(
        Ident<'self>,
        &'self Expr<'self>
    ),
    ///
    /// Procedure call
    ///
    /// ~~~
    /// (<ident> <expr>+)
    /// ~~~
    ///
    Call(
        Ident<'self>,
        &'self [&'self Expr<'self>]
    ),
}

///
/// A position in a source string
///
pub struct Position {
    line: uint,
    col: uint,
}

pub enum ParseResult<'self> {
    Success(Expr<'self>),
    Failure {
        description: &'self str,
        position: Position,
    },
}

///
/// Performs a recursive decent parse of the source string.
///
pub fn parse(src: &str) -> ParseResult {
    for str::each_char(src) |_| {}
    fail!()
}

impl<'self> Expr<'self> {
    ///
    /// Evaluates an expression tree
    ///
    pub fn eval(&self) -> Expr {
        match *self {
            Symbol(_) => fail!(),
            Literal(_) => fail!(),
            Quote(_) => fail!(),
            If(_,_,_) => fail!(),
            Lambda(_,_) => fail!(),
            Define(_,_) => fail!(),
            Call(_,_) => fail!(),
        }
    }
}
{'fraction_non_alphanumeric': 0.24559733460257022, 'fraction_numerical': 0.0009519276534983341, 'mean_word_length': 1.2755820249052519, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 72, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4562635', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1489, 'n_words': 279}