frg 2.1.0

Compiled programming language with frogs!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::{TreeCursor, Expression, expressions};

pub fn parse(cursor: &mut TreeCursor, code: &str) -> Expression {
    cursor.goto_first_child();
    // skip "return"
    cursor.goto_next_sibling();

    let expr = expressions::parse(cursor, code);

    cursor.goto_parent();
    expr
}

pub fn transpile(expr: &Expression) -> String {
    let value = expressions::transpile(expr);
    format!("return {value};")
}