Wowww, omggg, another Lisp Interpreter!! That's so original!! I bet you learned a lot from doing this, didn't u?...
Usage
cargo run <file_path> # Interpret the file
cargo run # REPL mode
- Heterogenous ASTs: Because homogenous sucks. There are just a few nodes that really need children. Using a homogenous type would force us to waste memory (a lot).
- Parse don't just parse: For now! For enhancing static types and ""optimizations"", we are moving this to another tree walk.
- Monolithic scopes: We only have one scope... And for the future
(lambda ...)
implementations we are going to change a few things. For lambda functions we hack our way into making a aux stack to preserve the previous scope.
- Lambda
- REPL (Read-Eval-Print Loop).
- Read file instead of just hardcoding it... Obviously.
- Better error messages. (Current one it's terrible)
- Should use graphemes.
unicode-segmentation
- Use static lifetimes instead of just
.clone()
everything. lol - TokenType
FunCall
can be extinct. That's gonna change the grammar into a CSG... We are going to use the symbol table at the parser probably... Looking at another approach. - Allow recursive functions.
- Allow multiple
s_expr
as a news_expr
. Like a list of expressions that must be evaluated. The return of this list will be the first or last evaluation (Probably two different lists for this?)if (<condition>) (print ("true")) (list (print("it's false")) (define x (+ x 1)) (define y (+ y x)))
(
(+ 1 2) ; 3
(+ 1 (+ 2 3)) ; 6
(* 4 2 ) ; 8
)
(define <ID> (<s_expr>))
(define (x) ) | (define x ("asd")) | (define x (true)) | (define x (false))
(define a (x)) | (define x (+ 1 2)) | ...
Lol, we only have three comparisons
(< 1 2) ;; < number number
(> 2 1) ;; > number number
(= 1 2) ;; = number number | string string | boolean boolean
(+ 1 2 3 4 5...)
(- 1 2 3 4 5...)
(if (<s_expr>) (<s_expr>) (<s_expr>))
(if (> x 2) (
define g 2
) (
if (= x 4) (define g 4) (define g 1)
))