Hi. I am going to create a project cooperatively with you. I will chat with you and you will help me make progress. Please DO NOT give me big amounts of information, I have no time to read/understand big amount of info. Keep our dialog clean and compact. We will create WHOLE project, including WHOLE code, WHOLE docs, WHOLE ideas, WHOLE everything. Please, if you know what to change, DO NOT give me changed version, give me only a patch (strictly in GNU patch format), it is critical in code writing. Let's start with writing code, DO NOT ask me uneeded/redundant questions. Here is my thoughts for the project:

    The project is to develop a programming langauge named kolibro
    a good PL.
    no GC.
    memory safe.
    static typing.
    a bit like haskell/rust/python
    use own parser generator named thepg, first we should write it.

Current code:
```rust
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::hash_map::Entry;

#[derive(Debug, Clone)]
enum RuleString {
    Sequence(Box<RuleString>, Box<RuleString>),
    Alternative(Box<RuleString>, Box<RuleString>),
    ZeroOrMore(Box<RuleString>),
    Optional(Box<RuleString>),
    Terminal(char),
    NonTerminal(String),
}

#[derive(Debug, Clone)]
struct Rule {
    lhs: String,
    rhs: RuleString,
}

#[derive(Debug)]
struct Grammar {
    rules: Vec<Rule>,
}

impl<'a> From<&'a Grammar> for ResolvedGrammar<'a> {
    fn from(grammar: &'a Grammar) -> Self {
        let mut rule_map = HashMap::new();

        for rule in &grammar.rules {
            match rule_map.entry(&rule.lhs) {
                Entry::Vacant(entry) => {
                    entry.insert(rule.rhs);
                }
                Entry::Occupied(_) => {
                    panic!("Duplicate rule found for non-terminal: {}", rule.lhs);
                }
            }
        }

        rule_map.values().map(|rule_string| )
{ rule_string }
    }
}

fn main() {
    let digit_rule = Rule {
        lhs: "digit".to_owned(),
        rhs: RuleString::Alternative(
            Box::new(RuleString::Terminal('0')),
            Box::new(RuleString::Alternative(
                Box::new(RuleString::Terminal('1')),
                Box::new(RuleString::Alternative(
                    Box::new(RuleString::Terminal('2')),
                    Box::new(RuleString::Alternative(
                        Box::new(RuleString::Terminal('3')),
                        Box::new(RuleString::Alternative(
                            Box::new(RuleString::Terminal('4')),
                            Box::new(RuleString::Alternative(
                                Box::new(RuleString::Terminal('5')),
                                Box::new(RuleString::Alternative(
                                    Box::new(RuleString::Terminal('6')),
                                    Box::new(RuleString::Alternative(
                                        Box::new(RuleString::Terminal('7')),
                                        Box::new(RuleString::Alternative(
                                            Box::new(RuleString::Terminal('8')),
                                            Box::new(RuleString::Terminal('9')),
                                        )),
                                    )),
                                )),
                            )),
                        )),
                    )),
                )),
            )),
        ),
    };

    // "expr = digit '+' digit"
    let expr_rule = Rule {
        lhs: "expr".to_string(),
        rhs: RuleString::Sequence(
            Box::new(RuleString::NonTerminal("digit".to_string())),
            Box::new(RuleString::Sequence(
                Box::new(RuleString::Terminal('+')),
                Box::new(RuleString::NonTerminal("digit".to_string())),
            )),
        ),
    };

    let grammar = Grammar { rules: vec![digit_rule, expr_rule] };

    println!("thepg - parser generator");
}

#[derive(Debug)]
enum ResolvedRuleString<'a> {
    Sequence(Box<ResolvedRuleString<'a>>, Box<ResolvedRuleString<'a>>),
    Alternative(Box<ResolvedRuleString<'a>>, Box<ResolvedRuleString<'a>>),
    ZeroOrMore(Box<ResolvedRuleString<'a>>),
    Optional(Box<ResolvedRuleString<'a>>),
    Terminal(char),
    NonTerminal(&'a ResolvedRuleString<'a>),
}

#[derive(Debug)]
struct ResolvedGrammar<'a> {
    rules: Vec<ResolvedRule<'a>>,
}
```