version 0.2

try, throw implemented
help screen updates
some code reorganisation
readme and doc updates
This commit is contained in:
2021-06-10 23:26:14 +02:00
parent b50e9ba128
commit f594437b61
7 changed files with 227 additions and 105 deletions

109
Readme.md
View File

@@ -1,41 +1,35 @@
### BUGS
- (read-file "nonexisting/file.csv") shows only "could not open file" - should print filename
- better error reporting..for example ls_dir on non existing dir should prind `pwd` dir
## ml
is a small lisp interpreter based on Adam McDaniel's wisp interpreter (https://github.com/adam-mcdaniel/wisp). It's main purpose is to learn something about more recent c++
### TODO
- add debug support, at least call stack
- multiline editing (kilo editor)
- execute system command should capture stderr
- add some mem stats to benchmark
- create pastebin like web using ml
#### Code
- documentation
- rename constants in ml_profiler.h
- replace to_string macro in ml.cpp
- add url of source/inspiration to clib/*.cpp
- add instrumentation (time, nr of evals, num of atoms, debug info, debug environment etc)
#### Language
- support for "t" symbol as a true
- support for exceptions
- string functions
- compare - needed for sorting, cmp ignore case
- regexp functions
- date support
- decode-universal-time
- env functions
- get-env, set-env; set-env cannot be implemented in stdlib.lsp, because popen is in fact subshell
- add include-stdlib function for other libs in stdlib dir (during startup stdlib.lsp is loaded only)
- syntax highlighting do VS Code
### Example of use
```
cat <<EOT > /tmp/qs.lsp
(defun qs (l)
(if (<= (len l) 1)
l
(do
(define pivot (first l))
(+
(qs (filter (lambda (n) (> pivot n)) l))
(list pivot)
(qs (tail (filter (lambda (n) (<= pivot n)) l)))
))
))
#### Performance
- define is one of most frequent callee, when in scope with very few vars, lookup sequentially
- first, second are often called -> implement in c++
- push_back - repeatedly without reserving size
- range - with for(int i...) and reserving result size can be 3times faster on (range 1 10000)
- mini_sprintf - unnecesary copying between vector and list
- (do, scope ..) repeatedly assign to acc
(print (qs '(10 9 8 7 6 5 4 3 2 10)))
EOT
ml -f /tmp/qs.lsp
```
#### Interactive mode
```
ml
```
#### Documentation
see /doc/Doc.md
#### Compile
```
@@ -58,17 +52,48 @@ utils/local_install.sh
```
### Example of use
```
ml -f tests/test.lsp
```
### KNOWNN BUGS
### TODO
- add debug support, at least call stack
- multiline editing (see kilocpp editor)
- execute system command should capture stderr
- add some mem stats to benchmark
#### Code
- add documentation
- rename constants in ml_profiler.h
- replace to_string macro in ml.cpp
- add instrumentation (time, nr of evals, num of atoms, debug info, debug environment etc)
#### Language
- support for "t" symbol as a true
- support for exceptions
- string functions
- compare - needed for sorting, cmp ignore case
- regexp match, regexp tokens
- date support
- decode-universal-time (http://www.lispworks.com/documentation/HyperSpec/Body/f_dec_un.htm)
- env functions
- get-env, set-env; set-env cannot be implemented in stdlib.lsp, because popen is in fact subshell
- add include-stdlib function for other libs in stdlib dir (during startup stdlib.lsp is loaded only)
- syntax highlighting do VS Code
#### Performance
- define is one of most frequent callee, when in scope with very few vars, lookup sequentially
- first, second are often called -> implement in c++
- push_back - repeatedly without reserving size
- range - with for(int i...) and reserving result size can be 3times faster on (range 1 10000)
- mini_sprintf - unnecesary copying between vector and list
- (do, scope ..) repeatedly assign to acc
### Links
https://github.com/adam-mcdaniel/wisp
https://github.com/dropbox/json11
https://github.com/adam-mcdaniel/wisp
https://github.com/dropbox/json11
https://github.com/antirez/linenoise
#### read stdout and stderr from popen
https://stackoverflow.com/questions/478898/how-do-i-execute-a-command-and-get-the-output-of-the-command-within-c-using-po
https://stackoverflow.com/questions/478898how-do-i-execute-a-command-and-get-the-output-of-the-command-within-c-using-po