2022-01-21 17:43:50 -06:00
|
|
|
# vl
|
|
|
|
another lisp dialect
|
|
|
|
|
|
|
|
```lisp
|
|
|
|
(fun factorial [x]
|
|
|
|
(if (<= x 1)
|
|
|
|
1
|
|
|
|
(* x (factorial (- x 1)))))
|
|
|
|
|
|
|
|
(def times 7)
|
|
|
|
(do
|
|
|
|
(print (factorial times)))
|
|
|
|
```
|
|
|
|
|
2022-01-23 15:42:08 -06:00
|
|
|
Compliation flow:
|
|
|
|
```
|
|
|
|
Input(file) -> Lexer -> Parser -> Interpret
|
|
|
|
String Token Expr IO
|
|
|
|
|-> Compile(TODO)
|
|
|
|
File
|
|
|
|
```
|
|
|
|
|
2022-01-21 17:43:50 -06:00
|
|
|
Progress:
|
|
|
|
- [X] Lexer & Parser
|
2022-01-22 15:36:13 -06:00
|
|
|
- [ ] Syntax checker & Type checker
|
2022-01-23 15:42:08 -06:00
|
|
|
- [X] Interpreter
|
2022-01-22 15:36:13 -06:00
|
|
|
- [ ] Compiler
|
|
|
|
|
|
|
|
Problems:
|
2022-01-23 15:42:08 -06:00
|
|
|
- Parser only detect the first error.
|
2022-01-22 15:36:13 -06:00
|
|
|
- Parser can't detect `(()))` syntax error.
|