Skip to content

Commit

Permalink
feat: recursive lambda optimization (beta)
Browse files Browse the repository at this point in the history
  • Loading branch information
sor4chi committed Jun 30, 2024
1 parent 90be682 commit bf63d19
Show file tree
Hide file tree
Showing 5 changed files with 304 additions and 98 deletions.
7 changes: 4 additions & 3 deletions src/bin/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use serde::{Deserialize, Serialize};

// =========== CONFIG ===========
const API_URL: &str = "https://boundvariable.space/communicate";
const COMMAND: &str = "get spaceship";
const COMMAND: &str = "get lambdaman";
const SAVE_DIR: &str = "downloads";
const START_ID: usize = 22;
const END_ID: usize = 25;
const START_ID: usize = 9;
const END_ID: usize = 9;
// ==============================

struct Env {
Expand Down Expand Up @@ -50,6 +50,7 @@ async fn main() {
match res {
Ok(res) => {
let body = res.text().await.unwrap();
eprintln!("body: {}", body);
let tokens = Tokenizer::new(&body).tokenize();
let node = Parser::new(&tokens).parse();
let result = Evaluator::new(node).evaluate();
Expand Down
1 change: 0 additions & 1 deletion src/bin/encrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ fn main() {
stdin().read_line(&mut buffer).unwrap();
buffer
};
let text = text.trim();
println!("ENCRYPTED: S{}", deconvert_string(text.to_string()));
}
8 changes: 6 additions & 2 deletions src/bin/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ fn main() {
let result = tokenizer.tokenize();
let mut parser = Parser::new(&result);
let result = parser.parse();
let evaluator = Evaluator::new(result);
let mut evaluator = Evaluator::new(result);
let result = evaluator.evaluate();

match result {
Node::String(s) => println!("{}", s),
Node::Integer(n) => println!("{}", n),
_ => panic!("Unexpected result: {:?}", result),
_ => {
println!("=== unexpected result ===");
result.dump_tree(0);
panic!("Unexpected result: {:?}", result)
}
}
}
Loading

0 comments on commit bf63d19

Please sign in to comment.