Expand description

Lynx is an interpreter for lynx language specs derived from the noted The Monkey Language and the book ``. It is an educational crate aimed to learn how programming languages are made. Also, it is made by rookie rustaceans like me. The code in this library includes lots of comments as well as test cases. The whole idea is from the notable book The Monkey Language. I also have the idea to extend it when I am available on this project again.

In general, an interpreter consists of three major parts, as divided in separate file in src folder.

A Tokenizer will tokenize input text or stream into tokens.

Sometimes, a simple numeric can be a Number token;

1 // Token::Number

lexer

std::iter::FromIterator;
std::iter::Peekable;
std::str::CharIndices;

parser

  • pratt parsing
std::slice::Chunks
std::ops::Deref;

evaluator

// let foo1 = 2;

// outer = Env {
//     store: {
//         print: fn (),
//         foo1: 2
//     },
//     outer: None
// }

// fn call_fn(foo) {
// let bar = 1;
// return foo + bar;
// }

// call_fn(foo1)

// ScopedEnv {
//     store: {
//         bar: 1
//     },
//     outer: outer
// }

repl

Modules